Skip to content

LedgerCanister

Defined in: packages/ledger-icp/src/ledger.canister.ts:35

  • Canister<LedgerService>

protected new LedgerCanister(id, service, certifiedService): LedgerCanister

Defined in: packages/utils/dist/services/canister.d.ts:7

Principal

_SERVICE

_SERVICE

LedgerCanister

Canister<LedgerService>.constructor

protected caller: (__namedParameters) => _SERVICE

Defined in: packages/utils/dist/services/canister.d.ts:9

QueryParams

_SERVICE

Canister.caller


protected readonly certifiedService: _SERVICE

Defined in: packages/utils/dist/services/canister.d.ts:6

Canister.certifiedService


protected readonly service: _SERVICE

Defined in: packages/utils/dist/services/canister.d.ts:5

Canister.service

get canisterId(): Principal

Defined in: packages/utils/dist/services/canister.d.ts:8

Principal

Canister.canisterId

accountBalance(params): Promise<bigint>

Defined in: packages/ledger-icp/src/ledger.canister.ts:64

Returns the balance of the specified account identifier.

If certified is true, the request is fetched as an update call, otherwise it is fetched using a query call.

AccountBalanceParams

The parameters to get the balance of an account.

Promise<bigint>

The balance of the given account.

Error


icrc1Transfer(request): Promise<bigint>

Defined in: packages/ledger-icp/src/ledger.canister.ts:132

Transfer ICP from the caller to the destination Account. Returns the index of the block containing the tx if it was successful.

Icrc1TransferRequest

Promise<bigint>

TransferError


icrc21ConsentMessage(params): Promise<icrc21_consent_info>

Defined in: packages/ledger-icp/src/ledger.canister.ts:179

Fetches the consent message for a specified canister call, intended to provide a human-readable message that helps users make informed decisions.

@link: https://github.com/dfinity/wg-identity-authentication/blob/main/topics/ICRC-21/icrc_21_consent_msg.md

Icrc21ConsentMessageRequest

The request parameters containing the method name, arguments, and consent preferences (e.g., language).

Promise<icrc21_consent_info>

  • A promise that resolves to the consent message response, which includes the consent message in the specified language and other related information.
  • This error is reserved for future use, in case payment extensions are introduced. For example, if consent messages, which are currently free, begin to require payments.
  • If the specified canister call is not supported.
  • If there is no consent message available.
  • For any other generic errors.

icrc2Approve(params): Promise<bigint>

Defined in: packages/ledger-icp/src/ledger.canister.ts:152

This method entitles the spender to transfer token amount on behalf of the caller from account { owner = caller; subaccount = from_subaccount }.

Reference: https://github.com/dfinity/ICRC-1/blob/main/standards/ICRC-2/index.md#icrc2_approve

Icrc2ApproveRequest

The parameters to approve.

Promise<bigint>

The block index of the approved transaction.

If the approval fails.


metadata(params): Promise<[string, Value][]>

Defined in: packages/ledger-icp/src/ledger.canister.ts:83

Fetches the ledger metadata.

QueryParams

The parameters used to fetch the metadata, notably query or certified call.

Promise<[string, Value][]>

The metadata of the ICP ledger. A promise that resolves to an array of metadata entries, where each entry is a tuple consisting of a string and a value.


transactionFee(params?): Promise<bigint>

Defined in: packages/ledger-icp/src/ledger.canister.ts:94

Returns the transaction fee of the ICP ledger canister.

QueryParams = ...

Optional query parameters for the request, defaulting to { certified: false } for backwards compatibility reason.

Promise<bigint>

A promise that resolves to the transaction fee as a bigint.


transfer(request): Promise<bigint>

Defined in: packages/ledger-icp/src/ledger.canister.ts:112

Transfer ICP from the caller to the destination accountIdentifier. Returns the index of the block containing the tx if it was successful.

TransferRequest

Promise<bigint>

TransferError


static create(options): LedgerCanister

Defined in: packages/ledger-icp/src/ledger.canister.ts:36

LedgerCanisterOptions = {}

LedgerCanister