@dfinity/ledger-icp
Version:
A library for interfacing with the ICP ledger on the Internet Computer.
29 lines (28 loc) • 2.1 kB
TypeScript
import { Canister, type CanisterOptions } from "@dfinity/utils";
import type { GetAccountIdentifierTransactionsResponse, _SERVICE as IndexService } from "../candid/index";
import type { GetTransactionsParams } from "./types/index.params";
import type { AccountBalanceParams } from "./types/ledger.params";
export declare class IndexCanister extends Canister<IndexService> {
static create({ canisterId: optionsCanisterId, ...options }: CanisterOptions<IndexService>): IndexCanister;
/**
* Returns the balance of the specified account identifier.
*
* @param {AccountBalanceParams} params The parameters to get the balance of an account.
* @param {AccountIdentifierParam} params.accountIdentifier The account identifier provided either as hex string or as an AccountIdentifier.
* @param {boolean} params.certified query or update call.
* @returns {Promise<bigint>} The balance of the given account.
*/
accountBalance: ({ certified, accountIdentifier, }: AccountBalanceParams) => Promise<bigint>;
/**
* Returns the transactions and balance of an ICP account.
*
* @param {GetTransactionsParams} params The parameters to get the transactions.
* @param {boolean} params.certified query or update call.
* @param {AccountIdentifierParam} params.accountIdentifier The account identifier provided either as hex string or as an AccountIdentifier.
* @param {bigint} params.start If set then the results will start from the next most recent transaction id after start (start won't be included). If not provided, then the results will start from the most recent transaction id.
* @param {bigint} params.maxResults Maximum number of transactions to fetch.
* @returns {Promise<GetAccountIdentifierTransactionsResponse>} The transactions, balance and the transaction id of the oldest transaction the account has.
* @throws {@link IndexError}
*/
getTransactions: ({ certified, accountIdentifier, start, maxResults: max_results, }: GetTransactionsParams) => Promise<GetAccountIdentifierTransactionsResponse>;
}