Function registerCBORDecoders

  • Registers all available CBOR decoders globally with the cbor2 library.

    This function currently registers the following decoders:

    • AccountAddress (tag 40307): For decoding Concordium account addresses
    • TokenAmount (tag 4): For decoding protocol-level token amounts as decimal fractions
    • CborMemo (tag 24): For decoding protocol-level token memos as cbor encoded data items

    Returns

    An array of functions to clean up decoder registrations, i.e. restore the decoders registered prior to registering the Concordium-specific ones.

    Example

    // Register all CBOR decoders globally const oldDecoders = registerDecoders(); // Now cbor2.decode will automatically handle known Concordium types const address = decode(cborBytes); const tokenAmount = decode(tokenCborBytes); // Restore old decoders oldDecoders.forEach((cleanup) => { cleanup(); });

    Returns (() => void)[]

Generated using TypeDoc