Registers a CBOR decoder for the decimal fraction (tag 4) format with the cbor2 library.
This enables automatic decoding of CBOR data containing token amounts
when using the cbor2 library's decode function.
Returns
A cleanup function that, when called, will restore the previous
decoder (if any) that was registered for the decimal fraction format. This is useful
when used in an existing cbor2 use-case.
Example
// Register the decoder constcleanup = registerCBORDecoder(); // Use the decoder consttokenAmount = decode(cborBytes); // Returns TokenAmount if format matches // Later, unregister the decoder cleanup();
Registers a CBOR decoder for the decimal fraction (tag 4) format with the
cbor2library. This enables automatic decoding of CBOR data containing token amounts when using thecbor2library's decode function.Returns
A cleanup function that, when called, will restore the previous decoder (if any) that was registered for the decimal fraction format. This is useful when used in an existing
cbor2use-case.Example