getStealthBalance()
SIP Protocol API Reference v0.15.1
SIP Protocol API Reference / getStealthBalance
Function: getStealthBalance()
Section titled “Function: getStealthBalance()”getStealthBalance(
connection,stealthAddress,mint,provider?,tokenProgramId?):Promise<bigint>
Defined in: @sip-protocol/sdk/dist/index-GLbkPPho.d.ts:15817
Get token balance for a stealth address
Parameters
Section titled “Parameters”connection
Section titled “connection”Connection
Solana RPC connection
stealthAddress
Section titled “stealthAddress”string
Stealth address to check (base58)
PublicKey
SPL token mint address
provider?
Section titled “provider?”Optional RPC provider for efficient queries
tokenProgramId?
Section titled “tokenProgramId?”PublicKey
SPL token program owning the mint (default: classic Token program; pass TOKEN_2022_PROGRAM_ID for Token-2022 mints)
Returns
Section titled “Returns”Promise<bigint>
Token balance in smallest unit
Example
Section titled “Example”// Using standard RPCconst balance = await getStealthBalance(connection, stealthAddr, mint)
// Using Helius for efficient queriesconst helius = createProvider('helius', { apiKey })const balance = await getStealthBalance(connection, stealthAddr, mint, helius)