Get token balance
Line 1: | Line 1: | ||
− | '''$defi wallet balance''' is a function that gets your wallet balance for a given token. | + | '''$defi wallet balance''' is a function that gets your wallet balance for a given token. You can select your token from the dropdown menu or, if your desired token isn't in the dropdown, you can manually enter its contract address. |
− | This | + | This command is designed especially for enterprise users who need to check portfolio balances across various tokens in their blockchain wallets. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Parameters == | == Parameters == | ||
− | '''Chain:''' The blockchain on which | + | '''Chain:''' The blockchain network chain on which the token belongs. Options available are Avalanche and Binance Smart Chain. |
− | '''Token ID:''' | + | '''Token ID:''' The identifier of the token for which you wish to retrieve the wallet balance. If your desired token is not available in the dropdown, you can enter its contract address. |
− | == Return Value == | + | == Return Value == |
− | + | This function returns a string value representing the balance of the specified token in your wallet. | |
− | This function returns a string value | + | |
== Example == | == Example == | ||
− | |||
<pre> | <pre> | ||
− | + | ui console view | |
− | + | config defi wallet("your private key here") | |
+ | log("DeFi Wallet Balance for selected token: {$defi wallet balance("Avalanche","AVAX")}") | ||
</pre> | </pre> | ||
− | + | Do ensure to replace "your private key here" with your actual private key. Always handle private keys securely as they are highly sensitive information. | |
+ | |||
+ | The output of the script will display the balance of the specified token (in this case, AVAX on the Avalanche chain) in your DeFi wallet. The output might look something like this: | ||
+ | <blockquote> | ||
+ | DeFi Wallet Balance for selected token: 100 AVAX | ||
+ | </blockquote> |
Revision as of 18:56, 4 July 2023
$defi wallet balance is a function that gets your wallet balance for a given token. You can select your token from the dropdown menu or, if your desired token isn't in the dropdown, you can manually enter its contract address.
This command is designed especially for enterprise users who need to check portfolio balances across various tokens in their blockchain wallets.
Parameters
Chain: The blockchain network chain on which the token belongs. Options available are Avalanche and Binance Smart Chain.
Token ID: The identifier of the token for which you wish to retrieve the wallet balance. If your desired token is not available in the dropdown, you can enter its contract address.
Return Value
This function returns a string value representing the balance of the specified token in your wallet.
Example
ui console view config defi wallet("your private key here") log("DeFi Wallet Balance for selected token: {$defi wallet balance("Avalanche","AVAX")}")
Do ensure to replace "your private key here" with your actual private key. Always handle private keys securely as they are highly sensitive information.
The output of the script will display the balance of the specified token (in this case, AVAX on the Avalanche chain) in your DeFi wallet. The output might look something like this:
DeFi Wallet Balance for selected token: 100 AVAX