Get native token balance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''$native token balance''' is a function that gets the balance of the native token on a specific blockchain.
+
'''$native token balance''' is a function that retrieves the balance of the native token on a specific blockchain. The command is particularly designed for enterprise users who are managing blockchain wallets and need to reference the native token balance regularly.
 
+
This function is designed for enterprise users who are interacting with various blockchains and need to keep track of their native token balances.
+
 
+
== User Level ==
+
 
+
This function is exclusively available for enterprise users.
+
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain from which you want to obtain your native token balance. The options are "Avalanche" or "BinanceSmartChain".
+
'''Chain:''' This is the blockchain network that the wallet belongs to. The chains that can be selected from the dropdown menu include Avalanche and Binance Smart Chain.
  
== Return Value ==  
+
== Return Value ==
  
This function returns a string value - your wallet balance for the native token on the specified blockchain.
+
This function returns a string value representing the balance of the native token on the specified blockchain.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
set(#my native token balance in BSC, $native token balance("BinanceSmartChain"), "Global")
+
ui console view
ui text msg("Your native token balance in Binance Smart Chain is: {#my native token balance in BSC}")
+
config defi wallet("your private key here")
 +
log("Native token balance: {$native token balance("Avalanche")}")
 
</pre>
 
</pre>
  
In this example, the script is setting a global variable for your balance of the native token on the Binance Smart Chain, and then displaying it in the UI.
+
Do ensure to replace "your private key here" with your actual private key. Always handle private keys securely as they are highly sensitive information.
 +
 
 +
The output of this script will display the balance of the native token on the specified chain (in this case, Avalanche) linked to your DeFi wallet. A potential output might look like:
 +
<blockquote>
 +
Native token balance: 100 AVAX
 +
</blockquote>

Revision as of 18:56, 4 July 2023

$native token balance is a function that retrieves the balance of the native token on a specific blockchain. The command is particularly designed for enterprise users who are managing blockchain wallets and need to reference the native token balance regularly.

Parameters

Chain: This is the blockchain network that the wallet belongs to. The chains that can be selected from the dropdown menu include Avalanche and Binance Smart Chain.

Return Value

This function returns a string value representing the balance of the native token on the specified blockchain.

Example

ui console view
config defi wallet("your private key here")
log("Native token balance: {$native token balance("Avalanche")}")

Do ensure to replace "your private key here" with your actual private key. Always handle private keys securely as they are highly sensitive information.

The output of this script will display the balance of the native token on the specified chain (in this case, Avalanche) linked to your DeFi wallet. A potential output might look like:

Native token balance: 100 AVAX
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox