-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signer Extend icrc49 call canister to support [sc-12847] (#199)
- Loading branch information
1 parent
c979abd
commit 3aaf368
Showing
21 changed files
with
613 additions
and
147 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
members = ["examples/target/src/target"] | ||
members = ["examples/signer-backend"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { ActorMethod } from "@dfinity/agent" | ||
import type { IDL } from "@dfinity/candid" | ||
|
||
export interface Icrc21ConsentInfo { | ||
metadata: Icrc21ConsentMessageMetadata | ||
consent_message: Icrc21ConsentMessage | ||
} | ||
export type Icrc21ConsentMessage = | ||
| { | ||
LineDisplayMessage: { pages: Array<Icrc21LineDisplayPage> } | ||
} | ||
| { GenericDisplayMessage: string } | ||
export interface Icrc21ConsentMessageMetadata { | ||
language: string | ||
} | ||
export interface Icrc21ConsentMessageRequest { | ||
arg: Uint8Array | number[] | ||
method: string | ||
user_preferences: Icrc21ConsentMessageSpec | ||
} | ||
export interface Icrc21ConsentMessageSpec { | ||
metadata: Icrc21ConsentMessageMetadata | ||
device_spec: [] | [Icrc21DeviceSpec] | ||
} | ||
export type Icrc21DeviceSpec = | ||
| { GenericDisplay: null } | ||
| { | ||
LineDisplay: { | ||
characters_per_line: number | ||
lines_per_page: number | ||
} | ||
} | ||
export type Icrc21Error = | ||
| { | ||
GenericError: { description: string; error_code: bigint } | ||
} | ||
| { InsufficientPayment: Icrc21ErrorInfo } | ||
| { UnsupportedCanisterCall: Icrc21ErrorInfo } | ||
| { ConsentMessageUnavailable: Icrc21ErrorInfo } | ||
export interface Icrc21ErrorInfo { | ||
description: string | ||
} | ||
export interface Icrc21LineDisplayPage { | ||
lines: Array<string> | ||
} | ||
export type Result = { Ok: Icrc21ConsentInfo } | { Err: Icrc21Error } | ||
export interface _SERVICE { | ||
icrc21_canister_call_consent_message: ActorMethod<[Icrc21ConsentMessageRequest], Result> | ||
} | ||
export declare const idlFactory: IDL.InterfaceFactory | ||
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
export const idlFactory = ({ IDL }: any) => { | ||
const Icrc21ConsentMessageMetadata = IDL.Record({ language: IDL.Text }) | ||
const Icrc21DeviceSpec = IDL.Variant({ | ||
GenericDisplay: IDL.Null, | ||
LineDisplay: IDL.Record({ | ||
characters_per_line: IDL.Nat16, | ||
lines_per_page: IDL.Nat16, | ||
}), | ||
}) | ||
const Icrc21ConsentMessageSpec = IDL.Record({ | ||
metadata: Icrc21ConsentMessageMetadata, | ||
device_spec: IDL.Opt(Icrc21DeviceSpec), | ||
}) | ||
const Icrc21ConsentMessageRequest = IDL.Record({ | ||
arg: IDL.Vec(IDL.Nat8), | ||
method: IDL.Text, | ||
user_preferences: Icrc21ConsentMessageSpec, | ||
}) | ||
const Icrc21LineDisplayPage = IDL.Record({ lines: IDL.Vec(IDL.Text) }) | ||
const Icrc21ConsentMessage = IDL.Variant({ | ||
LineDisplayMessage: IDL.Record({ | ||
pages: IDL.Vec(Icrc21LineDisplayPage), | ||
}), | ||
GenericDisplayMessage: IDL.Text, | ||
}) | ||
const Icrc21ConsentInfo = IDL.Record({ | ||
metadata: Icrc21ConsentMessageMetadata, | ||
consent_message: Icrc21ConsentMessage, | ||
}) | ||
const Icrc21ErrorInfo = IDL.Record({ description: IDL.Text }) | ||
const Icrc21Error = IDL.Variant({ | ||
GenericError: IDL.Record({ | ||
description: IDL.Text, | ||
error_code: IDL.Nat, | ||
}), | ||
InsufficientPayment: Icrc21ErrorInfo, | ||
UnsupportedCanisterCall: Icrc21ErrorInfo, | ||
ConsentMessageUnavailable: Icrc21ErrorInfo, | ||
}) | ||
const Result = IDL.Variant({ Ok: Icrc21ConsentInfo, Err: Icrc21Error }) | ||
return IDL.Service({ | ||
icrc21_canister_call_consent_message: IDL.Func([Icrc21ConsentMessageRequest], [Result], []), | ||
}) | ||
} | ||
export const init = () => { | ||
return [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.