@pwngh/economy-lab
    Preparing search index...

    Function toAmount

    • Builds an Amount from a currency and a minor-unit count. Throws AMOUNT_OVERFLOW when the count falls outside the signed 64-bit range the ledger's BIGINT columns store, so an unstorable amount fails at construction rather than at the database.

      Parameters

      Returns Amount

      const price = toAmount('CREDIT', 1_500_000n); // 15,000 credits
      const cash = toAmount('USD', 10_000n); // $100.00