x402-chainlink
    Preparing search index...

    Function toAtomicUnits

    • Convert human-readable amount to atomic units (smallest unit)

      Parameters

      • amount: number

        Amount in human-readable units (e.g., 1.5 for 1.5 USDC)

      • symbol: TokenSymbol

        Token symbol

      Returns string

      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)