diff --git a/packages/ledger-icp/src/types/ledger_converters.ts b/packages/ledger-icp/src/types/ledger_converters.ts index c8f11db2..87ccc915 100644 --- a/packages/ledger-icp/src/types/ledger_converters.ts +++ b/packages/ledger-icp/src/types/ledger_converters.ts @@ -55,12 +55,24 @@ export type Icrc2ApproveRequest = Omit & { expires_at?: Icrc1Timestamp; spender: Account; }; - +/** + * Metadata for the consent message in ICRC-21 specification. + * @param {number} [utcOffsetMinutes] - The user's local timezone offset in minutes from UTC. If absent, the default is UTC. + * @param {string} language - BCP-47 language tag. See https://www.rfc-editor.org/rfc/bcp/bcp47.txt + */ export type Icrc21ConsentMessageMetadata = { utcOffsetMinutes?: number; language: string; }; +/** + * Device specification for displaying the consent message. + * + * @param {null} [GenericDisplay] - A generic display able to handle large documents and do line wrapping and pagination / scrolling. Text must be Markdown formatted, no external resources (e.g. images) are allowed. + * @param {Object} [LineDisplay] - Simple display able to handle lines of text with a maximum number of characters per line. + * @param {number} LineDisplay.charactersPerLine - Maximum number of characters that can be displayed per line. + * @param {number} LineDisplay.linesPerPage - Maximum number of lines that can be displayed at once on a single page. + */ export type Icrc21ConsentMessageDeviceSpec = | { GenericDisplay: null } | { @@ -70,11 +82,24 @@ export type Icrc21ConsentMessageDeviceSpec = }; }; +/** + * Specification for the consent message, including metadata and device preferences. + * + * @param {Icrc21ConsentMessageMetadata} metadata - Metadata of the consent message. + * @param {Icrc21ConsentMessageDeviceSpec} [deviceSpec] - Information about the device responsible for presenting the consent message to the user. + */ export type Icrc21ConsentMessageSpec = { metadata: Icrc21ConsentMessageMetadata; deriveSpec?: Icrc21ConsentMessageDeviceSpec; }; +/** + * Parameters for the consent message request. + * + * @param {string} method - Method name of the canister call. + * @param {Uint8Array} arg - Argument of the canister call. + * @param {Icrc21ConsentMessageSpec} userPreferences - User preferences with regards to the consent message presented to the end-user. + */ export type Icrc21ConsentMessageRequest = Omit< icrc21_consent_message_request, "user_preferences"