ICRC1/lib

type Account = T.Account

type Subaccount = T.Subaccount

type AccountBalances = T.AccountBalances

type Transaction = T.Transaction

type Balance = T.Balance

type TransferArgs = T.TransferArgs

type Mint = T.Mint

type BurnArgs = T.BurnArgs

type TransactionRequest = T.TransactionRequest

type TransferError = T.TransferError

type SupportedStandard = T.SupportedStandard

type InitArgs = T.InitArgs

type TokenInitArgs = T.TokenInitArgs

type TokenData = T.TokenData

type MetaDatum = T.MetaDatum

type TxLog = T.TxLog

type TxIndex = T.TxIndex

type TokenInterface = T.TokenInterface

type RosettaInterface = T.RosettaInterface

type FullInterface = T.FullInterface

type ArchiveInterface = T.ArchiveInterface

type GetTransactionsRequest = T.GetTransactionsRequest

type GetTransactionsResponse = T.GetTransactionsResponse

type QueryArchiveFn = T.QueryArchiveFn

type TransactionRange = T.TransactionRange

type ArchivedTransaction = T.ArchivedTransaction

type TransferResult = T.TransferResult

public let MAX_TRANSACTIONS_IN_LEDGER :

public let MAX_TRANSACTION_BYTES : Nat64

public let MAX_TRANSACTIONS_PER_REQUEST :

public func init(args : T.InitArgs) : T.TokenData

Initialize a new ICRC-1 token

public func name(token : T.TokenData) : Text

Retrieve the name of the token

public func symbol(token : T.TokenData) : Text

Retrieve the symbol of the token

public func decimals() : Nat8

Retrieve the number of decimals specified for the token

public func fee(token : T.TokenData) : T.Balance

Retrieve the fee for each transfer

public func set_fee(token : T.TokenData, fee : Nat)

Set the fee for each transfer

public func metadata(token : T.TokenData) : [T.MetaDatum]

Retrieve all the metadata of the token

public func total_supply(token : T.TokenData) : T.Balance

Returns the total supply of circulating tokens

public func minted_supply(token : T.TokenData) : T.Balance

Returns the total supply of minted tokens

public func burned_supply(token : T.TokenData) : T.Balance

Returns the total supply of burned tokens

public func max_supply(token : T.TokenData) : T.Balance

Returns the maximum supply of tokens

public func minting_account(token : T.TokenData) : T.Account

Returns the account with the permission to mint tokens

Note: The minting account can only participate in minting and burning transactions, so any tokens sent to it will be considered burned.

public func balance_of(account : T.Account) : T.Balance

Retrieve the balance of a given account

public func supported_standards(token : T.TokenData) : [T.SupportedStandard]

Returns an array of standards supported by this token

public func balance_from_float(token : T.TokenData, float : Float) : T.Balance

Formats a float to a nat balance and applies the correct number of decimal places

public func transfer(
  token : T.TokenData,
  args : T.TransferArgs,
  caller : Principal
) : async T.TransferResult

Transfers tokens from one account to another account (minting and burning included)

public func mint(
  token : T.TokenData,
  args : T.Mint,
  caller : Principal
) : async T.TransferResult

Helper function to mint tokens with minimum args

public func burn(
  token : T.TokenData,
  args : T.BurnArgs,
  caller : Principal
) : async T.TransferResult

Helper function to burn tokens with minimum args

public func total_transactions(token : T.TokenData) : Nat

Returns the total number of transactions that have been processed by the given token.

public func get_transaction(token : T.TokenData, tx_index : T.TxIndex) : async ?T.Transaction

Retrieves the transaction specified by the given tx_index

public func get_transactions(token : T.TokenData, req : T.GetTransactionsRequest) : T.GetTransactionsResponse

Retrieves the transactions specified by the given range