// Generic value in accordance with ICRC-3. // Reference: https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-3 type Value = variant { Blob : blob; Text : text; Nat : nat; Int : int; Array : vec Value; Map : vec record { text; Value }; }; // Account in accordance with ICRC-1. type Subaccount = blob; type Account = record { owner : principal; subaccount : opt Subaccount }; type TransferArg = record { from_subaccount: opt blob; to : Account; token_id : nat; memo : opt blob; created_at_time : opt nat64; }; type TransferResult = variant { Ok : nat; Err : TransferError; }; type TransferError = variant { NonExistingTokenId; InvalidRecipient; Unauthorized; TooOld; CreatedInFuture : record { ledger_time: nat64 }; Duplicate : record { duplicate_of : nat }; GenericError : record { error_code : nat; message : text }; GenericBatchError : record { error_code : nat; message : text }; }; service : () -> { // Returns all the collection-level metadata of the NFT collection in a single query. icrc7_collection_metadata : () -> (vec record { text; Value } ) query; // Returns the token symbol of the NFT collection (e.g., MS). icrc7_symbol : () -> (text) query; // Returns the name of the NFT collection (e.g., My Super NFT). icrc7_name : () -> (text) query; // Returns the text description of the collection. icrc7_description : () -> (opt text) query; // Returns a link to the logo of the collection. // It may be a DataURL that contains the logo image itself. icrc7_logo : () -> (opt text) query; // Returns the total number of NFTs on all accounts. icrc7_total_supply : () -> (nat) query; // Returns the maximum number of NFTs possible for this collection. // Any attempt to mint more NFTs than this supply cap shall be rejected. icrc7_supply_cap : () -> (opt nat) query; // Returns the maximum batch size for batch query calls this ledger implementation supports. icrc7_max_query_batch_size : () -> (opt nat) query; // Returns the maximum number of token ids allowed for being used as input in a batch update method. icrc7_max_update_batch_size : () -> (opt nat) query; // Returns the default parameter the ledger uses for `take` in case the parameter is null in paginated queries. icrc7_default_take_value : () -> (opt nat) query; // Returns the maximum `take` value for paginated query calls this ledger implementation supports. // The value applies to all paginated calls the ledger exposes. icrc7_max_take_value : () -> (opt nat) query; // Returns the maximum size of memos as supported by an implementation. icrc7_max_memo_size : () -> (opt nat) query; // Returns true if and only if batch transfers of the ledger are executed atomically, // i.e., either all transfers execute or none, false otherwise. icrc7_atomic_batch_transfers : () -> (opt bool) query; // Returns the time window in seconds during which transactions can be deduplicated. Corresponds to the parameter // `TX_WINDOW` as specified in the section on transaction deduplication. icrc7_tx_window : () -> (opt nat) query; // Returns the time duration in seconds by which the transaction deduplication window can be extended. Corresponds // to the parameter PERMITTED_DRIFT as specified in the section on transaction deduplication. icrc7_permitted_drift : () -> (opt nat) query; // Returns the token metadata for token_ids, a list of token ids. Each tuple in the response vector comprises an // optional metadata element with the metadata expressed as vector of text and Value pairs. In case a token does // not exist, a null element corresponding to it is returned in the response. If a token does not have metadata, // its associated metadata vector is the empty vector. icrc7_token_metadata : (token_ids : vec nat) -> (vec opt vec record { text; Value }) query; // Returns the owner Account of each token in a list token_ids of token ids. The ordering of the response elements // corresponds to that of the request elements. icrc7_owner_of : (token_ids : vec nat) -> (vec opt Account) query; // Returns the balance of the account provided as an argument, i.e., the number of tokens held by the account. // For a non-existing account, the value 0 is returned. icrc7_balance_of : (vec Account) -> (vec nat) query; // Returns the list of tokens in this ledger, sorted by their token id. icrc7_tokens : (prev : opt nat, take : opt nat) -> (vec nat) query; // Returns a vector of token_ids of all tokens held by account, sorted by token_id. The token ids in the response // are sorted in any consistent sorting order used by the ledger. The result is paginated, the mechanics of // pagination are analogous to icrc7_tokens using prev and take to control pagination. icrc7_tokens_of : (account : Account, prev : opt nat, take : opt nat) -> (vec nat) query; // Performs a batch of token transfers. Each of those transfers transfers a token `token_id` from the account // defined by the caller principal and the specified `from_subaccount` to the `to` account. A `null` for the // `from_subaccount` refers to the default subaccount comprising all zeroes. A `memo` and `created_at_time` can be // given optionally. The transfer can only be initiated by the holder of the tokens. icrc7_transfer : (vec TransferArg) -> (vec opt TransferResult); }