Skip to content

Latest commit

 

History

History
332 lines (229 loc) · 5.94 KB

lib.md

File metadata and controls

332 lines (229 loc) · 5.94 KB

ICRC1/lib

Type Account

type Account = T.Account

Type Subaccount

type Subaccount = T.Subaccount

Type AccountBalances

type AccountBalances = T.AccountBalances

Type Transaction

type Transaction = T.Transaction

Type Balance

type Balance = T.Balance

Type TransferArgs

type TransferArgs = T.TransferArgs

Type Mint

type Mint = T.Mint

Type BurnArgs

type BurnArgs = T.BurnArgs

Type TransactionRequest

type TransactionRequest = T.TransactionRequest

Type TransferError

type TransferError = T.TransferError

Type SupportedStandard

type SupportedStandard = T.SupportedStandard

Type InitArgs

type InitArgs = T.InitArgs

Type TokenInitArgs

type TokenInitArgs = T.TokenInitArgs

Type TokenData

type TokenData = T.TokenData

Type MetaDatum

type MetaDatum = T.MetaDatum

Type TxLog

type TxLog = T.TxLog

Type TxIndex

type TxIndex = T.TxIndex

Type TokenInterface

type TokenInterface = T.TokenInterface

Type RosettaInterface

type RosettaInterface = T.RosettaInterface

Type FullInterface

type FullInterface = T.FullInterface

Type ArchiveInterface

type ArchiveInterface = T.ArchiveInterface

Type GetTransactionsRequest

type GetTransactionsRequest = T.GetTransactionsRequest

Type GetTransactionsResponse

type GetTransactionsResponse = T.GetTransactionsResponse

Type QueryArchiveFn

type QueryArchiveFn = T.QueryArchiveFn

Type TransactionRange

type TransactionRange = T.TransactionRange

Type ArchivedTransaction

type ArchivedTransaction = T.ArchivedTransaction

Type TransferResult

type TransferResult = T.TransferResult

Value MAX_TRANSACTIONS_IN_LEDGER

let MAX_TRANSACTIONS_IN_LEDGER

Value MAX_TRANSACTION_BYTES

let MAX_TRANSACTION_BYTES : Nat64

Value MAX_TRANSACTIONS_PER_REQUEST

let MAX_TRANSACTIONS_PER_REQUEST

Function init

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

Initialize a new ICRC-1 token

Function name

func name(token : T.TokenData) : Text

Retrieve the name of the token

Function symbol

func symbol(token : T.TokenData) : Text

Retrieve the symbol of the token

Function decimals

func decimals() : Nat8

Retrieve the number of decimals specified for the token

Function fee

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

Retrieve the fee for each transfer

Function set_fee

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

Set the fee for each transfer

Function metadata

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

Retrieve all the metadata of the token

Function total_supply

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

Returns the total supply of circulating tokens

Function minted_supply

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

Returns the total supply of minted tokens

Function burned_supply

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

Returns the total supply of burned tokens

Function max_supply

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

Returns the maximum supply of tokens

Function minting_account

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.

Function balance_of

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

Retrieve the balance of a given account

Function supported_standards

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

Returns an array of standards supported by this token

Function balance_from_float

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

Function transfer

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)

Function mint

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

Helper function to mint tokens with minimum args

Function burn

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

Helper function to burn tokens with minimum args

Function total_transactions

func total_transactions(token : T.TokenData) : Nat

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

Function get_transaction

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

Retrieves the transaction specified by the given tx_index

Function get_transactions

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

Retrieves the transactions specified by the given range