Get token balance
Line 1: | Line 1: | ||
− | '''$wallet balance''' | + | The '''$wallet balance''' function retrieves the balance of a specific token in your DeFi wallet. |
− | + | ||
− | + | ||
== Parameters == | == Parameters == | ||
− | '''Chain:''' The blockchain chain | + | '''Chain:''' The blockchain chain that the respective token belongs to. |
− | '''Token ID:''' The token for which you | + | '''Token ID:''' The token for which you want to check the balance. If your desired token isn't in the dropdown, you can enter its contract address. |
== Return Value == | == Return Value == | ||
− | + | ||
+ | It returns the balance of the chosen token in your DeFi wallet, as a string. | ||
== Example == | == Example == | ||
+ | |||
<pre> | <pre> | ||
− | log("BinanceSmartChain | + | config defi wallet("your private key") |
− | log("Avalanche | + | log("BinanceSmartChain BNB Balance: {$wallet balance("BinanceSmartChain", "BNB")}") |
+ | log("Avalanche AVAX Balance: {$wallet balance("Avalanche", "AVAX")}") | ||
</pre> | </pre> | ||
− | + | 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. | ||
+ | |||
+ | This script will print out the balance of Binance Coin (BNB) on the Binance Smart Chain and AVAX on Avalanche. | ||
Example Output: | Example Output: | ||
<blockquote> | <blockquote> | ||
− | <p>BinanceSmartChain | + | <p>BinanceSmartChain BNB Balance: 5.23568</p> |
− | <p>Avalanche | + | <p>Avalanche AVAX Balance: 12.4577</p> |
</blockquote> | </blockquote> | ||
− | + | This function will help you to keep track of your holdings in different tokens on various blockchains. |
Revision as of 19:31, 4 July 2023
The $wallet balance function retrieves the balance of a specific token in your DeFi wallet.
Parameters
Chain: The blockchain chain that the respective token belongs to.
Token ID: The token for which you want to check the balance. If your desired token isn't in the dropdown, you can enter its contract address.
Return Value
It returns the balance of the chosen token in your DeFi wallet, as a string.
Example
config defi wallet("your private key") log("BinanceSmartChain BNB Balance: {$wallet balance("BinanceSmartChain", "BNB")}") log("Avalanche AVAX Balance: {$wallet balance("Avalanche", "AVAX")}")
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.
This script will print out the balance of Binance Coin (BNB) on the Binance Smart Chain and AVAX on Avalanche.
Example Output:
BinanceSmartChain BNB Balance: 5.23568
Avalanche AVAX Balance: 12.4577
This function will help you to keep track of your holdings in different tokens on various blockchains.