toYoctoNEAR()
SIP Protocol API Reference v0.7.4
SIP Protocol API Reference / toYoctoNEAR
Function: toYoctoNEAR()
Section titled “Function: toYoctoNEAR()”toYoctoNEAR(
amount,decimals):bigint
Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:18429
Convert human-readable token amount to smallest units
Parameters
Section titled “Parameters”amount
Section titled “amount”Human-readable amount (e.g., 100.5)
string | number
decimals
Section titled “decimals”number
Token decimals
Returns
Section titled “Returns”bigint
Amount in smallest units as bigint
Example
Section titled “Example”// 1 NEAR (24 decimals) = 10^24 yoctoNEARconst units = toYoctoNEAR(1, 24)// 1_000_000_000_000_000_000_000_000n
// 100.5 USDC (6 decimals) = 100,500,000 unitsconst usdc = toYoctoNEAR(100.5, 6)// 100_500_000n