Friendly token amount

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

Jump to: navigation, search

$get proper token amount is a function that returns the amount of a specified token with the decimal in the correct place. This command is very useful for enterprise users managing transactions with various tokens, ensuring the correct token quantities are used.

Parameters

Chain: The blockchain network chain associated with the token. Available options include Avalanche and Binance Smart Chain.

Token ID: The identifier of the token for which the correct amount is to be obtained. If your desired token is not available in the dropdown, you can input its contract address.

Amount: The raw quantity of the specified token that needs to be adjusted for decimals.

Return Value

This function returns a string that represents the correct amount of the specified token, considering the decimal placement.

Example

ui console view 
config defi wallet("your private key here")
log("Proper token amount: {$get proper token amount("BinanceSmartChain","0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c","50000000000000000000")}")

Make sure to replace "your private key here" with your actual private key. Private keys are sensitive information that needs to be handled securely.

The output of this script will display the amount of the specified token (given by the ID "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" on the Binance Smart Chain) adjusted for appropriate decimal placement. The output might look something like this:

Proper token amount: 50.0
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox