Get token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(5 intermediate revisions by one user not shown)
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.
+
'''$get token balance''' is a function that returns your wallet balance for a given token on a specific blockchain chain.
 
+
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 network chain on which the token belongs. Options available are Avalanche and Binance Smart Chain.
+
'''Chain:''' The blockchain chain where the token resides.  
  
'''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 you want to check the balance of. This can be the symbol of the token, or it can be the 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 your wallet balance for the given token on the specified chain.
  
 
== Example ==
 
== Example ==
 +
 
<pre>
 
<pre>
ui console view
+
config defi wallet("your private key")
config defi wallet("your private key here")
+
log("DAI Balance: {$get token balance("BinanceSmartChain", "DAI")}")
log("DeFi Wallet Balance for selected token: {$defi wallet balance("Avalanche","AVAX")}")
+
log("ETH Balance: {$get token balance("Avalanche", "ETH")}")
 
</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.
+
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.
  
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>DAI Balance: 500</p>
 +
<p>ETH Balance: 2.5</p>
 
</blockquote>
 
</blockquote>

Latest revision as of 01:42, 5 July 2023

$get token balance is a function that returns your wallet balance for a given token on a specific blockchain chain.

[edit] Parameters

Chain: The blockchain chain where the token resides.

Token ID: The token you want to check the balance of. This can be the symbol of the token, or it can be the contract address.

[edit] Return Value

This function returns your wallet balance for the given token on the specified chain.

[edit] 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

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox