Get native token balance
From UBot Studio
$native token balance is a function that gets the balance of the native token on a specific blockchain.
This function is designed for enterprise users who are interacting with various blockchains and need to keep track of their native token balances.
Contents |
User Level
This function is exclusively available for enterprise users.
Parameters
Chain: The blockchain from which you want to obtain your native token balance. The options are "Avalanche" or "BinanceSmartChain".
Return Value
This function returns a string value - your wallet balance for the native token on the specified blockchain.
Example
set(#my native token balance in BSC, $native token balance("BinanceSmartChain"), "Global") ui text msg("Your native token balance in Binance Smart Chain is: {#my native token balance in BSC}")
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.