Get token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''$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.
+
The '''$wallet balance''' function retrieves the balance of a specific token in your DeFi wallet.
 
+
This function provides you the balance of a specific token in your DeFi wallet.
+
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain chain your wallet is on. It can be either "Avalanche" or "BinanceSmartChain".
+
'''Chain:''' The blockchain chain that the respective token belongs to.
  
'''Token ID:''' The token for which you're seeking to check the balance in your wallet.
+
'''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 ==
This function returns a string which is the balance of the specific token in your DeFi wallet.
+
 
 +
It returns the balance of the chosen token in your DeFi wallet, as a string.
  
 
== Example ==
 
== Example ==
 +
 
<pre>
 
<pre>
log("BinanceSmartChain BUSD Balance: {$wallet balance("BinanceSmartChain","BUSD")}")
+
config defi wallet("your private key")
log("Avalanche Pangolin Balance: {$wallet balance("Avalanche","Pangolin")}")
+
log("BinanceSmartChain BNB Balance: {$wallet balance("BinanceSmartChain", "BNB")}")
 +
log("Avalanche AVAX Balance: {$wallet balance("Avalanche", "AVAX")}")
 
</pre>
 
</pre>
  
The output of this function is the balance of the particular token in your DeFi wallet.  
+
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 BUSD Balance: 100 BUSD</p>
+
<p>BinanceSmartChain BNB Balance: 5.23568</p>
<p>Avalanche Pangolin Balance: 50 Pangolin</p>
+
<p>Avalanche AVAX Balance: 12.4577</p>
 
</blockquote>
 
</blockquote>
  
Remember, the balances will differ depending on the amount of the token you hold in your wallet.
+
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.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox