Get native token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
'''$native balance''' is a function that retrieves the balance of the native token on a specified blockchain.
+
'''$get native token balance''' is a function that retrieves the balance of the native token on the specified blockchain chain (Avalanche, BinanceSmartChain etc).
 
+
This function provides you the balance of the native token corresponding to the specified blockchain chain in your DeFi wallet.
+
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The specific blockchain chain on which the native token balance is to be checked. It can be either "Avalanche" or "BinanceSmartChain".
+
'''Chain:''' The name of the chain from which you want to get the balance.
  
 
== Return Value ==
 
== Return Value ==
This function returns a string which represents the balance of the native token in your DeFi wallet.
+
 
 +
This function returns the balance of the native token on the specified chain.
  
 
== Example ==
 
== Example ==
 +
 
<pre>
 
<pre>
log("Native Balance on BinanceSmartChain: {$native balance("BinanceSmartChain")}")
+
config defi wallet("your private key")
log("Native Balance on Avalanche: {$native balance("Avalanche")}")
+
log("Avalanche Balance: {$get native token balance("Avalanche")}")
 +
log("BinanceSmartChain Balance: {$get native token balance("BinanceSmartChain")}")
 
</pre>
 
</pre>
  
The output of this function will be the amount of the native token you have on the specified chain.
+
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 example fetches the balance of the native token on both Avalanche (AVAX) and Binance Smart Chain (BNB). Replace "Avalanche" or "BinanceSmartChain" with the chain you're interested in.
 +
 
 +
The output will display your balance of the native token for the selected chain.
  
 
Example Output:
 
Example Output:
 
<blockquote>
 
<blockquote>
<p>Native Balance on BinanceSmartChain: 10.00 BNB</p>
+
<p>Avalanche Balance: 10.2</p>
<p>Native Balance on Avalanche: 20.00 AVAX</p>
+
<p>BinanceSmartChain Balance: 5.3</p>
 
</blockquote>
 
</blockquote>
  
Remember, the balances will be different depending on the amount you hold in your wallet.
+
This information can be useful when you want to check how much native token (like AVAX or BNB) you have before making a transaction, because these tokens are often used for transaction fees.

Latest revision as of 19:48, 4 July 2023

$get native token balance is a function that retrieves the balance of the native token on the specified blockchain chain (Avalanche, BinanceSmartChain etc).

[edit] Parameters

Chain: The name of the chain from which you want to get the balance.

[edit] Return Value

This function returns the balance of the native token on the specified chain.

[edit] Example

config defi wallet("your private key")
log("Avalanche Balance: {$get native token balance("Avalanche")}")
log("BinanceSmartChain Balance: {$get native token balance("BinanceSmartChain")}")

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 example fetches the balance of the native token on both Avalanche (AVAX) and Binance Smart Chain (BNB). Replace "Avalanche" or "BinanceSmartChain" with the chain you're interested in.

The output will display your balance of the native token for the selected chain.

Example Output:

Avalanche Balance: 10.2

BinanceSmartChain Balance: 5.3

This information can be useful when you want to check how much native token (like AVAX or BNB) you have before making a transaction, because these tokens are often used for transaction fees.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox