Complete API reference for ICP and ICRC token operations
getBalance(account?)
account
(optional): string
- Account identifier (defaults to current identity)Promise<bigint>
- Balance in e8s (1 ICP = 100,000,000 e8s)
Example:
transfer(to, amount, options?)
to
: string
- Recipient account identifieramount
: bigint | number | string
- Amount to transferoptions
(optional): ITransferOptions
memo
: bigint
- Transaction memofee
: bigint
- Custom fee (optional)fromSubaccount
: Uint8Array
- Source subaccountPromise<ITransferResult>
blockHeight
: bigint
- Block height of the transactionqueryBlocks(start, length)
start
: bigint
- Starting block heightlength
: bigint
- Number of blocks to queryPromise<unknown>
- Block data
icrc1Balance(canisterId, account?)
canisterId
: string
- Token canister IDaccount
(optional): string | IAccount
- Account to query (defaults to current identity)Promise<bigint>
- Token balance
Example:
icrc1Transfer(canisterId, to, amount, options?)
canisterId
: string
- Token canister IDto
: string | IAccount
- Recipient accountamount
: bigint | number | string
- Amount to transferoptions
(optional): Partial<ITransferOptions>
Promise<ITransferResult>
Example:
icrc1Approve(canisterId, spender, amount, options?)
canisterId
: string
- Token canister IDspender
: string | IAccount
- Spender accountamount
: bigint | number | string
- Amount to approveoptions
(optional): Partial<IApproveArgs>
Promise<bigint>
- Approval transaction ID
Example:
icrc1Allowance(canisterId, owner, spender)
canisterId
: string
- Token canister IDowner
: string | IAccount
- Token ownerspender
: string | IAccount
- Approved spenderPromise<IAllowance>
allowance
: bigint
- Approved amountexpires_at
: bigint[]
- Expiration time (optional)getAccountId(principal?, subaccount?)
principal
(optional): string | Principal
- Principal (defaults to current identity)subaccount
(optional): Uint8Array
- Subaccount bytesstring
- Account identifier
Example:
createAccount(principal, subaccount?)
principal
: string | Principal
- Account owner principalsubaccount
(optional): Uint8Array
- Subaccount bytesIAccount
owner
: Principal
- Account ownersubaccount
: Uint8Array
- SubaccountgenerateSubaccount()
Uint8Array
- 32-byte subaccount
Example:
validateAccount(account)
account
: string
- Account identifier to validateboolean
- Whether account is valid
parseAmount(amount, decimals?)
amount
: string
- Amount as string (e.g., “1.5”)decimals
(optional): number
- Token decimals (default: 8)bigint
- Parsed amount
Example:
formatAmount(amount, decimals?)
amount
: bigint
- Amount in smallest unitsdecimals
(optional): number
- Token decimals (default: 8)string
- Formatted amount
Example:
createMemo(input)
input
: string | number | bigint
- Memo inputbigint
- Memo as bigint
Example:
estimateFee(canisterId?, priority?)
canisterId
(optional): string
- Token canister ID (for ICRC tokens)priority
(optional): boolean
- Priority transactionPromise<IFeeEstimate>
amount
: bigint
- Estimated feecurrency
: string
- Fee currencygetTokenMetadata(canisterId?)
canisterId
(optional): string
- Token canister ID (omit for ICP)Promise<ITokenMetadata>
name
: string
- Token namesymbol
: string
- Token symboldecimals
: number
- Token decimalsfee
: bigint
- Transfer feetotalSupply
: bigint
- Total supply (if available)getSupportedStandards(canisterId)
canisterId
: string
- Token canister IDPromise<string[]>
- Supported standards
Example:
IAccount
ITransferResult
ITransferOptions
ITokenMetadata