toStablecoinUnits()
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / toStablecoinUnits
Function: toStablecoinUnits()
Section titled “Function: toStablecoinUnits()”toStablecoinUnits(
amount,symbol):bigint
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:6285
Convert human-readable amount to smallest units
Parameters
Section titled “Parameters”amount
Section titled “amount”number
Human-readable amount (e.g., 100.50)
symbol
Section titled “symbol”Stablecoin symbol
Returns
Section titled “Returns”bigint
Amount in smallest units (e.g., 100500000 for USDC)
Example
Section titled “Example”toStablecoinUnits(100.50, 'USDC') // 100500000n (6 decimals)toStablecoinUnits(100.50, 'DAI') // 100500000000000000000n (18 decimals)