Check Balance Token
This method allows you to check your token balance from a particular token address in a blockchain network.
Method Signature
async balanceToken(tokenAddress: string, network: Network): Promise<CheckBalanceResponse>
Parameters
tokenAddress
:string
- The address of the token.network
:Network
- The network used for transactions. You can use theNetwork
enum to specify the network.
Returns
Promise<CheckBalanceResponse>
- An object containing the following properties:
balance
:string
- The balance of the token.symbol
:string
- The symbol of the token.address
:string
- The wallet address.
Example Usage
const tokenAddress = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
const balanceInfo = await sdk.wallet.balanceToken(tokenAddress, Network.ETHEREUM);
console.log(balanceInfo);
Response Example
{
"balance": "90.0",
"symbol": "WETH",
"address": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964"
}
ℹ️
The response is an object containing the balance, symbol, and address of the specified token for the given network.
Additional Information
- This method requires a valid wallet token in the SDK configuration.
- The balance is returned as a string to preserve precision for large numbers.
- The network parameter determines which blockchain network will be used for checking the token balance.
For more information, see the Xellar Check Balance Token API Documentation (opens in a new tab).