Get token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''$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.
+
'''$wallet balance''' is a function that gets your wallet balance for a given token. 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.
+
This function provides you the balance of a specific token in your DeFi wallet.
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain network chain on which the token belongs. Options available are Avalanche and Binance Smart Chain.
+
'''Chain:''' The blockchain chain your wallet is on. It can be either "Avalanche" or "BinanceSmartChain".
  
'''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.
+
'''Token ID:''' The token for which you're seeking to check the balance in your wallet.
  
 
== 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 which is the balance of the specific token in your DeFi wallet.
  
 
== Example ==
 
== Example ==
 
<pre>
 
<pre>
ui console view
+
log("BinanceSmartChain BUSD Balance: {$wallet balance("BinanceSmartChain","BUSD")}")
config defi wallet("your private key here")
+
log("Avalanche Pangolin Balance: {$wallet balance("Avalanche","Pangolin")}")
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 this function is the balance of the particular token in your DeFi wallet.  
  
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:
+
Example Output:
 
<blockquote>
 
<blockquote>
DeFi Wallet Balance for selected token: 100 AVAX
+
<p>BinanceSmartChain BUSD Balance: 100 BUSD</p>
 +
<p>Avalanche Pangolin Balance: 50 Pangolin</p>
 
</blockquote>
 
</blockquote>
 +
 +
Remember, the balances will differ depending on the amount of the token you hold in your wallet.

Revision as of 19:05, 4 July 2023

$wallet balance is a function that gets your wallet balance for a given token. If your desired token isn't in the dropdown, you can manually enter its contract address.

This function provides you the balance of a specific token in your DeFi wallet.

Parameters

Chain: The blockchain chain your wallet is on. It can be either "Avalanche" or "BinanceSmartChain".

Token ID: The token for which you're seeking to check the balance in your wallet.

Return Value

This function returns a string which is the balance of the specific token in your DeFi wallet.

Example

log("BinanceSmartChain BUSD Balance: {$wallet balance("BinanceSmartChain","BUSD")}")
log("Avalanche Pangolin Balance: {$wallet balance("Avalanche","Pangolin")}")

The output of this function is the balance of the particular token in your DeFi wallet.

Example Output:

BinanceSmartChain BUSD Balance: 100 BUSD

Avalanche Pangolin Balance: 50 Pangolin

Remember, the balances will differ depending on the amount of the token you hold in your wallet.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox