Get native token balance

From UBot Studio
Jump to: navigation, search

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

Parameters

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

Return Value

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

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