Get native token balance

From UBot Studio
Revision as of 16:34, 4 July 2023 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

$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.

Parameters

Chain: The blockchain network (e.g., Avalanche, BinanceSmartChain) where the native token resides.

Return Value

This function returns a string representing the balance of the native token in your connected wallet on the specified blockchain network.

Example

log("My balance of AVAX: {$get native balance("Avalanche")}")
log("My balance of BNB: {$get native balance("BinanceSmartChain")}")

The above example script logs the balance of the native tokens (AVAX for Avalanche and BNB for BinanceSmartChain) in the default wallet.

    • Please note:**

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox