Get native token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with "'''$get native balance''' is a function that fetches the balance of the native token on a specified blockchain. Native tokens are integral to their blockchain network and are ...")
 
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
'''$get native balance''' is a function that fetches the balance of the native token on a specified blockchain. Native tokens are integral to their blockchain network and are generally used to pay for transaction fees, computational services, and other operational costs.
+
'''$get native token balance''' is a function that retrieves the balance of the native token on the specified blockchain chain (Avalanche, BinanceSmartChain etc).
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain network (e.g., Avalanche, BinanceSmartChain) where the native token resides.
+
'''Chain:''' The name of the chain from which you want to get the balance.
  
 
== Return Value ==
 
== Return Value ==
  
This function returns a string representing the balance of the native token in your connected wallet on the specified blockchain network.
+
This function returns the balance of the native token on the specified chain.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
log("My balance of AVAX: {$get native balance("Avalanche")}")
+
config defi wallet("your private key")
log("My balance of BNB: {$get native balance("BinanceSmartChain")}")
+
log("Avalanche Balance: {$get native token balance("Avalanche")}")
 +
log("BinanceSmartChain Balance: {$get native token balance("BinanceSmartChain")}")
 
</pre>
 
</pre>
  
The above example script logs the balance of the native tokens (AVAX for Avalanche and BNB for BinanceSmartChain) in the default wallet.
+
Please replace "your private key" with your actual DeFi wallet's private key.
  
**Please note:**
+
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.
  
Make sure that the wallet is connected to your desired blockchain network before running the '''$get native balance''' function using the `connect defi wallet` command. Without a connected wallet, the function will not be able to fetch and return the balance.
+
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:
 +
<blockquote>
 +
<p>Avalanche Balance: 10.2</p>
 +
<p>BinanceSmartChain Balance: 5.3</p>
 +
</blockquote>
 +
 
 +
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