Formatting Functions
Formatting functions of Azoth SDK for working with numbers and blockchain data
formatInput()
formatInput()function formatInput(amount: string, unit?: string | ethers.Numeric): bigint// Format 10 USDT for transaction (USDT has 6 decimal places)
const amount = formatInput('10', 6);
console.log(amount); // 10000000n
// Format 1.5 ETH for transaction (ETH has 18 decimal places)
const ethAmount = formatInput('1.5', 18);
console.log(ethAmount); // 1500000000000000000nformatOutput()
formatOutput()
Practical Examples
Working with Balances
Working with Different Tokens
Error Handling
Last updated