JSPM

@dfinity/nns

0.6.0-nightly-2022-07-27
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15756
  • Score
    100M100P100Q143213F
  • License Apache-2.0

A library for interfacing with the Internet Computer's Network Nervous System.

Package Exports

  • @dfinity/nns
  • @dfinity/nns/dist/cjs/index.cjs.js
  • @dfinity/nns/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dfinity/nns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nns-js

A library for interfacing with the ledger and governance canisters of the Internet Computer's Network Nervous System.

This library is still in active development, and new features will incrementally be available.

Example Usage

import { AccountIdentifier, LedgerCanister } from "@dfinity/nns";

// If not running in browser, add polyfill of `window.fetch` for agent-js to work.
import fetch from "cross-fetch";
global.fetch = fetch;

async function main() {
  const ledger = LedgerCanister.create();

  const accountIdentifier = AccountIdentifier.fromHex(
    "efa01544f509c56dd85449edf2381244a48fad1ede5183836229c00ab00d52df"
  );

  const balance = await ledger.accountBalance({ accountIdentifier });

  console.log(`Balance: ${balance.toE8s()}`);
}

main();

How-To