Get token balance
$defi wallet balance is a function that gets your wallet balance for a given token. If your desired token isn't in the dropdown list, you can enter its contract address.
This function is particularly useful for enterprise users who are managing numerous different tokens across various blockchains.
Contents |
User Level
This function is exclusively available for enterprise users.
Parameters
Chain: The blockchain on which your DeFi Wallet and the token of your interest is located. The options are "Avalanche" or "BinanceSmartChain".
Token ID: This is the identifier for the token you are interested in. If your desired token isn't in the dropdown list, you can manually enter its contract address.
Return Value
This function returns a string value, your wallet balance for the specified token on the selected blockchain.
Example
set(#my token balance in Avalanche, $defi wallet balance("Avalanche", "AVAX"), "Global") ui text msg("Your AVAX balance in Avalanche is: {#my token balance in Avalanche}")
In this example, the script is setting a global variable for your balance of the AVAX token on the Avalanche chain, and then displaying it in the UI.