### Retrieving Collection Approvals - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid method, `icrc37_get_collection_approvals`, allows querying for collection-level approvals associated with a specific `owner`. It supports pagination using `prev` (a `CollectionApproval` to start from) and `take` (the maximum number of results), returning a vector of `CollectionApproval` elements. ```candid icrc37_get_collection_approvals : (owner : Account, prev : opt CollectionApproval, take : opt nat) -> (vec CollectionApproval) query; ``` -------------------------------- ### Retrieving All Tokens with Pagination (ICRC-7, Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns a paginated list of all token IDs in the ledger, sorted by token ID. Pagination is controlled by `prev` (start ID, `null` for smallest) and `take` (max number of tokens). The method allows iterating through all tokens, but the ledger state might change between calls. This method is a query operation. ```Candid icrc7_tokens : (prev : opt nat, take : opt nat) -> (vec nat) query; ``` -------------------------------- ### Conceptual Batch Input Array Example Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This snippet provides a conceptual representation of an input vector for a batch update method. Each letter (A-H) symbolizes an individual operation or request item that would be processed as part of the batch. ```Conceptual Input : [A, B, C, D, E, F, G, H]; ``` -------------------------------- ### Querying Collection Name (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the full name of the NFT collection, for example, 'My Super NFT'. This is a descriptive name for the collection, providing more context than the symbol. ```Candid icrc7_name : () -> (text) query; ``` -------------------------------- ### ICRC-103: Get Allowances API Definition Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-103/ICRC-103.md Defines the `icrc103_get_allowances` method and its associated data types (`GetAllowancesArgs`, `GetAllowancesError`, `Allowances`, `Account`) for querying outstanding allowances on an ICRC-103 compliant ledger. This method allows for paginated retrieval of allowances based on `from_account` and `prev_spender` parameters, respecting ledger-specific limits and access controls. ```Candid icrc103_get_allowances : (GetAllowancesArgs) -> (variant{Ok: Allowances, Err: GetAllowancesError}) query type GetAllowancesArgs = record { from_account : opt Account; prev_spender : opt Account; take : opt nat; } type GetAllowancesError = variant{ AccessDenied: record { reason: text }; GenericError : record { error_code : nat; message : text }; } type Allowances = vec record { from_account : Account; to_spender : Account; allowance : nat; expires_at : opt nat64; } type Account = record { owner : principal; subaccount : opt blob; }; ``` -------------------------------- ### Defining icrc10_supported_standards Method - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-10/ICRC-10.md This Candid snippet defines the `icrc10_supported_standards` query method. It takes no arguments (`()`) and returns a `SupportedStandardsResponse`, which is a list of `SupportedStandard` records. This method allows clients to discover which APIs or protocols a canister complies with, enhancing interoperability without prior detailed knowledge of the service's capabilities. ```Candid icrc10_supported_standards : () -> (SupportedStandardsResponse) query; ``` -------------------------------- ### Batch Update Response: Initial Error with Subsequent Success and Padding Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This snippet illustrates a batch update response where the first operation (A) fails, but subsequent operations (B and H) succeed. Unprocessed elements between B and H are filled with null to maintain the positional response structure up to the rightmost processed element. ```Candid [opt #Err(#GenericBatchError(...), opt #Ok(5), null, null, null, null, null, opt #Ok(6)]; ``` -------------------------------- ### Retrieving Account's Tokens with Pagination (ICRC-7, Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns a paginated vector of `token_id`s for all tokens held by a specific `account`, sorted by `token_id`. The pagination mechanism is identical to `icrc7_tokens`, using `prev` and `take` parameters. This method is a query operation. ```Candid icrc7_tokens_of : (account : Account, prev : opt nat, take : opt nat) -> (vec nat) query; ``` -------------------------------- ### Querying Collection Description (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Fetches an optional text description of the NFT collection. This can provide more detailed information about the collection's purpose, theme, or background. ```Candid icrc7_description : () -> (opt text) query; ``` -------------------------------- ### Batch Update Response: Mixed Success and Error with Unprocessed Element Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This snippet demonstrates a batch update response where operations A and D succeed, operation B encounters a generic batch error, and operation C is not initiated, resulting in a null response. It highlights the handling of partial processing and errors. ```Candid [opt #Ok(5), opt #Err(#GenericBatchError(...), null , opt #Ok(6)]; ``` -------------------------------- ### Querying Token Metadata (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns metadata for a list of specified `token_ids`. Each entry in the response is an optional vector of `(text, Value)` pairs. If a token doesn't exist, `null` is returned; if it exists but has no metadata, an empty vector is returned. Metadata uses the generic `Value` type. ```Candid icrc7_token_metadata : (token_ids : vec nat) -> (vec opt vec record { text; Value }) query; ``` -------------------------------- ### Candid Method for Retrieving Token-Level Approvals Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `icrc37_get_token_approvals` query method, which retrieves token-level approvals for a given `token_id`, supporting pagination via `prev` (a `TokenApproval` element) and `take` parameters. It returns a vector of `TokenApproval` elements. ```Candid icrc37_get_token_approvals : (token_id : nat, prev : opt TokenApproval, take : opt nat) -> (vec TokenApproval) query; ``` -------------------------------- ### ICRC-10 Supported Standards Method Output (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Specifies the required output format for the `icrc10_supported_standards` method, which ICRC-7 implementations must provide. The method returns a list of records, each detailing a supported standard by its name and URL, ensuring compliance and discoverability. ```Candid record { name = "ICRC-7"; url = "https://github.com/dfinity/ICRC/ICRCs/ICRC-7"; } record { name = "ICRC-10"; url = "https://github.com/dfinity/ICRC/ICRCs/ICRC-10"; } ``` -------------------------------- ### Querying Default Take Value (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the default value used for the `take` parameter in paginated queries when it is not explicitly provided (i.e., `null`). This ensures a fallback for pagination limits. ```Candid icrc7_default_take_value : () -> (opt nat) query; ``` -------------------------------- ### Defining Supported Standards Data Types - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-10/ICRC-10.md This Candid snippet defines the data structures for representing supported standards. `SupportedStandard` is a record containing a `name` (text) and a `url` (text) for a specific standard. `SupportedStandardsResponse` is a vector of `SupportedStandard` records, representing a list of all standards supported by a canister. These types are used as the return value for the `icrc10_supported_standards` method. ```Candid type SupportedStandard = record { name : text; url : text; }; type SupportedStandardsResponse = vec SupportedStandard; ``` -------------------------------- ### Querying Transaction Deduplication Window (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the time window in seconds during which transactions can be deduplicated. This corresponds to the `TX_WINDOW` parameter, preventing replay attacks by ensuring transactions are processed only once within this period. ```Candid icrc7_tx_window : () -> (opt nat) query; ``` -------------------------------- ### Querying Max Approvals Per Token/Collection (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid query method, `icrc37_max_approvals_per_token_or_collection`, allows clients to retrieve the maximum number of active approvals that the ledger implementation supports per token or per principal for the entire collection. It takes no arguments and returns an optional natural number (`opt nat`), indicating the limit or `null` if no specific limit is enforced. ```Candid icrc37_max_approvals_per_token_or_collection : () -> (opt nat) query; ``` -------------------------------- ### Querying NFT Supply Cap (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Retrieves the maximum possible number of NFTs that can ever exist in this collection. Any attempt to mint beyond this cap will be rejected, enforcing a hard limit on supply. ```Candid icrc7_supply_cap : () -> (opt nat) query; ``` -------------------------------- ### ICRC-7 Service Definition Structure in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This Candid snippet illustrates the foundational structure for defining a service within the ICRC-7 standard. It outlines the basic layout for including custom type definitions and service methods, serving as a template for the ledger's interface. ```Candid <<>> service : { <<>> } ``` -------------------------------- ### Batch Update Response: Partial Success with Error and Unprocessed Elements Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This snippet illustrates a batch update response where some operations succeed, one fails with a generic batch error, and others are left unprocessed (represented by null). It shows how null indicates an uninitiated request in update calls. ```Candid [opt #Ok(5), null ,null, opt #Err(#GenericBatchError(...)]; ``` -------------------------------- ### Querying Permitted Transaction Drift (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the time duration in seconds by which the transaction deduplication window can be extended. This corresponds to the `PERMITTED_DRIFT` parameter, allowing for slight clock synchronization differences between client and ledger. ```Candid icrc7_permitted_drift : () -> (opt nat) query; ``` -------------------------------- ### Querying Total NFT Supply (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the total number of NFTs currently existing across all accounts in the collection. This indicates the current circulating supply of tokens. ```Candid icrc7_total_supply : () -> (nat) query; ``` -------------------------------- ### Declaring ICRC-37 TransferFrom Method in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid snippet declares the `icrc37_transfer_from` method, which accepts a vector of `TransferFromArg` records for batch transfer requests. It returns a vector of optional `TransferFromResult` records, where each element corresponds positionally to the input request, indicating success or a specific error for each individual transfer. ```Candid icrc37_transfer_from : (vec TransferFromArg) -> (vec opt TransferFromResult); ``` -------------------------------- ### Querying Collection Metadata (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns a vector of records containing text and Value pairs, representing the metadata for the NFT collection. This method allows querying general information about the collection itself, such as its properties or attributes. ```Candid icrc7_collection_metadata : () -> (vec record { text; Value } ) query; ``` -------------------------------- ### Querying Token Owner (ICRC-7, Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the owner `Account` for a list of `token_ids`. The response order matches the request. Tokens without an ICRC-1 account or non-existing IDs will have a `null` response, which can occur if a ledger used a different standard or tokens are not fully migrated. This method is a query operation. ```Candid icrc7_owner_of : (token_ids : vec nat) -> (vec opt Account) query; ``` -------------------------------- ### Querying Collection Logo (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Retrieves an optional link to the collection's logo. This link can be a standard URL or a DataURL containing the image data directly, allowing for visual representation of the collection. ```Candid icrc7_logo : () -> (opt text) query; ``` -------------------------------- ### Querying Account Balance (ICRC-7, Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the number of tokens held by a given `account`. If the account does not exist, `0` is returned. This method is a query operation. ```Candid icrc7_balance_of : (vec Account) -> (vec nat) query; ``` -------------------------------- ### Defining Account and Subaccount Types (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid snippet defines the fundamental data structures for identifying accounts in the ICRC-37 standard. `Subaccount` is a 32-byte blob used to distinguish multiple accounts for a single principal, while `Account` combines a `principal` owner with an optional `Subaccount` to form a unique identifier for a user's specific account. ```Candid type Subaccount = blob; type Account = record { owner : principal; subaccount : opt Subaccount }; ``` -------------------------------- ### Querying Max Take Value (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Retrieves the maximum `take` value supported for paginated query calls by the ledger implementation. This applies to all paginated calls exposed by the ledger, setting an upper bound on items per page. ```Candid icrc7_max_take_value : () -> (opt nat) query; ``` -------------------------------- ### Querying Max Query Batch Size (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the maximum number of items allowed in a single batch query call supported by the ledger implementation. This helps clients optimize their queries by sending multiple requests in one go. ```Candid icrc7_max_query_batch_size : () -> (opt nat) query; ``` -------------------------------- ### Querying Max Memo Size (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the maximum size, in bytes, of `memo` fields supported by an implementation. This limits the amount of arbitrary data that can be attached to transactions. ```Candid icrc7_max_memo_size : () -> (opt nat) query; ``` -------------------------------- ### Querying Atomic Batch Transfer Status (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Indicates whether batch transfers of the ledger are executed atomically. If `true`, all transfers in a batch succeed or none do; otherwise, transfers may partially succeed. ```Candid icrc7_atomic_batch_transfers : () -> (opt bool) query; ``` -------------------------------- ### Defining Account and Subaccount Types in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md This Candid snippet defines the `Subaccount` and `Account` types used in the ICRC-7 standard. `Subaccount` is a blob representing a 32-byte identifier for a specific account under a principal, while `Account` combines an `owner` principal with an optional `subaccount` to uniquely identify an NFT account. This structure allows a single principal to manage multiple distinct accounts. ```candid type Subaccount = blob; type Account = record { owner : principal; subaccount : opt Subaccount }; ``` -------------------------------- ### Candid Type Definitions for Retrieving Token Approvals Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `TokenApproval` record, which encapsulates a `token_id` and its associated `ApprovalInfo`, used when retrieving a list of token-level approvals. ```Candid type TokenApproval = record { token_id : nat; approval_info : ApprovalInfo; }; ``` -------------------------------- ### Candid Method Signature for ICRC-37 Token Approval Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet defines the Candid method signature for `icrc37_approve_tokens`. It takes a vector of `ApproveTokenArg` (for batch processing) and returns a vector of optional `ApproveTokenResult`, where each element corresponds to a request in the input vector. ```Candid icrc37_approve_tokens : (vec ApproveTokenArg) -> (vec opt ApproveTokenResult); ``` -------------------------------- ### ICRC-7 Batch Transfer Method Signature (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Defines the Candid signature for the `icrc7_transfer` method. This method accepts a vector of `TransferArg` records to perform multiple token transfers in a batch and returns a vector of optional `TransferResult` records, corresponding positionally to the input requests. ```Candid icrc7_transfer : (vec TransferArg) -> (vec opt TransferResult); ``` -------------------------------- ### Defining ICRC-106 Standard Entry in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-106/ICRC-106.md This Candid record defines the standard entry for ICRC-106, indicating its name and URL. Ledgers implementing ICRC-106 must include this entry in the output of their `icrc1_supported_standards` and `icrc10_supported_standards` methods to signal support for the standard. ```Candid record { name = "ICRC-106"; url = "https://github.com/dfinity/ICRC/blob/main/ICRCs/ICRC-106" } ``` -------------------------------- ### Candid Service Definition for ICRC-37 Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet illustrates the basic structure of a Candid service definition for ICRC-37, including placeholders for type definitions and methods. It serves as a template for defining the interface of an ICRC-37 compliant ledger, indicating where specific types and methods would be declared. ```Candid <<>> service : { <<>> } ``` -------------------------------- ### Candid Method for Checking Token Approval Status Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `icrc37_is_approved` query method, which takes a vector of `IsApprovedArg` and returns a vector of booleans, indicating whether each corresponding token is approved for the specified spender and subaccount. ```Candid icrc37_is_approved : (vec IsApprovedArg) -> (vec bool) query; ``` -------------------------------- ### Defining ICRC-37 TransferFrom Types in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet defines the Candid types `TransferFromArg`, `TransferFromResult`, and `TransferFromError` used by the `icrc37_transfer_from` method. `TransferFromArg` specifies the input parameters for a transfer, including sender, recipient, token ID, and optional memo/timestamp. `TransferFromResult` indicates success with a transaction index or an error. `TransferFromError` enumerates possible issues like invalid recipient, unauthorized access, or time-related errors. ```Candid type TransferFromArg = record { spender_subaccount: opt blob; // The subaccount of the caller (used to identify the spender) from : Account; to : Account; token_id : nat; // type: leave open for now memo : opt blob; created_at_time : opt nat64; }; type TransferFromResult = variant { Ok : nat; // Transaction index for successful transfer Err : TransferFromError; }; type TransferFromError = variant { InvalidRecipient; Unauthorized; NonExistingTokenId; 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 }; }; ``` -------------------------------- ### ICRC-7 Transfer Argument and Result Types (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Defines the Candid types `TransferArg`, `TransferResult`, and `TransferError` used for the `icrc7_transfer` method. `TransferArg` specifies the details for a single token transfer, `TransferResult` indicates success with a transaction index or an error, and `TransferError` enumerates possible reasons for transfer failure. ```Candid type TransferArg = record { from_subaccount: opt blob; // The subaccount to transfer the token from to : Account; token_id : nat; memo : opt blob; created_at_time : opt nat64; }; type TransferResult = variant { Ok : nat; // Transaction index for successful transfer 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 }; }; ``` -------------------------------- ### Defining CollectionApproval Type - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid type definition aliases `CollectionApproval` to `ApprovalInfo`. It serves as the structure for representing collection-level approval information within the ICRC-37 standard, used for both input and output of approval-related methods. ```candid type CollectionApproval = ApprovalInfo; ``` -------------------------------- ### Candid Type Definitions for Checking Approval Status Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `IsApprovedArg` record, used to specify the `spender`, `from_subaccount`, and `token_id` when querying if a token is approved. ```Candid type IsApprovedArg = record { spender : Account; from_subaccount : opt blob; token_id : nat; }; ``` -------------------------------- ### Candid Interface for Ledger Index Canister Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-106/ICRC-106.md This Candid definition outlines the complete interface for the index canister, including all custom data types like `Tokens`, `Account`, `Transaction`, and `TransactionWithId`, as well as the service methods `get_account_transactions`, `ledger_id`, `list_subaccounts`, and `status`. It defines the structure for various transaction types (Burn, Mint, Transfer, Approve) and their associated arguments and results. ```Candid type Tokens = nat; type BlockIndex = nat; type SubAccount = blob; type Account = record { owner: principal; subaccount: opt SubAccount; }; type GetAccountTransactionsArgs = record { account: Account; start: opt BlockIndex; // The block index of the last transaction seen by the client. max_results: nat; // Maximum number of transactions to fetch. }; type Burn = record { from : Account; memo : opt blob; created_at_time : opt nat64; amount : Tokens; spender : opt Account; }; type Mint = record { to : Account; memo : opt blob; created_at_time : opt nat64; amount : Tokens; }; type Transfer = record { to : Account; fee : opt Tokens; from : Account; memo : opt blob; created_at_time : opt nat64; amount : Tokens; spender : opt Account; }; type Approve = record { fee : opt Tokens; from : Account; memo : opt blob; created_at_time : opt nat64; amount : Tokens; expected_allowance : opt nat; expires_at : opt nat64; spender : Account; }; type Transaction = record { burn : opt Burn; kind : text; mint : opt Mint; approve : opt Approve; timestamp : nat64; transfer : opt Transfer; }; type TransactionWithId = record { id : BlockIndex; transaction : Transaction; }; type GetTransactions = record { balance : Tokens; transactions : vec TransactionWithId; // The txid of the oldest transaction the account has oldest_tx_id : opt BlockIndex; }; type GetTransactionsErr = record { message : text; }; type GetAccountTransactionsResult = variant { Ok : GetTransactions; Err : GetTransactionsErr; }; type ListSubaccountsArgs = record { owner: principal; start: opt SubAccount; }; type Status = record { num_blocks_synced : BlockIndex; }; service : { get_account_transactions: (GetAccountTransactionsArgs) -> (GetAccountTransactionsResult) query; ledger_id: () -> (principal) query; list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query; status : () -> (Status) query; } ``` -------------------------------- ### ICRC-37 Revoke Token Approvals Method Signature - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet presents the Candid method signature for `icrc37_revoke_token_approvals`. It shows that the method accepts a vector of `RevokeTokenApprovalArg` to support batch operations and returns a vector of optional `RevokeTokenApprovalResponse` elements, corresponding positionally to the input requests. ```candid icrc37_revoke_token_approvals: (vec RevokeTokenApprovalArg) -> (vec opt RevokeTokenApprovalResponse); ``` -------------------------------- ### Querying Token Symbol (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Retrieves the token symbol of the NFT collection, such as 'MS'. This provides a short, human-readable identifier for the collection, often used for display purposes. ```Candid icrc7_symbol : () -> (text) query; ``` -------------------------------- ### Querying Max Update Batch Size (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Returns the maximum number of token IDs that can be used as input in a batch update method. This defines the limit for atomic operations on multiple tokens. ```Candid icrc7_max_update_batch_size : () -> (opt nat) query; ``` -------------------------------- ### Candid Method Signature for ICRC-37 Collection Approval Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Provides the Candid signature for the `icrc37_approve_collection` method. It accepts a vector of `ApproveCollectionArg` to support batch approvals and returns a vector of optional `ApproveCollectionError` variants, indicating the outcome for each request element. ```Candid icrc37_approve_collection : (vec ApproveCollectionArg) -> (vec opt ApproveCollectionError); ``` -------------------------------- ### Type definitions for ICRC-37 Token Approval Revocation - Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet defines the Candid types necessary for the `icrc37_revoke_token_approvals` method. It includes `RevokeTokenApprovalArg` for request parameters, `RevokeTokenApprovalResponse` for the operation's outcome, and `RevokeTokenApprovalError` enumerating possible error conditions like non-existent approvals or unauthorized actions. ```candid type RevokeTokenApprovalArg = record { spender : opt Account; // null revokes matching approvals for all spenders from_subaccount : opt blob; // null refers to the default subaccount token_id : nat; memo : opt blob; created_at_time : opt nat64; }; type RevokeTokenApprovalResponse = variant { Ok : nat; // Transaction index for successful approval revocation Err : RevokeTokenApprovalError; }; type RevokeTokenApprovalError = variant { ApprovalDoesNotExist; Unauthorized; NonExistingTokenId; TooOld; CreatedInFuture : record { ledger_time: nat64 }; GenericError : record { error_code : nat; message : text }; GenericBatchError : record { error_code : nat; message : text }; }; ``` -------------------------------- ### Candid Method for Revoking Collection Approvals Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `icrc37_revoke_collection_approvals` method, which takes a vector of `RevokeCollectionApprovalArg` and returns a vector of optional `RevokeCollectionApprovalResult`, allowing batch revocation of collection-level approvals. ```Candid icrc37_revoke_collection_approvals: (vec RevokeCollectionApprovalArg) -> (vec opt RevokeCollectionApprovalResult); ``` -------------------------------- ### Querying Max Revocable Approvals (Candid) Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This Candid query method, `icrc37_max_revoke_approvals`, provides information on the maximum number of approvals that can be revoked in a single call to either `icrc37_revoke_token_approvals` or `icrc37_revoke_collection_approvals`. It accepts no parameters and returns an optional natural number (`opt nat`), representing the maximum count or `null` if no limit applies. ```Candid icrc37_max_revoke_approvals : () -> (opt nat) query; ``` -------------------------------- ### Candid Type Definitions for Revoking Collection Approvals Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the `RevokeCollectionApprovalArg` record for specifying revocation parameters (spender, subaccount, memo, created_at_time), `RevokeCollectionApprovalResult` for the outcome (transaction index or error), and `RevokeCollectionApprovalError` enumerating possible errors like `ApprovalDoesNotExist`, `TooOld`, `CreatedInFuture`, and generic errors. ```Candid type RevokeCollectionApprovalArg = record { spender : opt Account; // null revokes approvals for all spenders that match the remaining parameters from_subaccount : opt blob; // null refers to the default subaccount memo : opt blob; created_at_time : opt nat64; }; type RevokeCollectionApprovalResult = variant { Ok : nat; // Transaction index for successful approval revocation Err : RevokeCollectionApprovalError; }; type RevokeCollectionApprovalError = variant { ApprovalDoesNotExist; TooOld; CreatedInFuture : record { ledger_time: nat64 }; GenericError : record { error_code : nat; message : text }; GenericBatchError : record { error_code : nat; message : text }; }; ``` -------------------------------- ### Defining `icrc106_get_index_principal` Method in Candid Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-106/ICRC-106.md This Candid definition specifies the `icrc106_get_index_principal` query method, which allows clients to programmatically retrieve the principal of the associated index canister. It returns a `GetIndexPrincipalResult` variant, indicating either success with the principal or an error, such as `IndexPrincipalNotSet` or a `GenericError`. ```Candid icrc106_get_index_principal: () -> GetIndexPrincipalsResult query; type GetIndexPrincipalResult = variant { Ok : principal; Err : GetIndexPrincipalError; }; type GetIndexPrincipalError = variant { IndexPrincipalNotSet; // Any error not covered by the above variants. GenericError: record { error_code: nat; description: text; }; }; ``` -------------------------------- ### Candid Type Definitions for ICRC-37 Token Approval Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md This snippet defines the Candid types used for the `icrc37_approve_tokens` method. It includes `ApprovalInfo` for specifying spender, subaccount, expiration, memo, and creation time; `ApproveTokenArg` for combining token ID with approval info; `ApproveTokenResult` for success or error outcomes; and `ApproveTokenError` enumerating various error conditions like `InvalidSpender`, `Unauthorized`, `NonExistingTokenId`, `TooOld`, `CreatedInFuture`, and generic errors. ```Candid type ApprovalInfo = record { spender : Account; // Approval is given to an ICRC Account from_subaccount : opt blob; // The subaccount the token can be transferred out from with the approval expires_at : opt nat64; memo : opt blob; created_at_time : nat64; }; type ApproveTokenArg = record { token_id : nat; approval_info : ApprovalInfo; }; type ApproveTokenResult = variant { Ok : nat; // Transaction index for successful approval Err : ApproveTokenError; }; type ApproveTokenError = variant { InvalidSpender; Unauthorized; NonExistingTokenId; TooOld; CreatedInFuture : record { ledger_time: nat64 }; GenericError : record { error_code : nat; message : text }; GenericBatchError : record { error_code : nat; message : text }; }; ``` -------------------------------- ### Candid Type Definitions for ICRC-37 Collection Approval Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-37/ICRC-37.md Defines the Candid types used for the `icrc37_approve_collection` method. `ApproveCollectionArg` specifies the input for an approval request. `ApproveCollectionResult` indicates success with a transaction index or an error. `ApproveCollectionError` enumerates possible errors like `InvalidSpender`, `TooOld`, `CreatedInFuture`, and generic errors. ```Candid type ApproveCollectionArg = record { approval_info : ApprovalInfo; }; type ApproveCollectionResult = variant { Ok : nat; // Transaction index for successful approval Err : ApproveCollectionError; }; type ApproveCollectionError = variant { InvalidSpender; TooOld; CreatedInFuture : record { ledger_time: nat64 }; GenericError : record { error_code : nat; message : text }; GenericBatchError : record { error_code : nat; message : text }; }; ``` -------------------------------- ### Candid Generic Value Type Definition Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Defines a generic `Value` type used for representing various data types within ICRC-3 and ICRC-7 metadata. It supports blobs, text, natural numbers, integers, arrays of values, and maps of text-value pairs, providing flexibility for structured metadata. ```Candid type Value = variant { Blob : blob; Text : text; Nat : nat; Int : int; Array : vec Value; Map : vec record { text; Value }; }; ``` -------------------------------- ### Candid Type Definition for Generic Value Source: https://github.com/dfinity/icrc/blob/main/ICRCs/ICRC-7/ICRC-7.md Defines the generic `Value` type used in ICRC-3 and ICRC-7 for encoding arbitrarily complex data within metadata attributes. This type allows for flexible representation of various data types, including text, natural numbers, and potentially more complex structures, as part of the metadata standard. ```Candid // Generic value in accordance with ICRC-3 type Value = variant { ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.