During the discussions of ICRC-4 Batch transfers, the group thought that moving both the timestamp created_at_time
and the memo
into the individual transactions of a batch instead of keeping them only at the top level. The arguments are the following:
- Simplifies implementation
- Generalizes better as it uses exactly the same logic for tx deduplication and other processing
- Conceptually cleaner
The downside is:
- Consumes slightly more storage; however, this has found to be a minor issue
If we do this, it would make perfect sense to also do this change for the ICRC-7 standard. This would imply that the APIs of update batch calls would need to change from
TransferArgs = record {
subaccount: opt blob; // the subaccount of the caller (used to identify the spender)
to : Account;
token_ids : vec nat;
// type: leave open for now
memo : opt blob;
created_at_time : opt nat64;
};
type TransferBatchError = variant {
InvalidRecipient;
TooOld;
CreatedInFuture : record { ledger_time: nat64 };
GenericError : record { error_code : nat; message : text };
};
type TransferError = variant {
NonExistingTokenId;
Unauthorized;
Duplicate : record { duplicate_of : nat };
GenericError : record { error_code : nat; message : text };
};
icrc7_transfer : (TransferArgs)
-> (variant { Ok : vec record { token_id : nat; transfer_result : variant { Ok : nat; Err : TransferError } };
Err : TransferBatchError });
to a representation with each transfer arg represented as its own record and also the errors are adjusted accordingly:
TransferArg = record {
token_id: nat;
memo : opt blob;
created_at_time : opt nat64;
}
TransferArgs = record {
subaccount: opt blob; // the subaccount of the caller (used to identify the spender)
to : Account;
transferArgs: vec TransferArg;
// type: leave open for now
};
type TransferBatchError = variant {
InvalidRecipient;
GenericError : record { error_code : nat; message : text };
};
type TransferError = variant {
TooOld;
CreatedInFuture : record { ledger_time: nat64 };
NonExistingTokenId;
Unauthorized;
Duplicate : record { duplicate_of : nat };
GenericError : record { error_code : nat; message : text };
};
icrc7_transfer : (TransferArgs)
-> (variant { Ok : vec record { token_id : nat; transfer_result : variant { Ok : nat; Err : TransferError } };
Err : TransferBatchError });