-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'nhaimerl-add-icrc21-endpoints' into 'master'
feat(ICP-Ledger): FI-1176: add icrc21 endpoints This MR proposes the following changes: 1. Add requests and response types for the [ICRC21](https://github.com/dfinity/wg-identity-authentication/blob/main/topics/ICRC-21/icrc_21_consent_msg.md) standard 2. Add the two endpoints of the ICRC21 standard to the ICP-Ledger canister 3. Add the two endpoints of the ICRC21 standard to the ICP-ledger candid file The endpoints do not yet serve any functionality. The endpoint `icrc21_canister_call_consent_message` returns an error upon being called and the endpoint `icrc10_supported_standards` is a wrapper call to `icrc1_supported_standards`. The standard will be added to the list of supported standards once it is fully implemented. See merge request dfinity-lab/public/ic!19256
- Loading branch information
Showing
7 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
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,18 @@ | ||
use candid::{CandidType, Deserialize, Nat}; | ||
use serde::Serialize; | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct ErrorInfo { | ||
pub description: String, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub enum Icrc21Error { | ||
UnsupportedCanisterCall(ErrorInfo), | ||
ConsentMessageUnavailable(ErrorInfo), | ||
InsufficientPayment(ErrorInfo), | ||
GenericError { | ||
error_code: Nat, | ||
description: String, | ||
}, | ||
} |
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,3 @@ | ||
pub mod errors; | ||
pub mod requests; | ||
pub mod responses; |
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,29 @@ | ||
use candid::{CandidType, Deserialize}; | ||
use serde::Serialize; | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct ConsentMessageMetadata { | ||
pub language: String, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub enum DisplayMessageType { | ||
GenericDisplay, | ||
LineDisplay { | ||
characters_per_line: u16, | ||
lines_per_page: u16, | ||
}, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct ConsentMessageSpec { | ||
pub metadata: ConsentMessageMetadata, | ||
pub device_spec: Option<DisplayMessageType>, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct ConsentMessageRequest { | ||
pub method: String, | ||
pub arg: Vec<u8>, | ||
pub user_preferences: ConsentMessageSpec, | ||
} |
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,20 @@ | ||
use super::requests::ConsentMessageMetadata; | ||
use candid::{CandidType, Deserialize}; | ||
use serde::Serialize; | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct Page { | ||
pub lines: Vec<String>, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub enum ConsentMessage { | ||
GenericDisplayMessage(String), | ||
LineDisplayMessage { pages: Vec<Page> }, | ||
} | ||
|
||
#[derive(Debug, CandidType, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
pub struct ConsentInfo { | ||
pub consent_message: ConsentMessage, | ||
pub metadata: ConsentMessageMetadata, | ||
} |
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,4 +1,5 @@ | ||
pub mod icrc; | ||
pub mod icrc1; | ||
pub mod icrc2; | ||
pub mod icrc21; | ||
pub mod icrc3; |
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