type Value = {#Nat : Nat; #Int : Int; #Blob : Blob; #Text : Text}
type BlockIndex = Nat
type Subaccount = Blob
type Balance = Nat
type StableBuffer<T> = StableBuffer.StableBuffer<T>
type StableTrieMap<K, V> = STMap.StableTrieMap<K, V>
type Account = { owner : Principal; subaccount : ?Subaccount }
type EncodedAccount = Blob
type SupportedStandard = { name : Text; url : Text }
type Memo = Blob
type Timestamp = Nat64
type Duration = Nat64
type TxIndex = Nat
type TxLog = StableBuffer<Transaction>
type MetaDatum = (Text, Value)
type MetaData = [MetaDatum]
type TxKind = {#mint; #burn; #transfer}
type Mint = { to : Account; amount : Balance; memo : ?Blob; created_at_time : ?Nat64 }
type BurnArgs = { from_subaccount : ?Subaccount; amount : Balance; memo : ?Blob; created_at_time : ?Nat64 }
type Burn = { from : Account; amount : Balance; memo : ?Blob; created_at_time : ?Nat64 }
type TransferArgs = { from_subaccount : ?Subaccount; to : Account; amount : Balance; fee : ?Balance; memo : ?Blob; created_at_time : ?Nat64 }
Arguments for a transfer operation
type Transfer = { from : Account; to : Account; amount : Balance; fee : ?Balance; memo : ?Blob; created_at_time : ?Nat64 }
type TransactionRequest = { kind : TxKind; from : Account; to : Account; amount : Balance; fee : ?Balance; memo : ?Blob; created_at_time : ?Nat64; encoded : { from : EncodedAccount; to : EncodedAccount } }
Internal representation of a transaction request
type Transaction = { kind : Text; mint : ?Mint; burn : ?Burn; transfer : ?Transfer; index : TxIndex; timestamp : Timestamp }
type TimeError = {#TooOld; #CreatedInFuture : { ledger_time : Timestamp }}
type TransferError = TimeError or {#BadFee : { expected_fee : Balance }; #BadBurn : { min_burn_amount : Balance }; #InsufficientFunds : { balance : Balance }; #Duplicate : { duplicate_of : TxIndex }; #TemporarilyUnavailable; #GenericError : { error_code : Nat; message : Text }}
type TransferResult = {#Ok : TxIndex; #Err : TransferError}
type TokenInterface = actor { icrc1_name : shared query () -> async Text; icrc1_symbol : shared query () -> async Text; icrc1_decimals : shared query () -> async Nat8; icrc1_fee : shared query () -> async Balance; icrc1_metadata : shared query () -> async MetaData; icrc1_total_supply : shared query () -> async Balance; icrc1_minting_account : shared query () -> async ?Account; icrc1_balance_of : shared query (Account) -> async Balance; icrc1_transfer : shared (TransferArgs) -> async TransferResult; icrc1_supported_standards : shared query () -> async [SupportedStandard] }
Interface for the ICRC token canister
type TxCandidBlob = Blob
type ArchiveInterface = actor { append_transactions : shared ([Transaction]) -> async Result.Result<(), Text>; total_transactions : shared query () -> async Nat; get_transaction : shared query (TxIndex) -> async ?Transaction; get_transactions : shared query (GetTransactionsRequest) -> async TransactionRange; remaining_capacity : shared query () -> async Nat }
The Interface for the Archive canister
type InitArgs = { name : Text; symbol : Text; decimals : Nat8; fee : Balance; minting_account : Account; max_supply : Balance; initial_balances : [(Account, Balance)]; min_burn_amount : Balance; advanced_settings : ?AdvancedSettings }
Initial arguments for the setting up the icrc1 token canister
type TokenInitArgs = { name : Text; symbol : Text; decimals : Nat8; fee : Balance; max_supply : Balance; initial_balances : [(Account, Balance)]; min_burn_amount : Balance; minting_account : ?Account; advanced_settings : ?AdvancedSettings }
InitArgs with optional fields for initializing a token canister
type AdvancedSettings = { burned_tokens : Balance; transaction_window : Timestamp; permitted_drift : Timestamp }
Additional settings for the InitArgs type during initialization of an icrc1 token canister
type AccountBalances = StableTrieMap<EncodedAccount, Balance>
type ArchiveData = { var canister : ArchiveInterface; var stored_txs : Nat }
The details of the archive canister
type TokenData = { name : Text; symbol : Text; decimals : Nat8; var _fee : Balance; max_supply : Balance; var _minted_tokens : Balance; var _burned_tokens : Balance; minting_account : Account; accounts : AccountBalances; metadata : StableBuffer<MetaDatum>; supported_standards : StableBuffer<SupportedStandard>; transaction_window : Nat; min_burn_amount : Balance; permitted_drift : Nat; transactions : StableBuffer<Transaction>; archive : ArchiveData }
The state of the token canister
type GetTransactionsRequest = { start : TxIndex; length : Nat }
The type to request a range of transactions from the ledger canister
type TransactionRange = { transactions : [Transaction] }
type QueryArchiveFn = shared query (GetTransactionsRequest) -> async TransactionRange
type ArchivedTransaction = { start : TxIndex; length : Nat; callback : QueryArchiveFn }
type GetTransactionsResponse = { log_length : Nat; first_index : TxIndex; transactions : [Transaction]; archived_transactions : [ArchivedTransaction] }
type RosettaInterface = actor { get_transactions : shared query (GetTransactionsRequest) -> async GetTransactionsResponse }
Functions supported by the rosetta
type FullInterface = TokenInterface and RosettaInterface
Interface of the ICRC token and Rosetta canister