Starting a thread here so we can start figuring out some standards to bring about wallet canisters. For starters I think we need a ERC-725 like standard. A common way to make calls and a small key value store is a great foundation to start building wallets / personal canisters / whatever on.
How about the following to kick off discussion .
icrc5_make_call
Execute a blocking call against a canister.
type CanisterCallRequest = record {
canister : principal;
method : text;
cycles : nat64;
args : vec nat8;
};
type RejectionCode = variant {
NoError: null,
SysFatal: null,
SysTransient: null,
DestinationInvalid: null,
CanisterReject: null,
CanisterError: null,
Unknown: null,
};
type CallFailure = variant {
NotAuthorized: record { reason: text },
Error: record { code: RejectionCode, message: text },
};
type CallResult = variant {
Ok: vec nat8;
Err: CallFailure;
};
service : {
icrc5_execute_call: (CanisterCallRequest) -> (CallResult);
}
icrc5_set_data
Set a value in the store
type Value = variant {
Text : text;
Blob : blob;
Bool : bool;
Option : Value;
Vec : vec Value;
Record : vec (text, Value);
Nat : nat;
Nat8 : nat8;
Nat16 : nat16;
Nat32 : nat32;
Nat64 : nat64;
Int : int;
Int8 : int8;
Int16 : int16;
Int32 : int32;
Int64 : int64;
Float32 : float32;
Float64 : float64;
Principal : principal;
};
type SetError = variant {
NotAuthorized : null;
};
type SetResult = {
Ok : null;
Err : set_error;
};
service : {
icrc5_set_data: (text, Value) -> (SetResult);
}
icrc5_get_data
Fetch a value from the store
type Value = variant {
Text : text;
Blob : blob;
Bool : bool;
Option : Value;
Vec : vec Value;
Record : vec (text, Value);
Nat : nat;
Nat8 : nat8;
Nat16 : nat16;
Nat32 : nat32;
Nat64 : nat64;
Int : int;
Int8 : int8;
Int16 : int16;
Int32 : int32;
Int64 : int64;
Float32 : float32;
Float64 : float64;
Principal : principal;
};
type FetchError = variant {
NotAuthorized : null;
KeyNotFound : null;
};
type FetchResult = variant {
Ok: Value;
Err : FetchError;
};
service : {
icrc5_get_data : (text) -> (FetchResult);
}
icrc5_authorize_user
& icrc5_authorized_users
Authorize a user and fetch authorized users.
Identity is presented as a variant type to allow for additional types of identities to be added.
type Identity = variant {
Principal : record {
p : principal;
}
};
type AuthRequest = variant {
Add : record {
identity : Identity;
};
Remove : record {
identity : Identity;
};
};
type AuthorizeError = variant {
NotAuthorized;
};
type AuthorizeResponse = variant {
Ok : null;
Err : AuthorizeError;
};
type AuthorizedUser = record {
identity : Identity;
created_at : u64;
};
type AuthorizedError = variant {
NotAuthorized;
};
type AuthorizedUsersResponse = variant {
Ok : vec AuthorizedUser;
Err : AuthorizedError;
};
service : {
icrc5_authorize_user : (AuthRequest) -> (AuthorizeResponse);
icrc5_authorized_users : () -> (AuthorizedUsersResponse)
}