getTokenBalance
Gets the token balance of a Solana account
Last updated
Gets the token balance of a Solana account
(async() => {
let token_balance_1 = await SOLPay.getTokenBalance("TOKEN_ADDRESS"); // {...}
let token_balance_2 = await SOLPay.getTokenBalance("TOKEN_ADDRESS", "SOLANA_ADDRESS"); // {...}
})();token_address: string - the mint address of the token with which to get the token balance
address (optional, default: connected wallet address): string - the Solana address with which to get the token balance
object ({...}) - the token balance
raw_data: object ({...}) - the raw data of the account
account: object ({...}) - the balance details of the account
address: string ("...") - the address of the account
lamports: number (10000) - the number of lamports in the account
token: object ({...}) - the token balance details
balance: object ({...}) - the token balance
amount: string ("11") - the number of tokens as an integer
decimals: number (9) - the number digits after the decimal point in a token
uiAmount: number (0.000000011) - the number of tokens as a decimal (deprecated)
uiAmountString: string ("0.000000011") - the number of tokens as a decimal in a string form
SOL Pay SDK Fatal Error: Invalid token address ${token_address}. - an invalid token address was used
SOL Pay SDK Fatal Error: Invalid address ${address}, and no wallet was connected. Use SOLPay.connectWallet() to connect to a Solana wallet. - an invalid address was used, and no wallet was connected
SOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network. - could not find a connection to the Solana network
SOL Pay SDK Fatal Error: Connection did not respond. Use SOLPay.connectNetwork() to connect to the Solana network. - did not receive response from Solana network
Last updated