Skip to main content

Method Signature

Parameters

string
required
Raw amount in smallest units (e.g., wei, satoshi)
number
required
Token decimals (e.g., 6 for USDC, 18 for ETH)

Returns

Returns the formatted amount as a string (e.g., "100.50").

Examples

Common Token Decimals

Use parseAmount() for the reverse operation (human-readable → raw).

Parse Amount

Convert to raw units

Get Token Info

Get token decimals