Cashu-TS - v4.5.1
    Preparing search index...

    Function deserializeProofs

    • Deserializes proofs from JSON back into typed Proof objects, restoring amount as bigint without silent precision loss.

      • Pass a string[] (individual proof JSON strings) when reading from NutZap proof tags or a database.
      • Pass a string (a JSON array) when reading from a single stored blob e.g. localStorage.
      • Pass a ProofLike[] of already-parsed proof objects for legacy data or database rows.

      Parameters

      Returns Proof[]

      // NutZap proof tags
      const proofs = deserializeProofs(
      event.tags.filter((t) => t[0] === 'proof').map((t) => t[1]),
      );

      // localStorage — pass the raw string, no JSON.parse needed
      const proofs = deserializeProofs(localStorage.getItem('proofs') ?? '[]');