npm.io
8.0.0 • Published 2 weeks ago

@dfinity/ledger-icrc

Licence
Apache-2.0
Version
8.0.0
Deps
0
Size
18 kB
Vulns
0
Weekly
0
Stars
81

ledger-icrc-js

A library for interfacing with ICRC ledger on the Internet Computer.

npm version GitHub license

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.

Resources

Keywords