Skip to content

Function: ledgerToAtomic() ​

ts
function ledgerToAtomic(amount, decimals): bigint | null;

Defined in: packages/x402-core/src/verify/common.ts:45

On-ledger Decimal → atomic units at decimals places. null when the input is not a valid ledger amount, so a malformed value can never compare equal to anything.

decimals is required rather than defaulted: the scale is the one thing a caller must have decided, and a default would let a new instrument be priced at Canton Coin's scale by omission.

Parameters ​

amount ​

string

decimals ​

number

Returns ​

bigint | null