Get token balance
(→Return Value) |
|||
Line 9: | Line 9: | ||
== Return Value == | == Return Value == | ||
− | This function returns your wallet balance for the given token on the specified chain | + | This function returns your wallet balance for the given token on the specified chain. |
== Example == | == Example == |
Revision as of 19:46, 4 July 2023
$get token balance is a function that returns your wallet balance for a given token on a specific blockchain chain.
Parameters
Chain: The blockchain chain where the token resides.
Token ID: The token you want to check the balance of.
Return Value
This function returns your wallet balance for the given token on the specified chain.
Example
config defi wallet("your private key") log("DAI Balance: {$get token balance("BinanceSmartChain", "DAI")}") log("ETH Balance: {$get token balance("Avalanche", "ETH")}")
Please replace "your private key" with your actual DeFi wallet's private key.
Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.
The output will be the balance of your DeFi Wallet for the specified chain in the particular tokens.
Example Output:
DAI Balance: 500
ETH Balance: 2.5
Your balance can be shared without risk, unlike your private key, because your balance simply represents how many tokens you have in your DeFi wallet.