@dfinity/nns
    TypeScript icon, indicating that this package has built-in type declarations

    0.4.0 • Public • Published

    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();

    Install

    npm i @dfinity/nns

    DownloadsWeekly Downloads

    1,661

    Version

    0.4.0

    License

    Apache-2.0

    Unpacked Size

    5.99 MB

    Total Files

    69

    Last publish

    Collaborators

    • frederikrothenberger
    • bitdivine
    • ielashi
    • liadrit
    • dayyildiz
    • anthony_dfinity
    • eric-swanson-dfinity
    • krpeacock
    • terrorjack
    • npm-dfinity-org