Convert human-readable amount to atomic units (smallest unit)
Amount in human-readable units (e.g., 1.5 for 1.5 USDC)
Token symbol
Amount in atomic units as string
const atomic = toAtomicUnits(1.5, 'USDC');console.log(atomic); // '1500000' (1.5 * 10^6)const ethAtomic = toAtomicUnits(0.001, 'ETH');console.log(ethAtomic); // '1000000000000000' (0.001 * 10^18) Copy
const atomic = toAtomicUnits(1.5, 'USDC');console.log(atomic); // '1500000' (1.5 * 10^6)const ethAtomic = toAtomicUnits(0.001, 'ETH');console.log(ethAtomic); // '1000000000000000' (0.001 * 10^18)
Convert human-readable amount to atomic units (smallest unit)