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

    Function encodeAmounts

    Deep-walks any JSON-shaped value and swaps every branded Amount for its CURRENCY:decimal wire string (fixed two decimals, CREDIT:12.34) and every bare bigint for its decimal string, leaving everything else untouched, so the result survives JSON.stringify. The SQL engines store operations in JSON columns through this walk and the HTTP store adapter sends the same shape on the wire; a custom store persisting operations or events encodes with it to stay byte-compatible.

    • Walks any JSON-shaped value and swaps every branded Amount for its CREDIT:12.34 wire string. The one Amount-brand walk: the SQL engines use it to store an Operation in a JSON column, and the HTTP store adapter uses it for the same Operation on the wire. A per-kind branch would drift as the Operation union grows; the walk cannot.

      Parameters

      • value: unknown

      Returns unknown