@dfinity/oisy-wallet-signer
Version:
A library designed to facilitate communication between a dApp and the OISY Wallet on the Internet Computer.
18 lines (17 loc) • 900 B
TypeScript
import type { CborValue } from '@dfinity/cbor';
/**
* A replacer function used to serialize specific fields of the contentMap.
*
* This function ensures:
* - `ingress_expiry` is converted from an `Expiry` object to its internal `bigint` representation.
* - `sender` and `canister_id` fields are converted from `Principal` objects to `Uint8Array`.
*
* These transformations maintain compatibility with the existing decoder in agent-js v2
* while conforming to the IC spec for CBOR encoding.
*
* @template T - The underlying type of the CBOR value.
* @param {CborValue<T>} [value] - The value to possibly transform.
* @param {string} [key] - The key associated with the value during object traversal.
* @returns {CborValue<T>} The transformed value if applicable, or the original value.
*/
export declare const contentMapReplacer: <T>(value?: CborValue<T>, key?: string) => CborValue<T>;