Get token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
The '''$wallet balance''' function retrieves the balance of a specific token in your DeFi wallet.
+
'''$get token balance''' is a function that returns your wallet balance for a given token on a specific blockchain chain.
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain chain that the respective token belongs to.
+
'''Chain:''' The blockchain chain where the token resides.  
  
'''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.
+
'''Token ID:''' The token you want to check the balance of.
  
 
== Return Value ==
 
== Return Value ==
  
It returns the balance of the chosen token in your DeFi wallet, as a string.
+
This function returns your wallet balance for the given token on the specified chain as a string.
  
 
== Example ==
 
== Example ==
Line 15: Line 15:
 
<pre>
 
<pre>
 
config defi wallet("your private key")
 
config defi wallet("your private key")
log("BinanceSmartChain BNB Balance: {$wallet balance("BinanceSmartChain", "BNB")}")
+
log("DAI Balance: {$get token balance("BinanceSmartChain", "DAI")}")
log("Avalanche AVAX Balance: {$wallet balance("Avalanche", "AVAX")}")
+
log("ETH Balance: {$get token balance("Avalanche", "ETH")}")
 
</pre>
 
</pre>
  
Line 23: Line 23:
 
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.
 
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.
+
The output will be the balance of your DeFi Wallet for the specified chain in the particular tokens.
  
 
Example Output:
 
Example Output:
 
<blockquote>
 
<blockquote>
<p>BinanceSmartChain BNB Balance: 5.23568</p>
+
<p>DAI Balance: 500</p>
<p>Avalanche AVAX Balance: 12.4577</p>
+
<p>ETH Balance: 2.5</p>
 
</blockquote>
 
</blockquote>
  
This function will help you to keep track of your holdings in different tokens on various blockchains.
+
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.

Revision as of 19:45, 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 as a string.

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox