Skip to content

toYoctoNEAR()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / toYoctoNEAR

toYoctoNEAR(amount, decimals): bigint

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:18429

Convert human-readable token amount to smallest units

Human-readable amount (e.g., 100.5)

string | number

number

Token decimals

bigint

Amount in smallest units as bigint

// 1 NEAR (24 decimals) = 10^24 yoctoNEAR
const units = toYoctoNEAR(1, 24)
// 1_000_000_000_000_000_000_000_000n
// 100.5 USDC (6 decimals) = 100,500,000 units
const usdc = toYoctoNEAR(100.5, 6)
// 100_500_000n