ledger-icrc-js
A library for interfacing with ICRC ledger on the Internet Computer.
Still using
@dfinity/ledger-icrc? Upgrade to@icp-sdk/canisters/ledger/icrc!
Table of contents
Installation
You can use ledger-icrc-js by installing it in your project.
npm i @dfinity/ledger-icrc
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
npm i @icp-sdk/core @dfinity/utils
Usage
The features are available through the class IcrcLedgerCanister. It has to be instantiated with a canister ID.
e.g. fetching a token metadata.
import { IcrcLedgerCanister } from "@dfinity/ledger-icrc";
import { createAgent } from "@dfinity/utils";
const agent = await createAgent({
identity,
host: HOST,
});
const { metadata } = IcrcLedgerCanister.create({
agent,
canisterId: MY_LEDGER_CANISTER_ID,
});
const data = await metadata({});
Documentation
You can find the API docs here.