
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
@dfinity/nns
Advanced tools
A library for interfacing with the Internet Computer's Network Nervous System.
A library for interfacing with the Internet Computer's Network Nervous System.
[!TIP] Still using
@dfinity/nns? Upgrade to@icp-sdk/canisters/nns!
You can use nns-js by installing it in your project.
npm i @dfinity/nns
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
npm i @icp-sdk/core @dfinity/utils
Most features are provided through the use of classes. For example, querying the list of neurons controlled by the caller with the governance canister:
import { NnsGovernanceCanister } from "@dfinity/nns";
import { createAgent } from "@dfinity/utils";
const agent = await createAgent({
identity,
host: HOST,
});
const { listNeurons } = NnsGovernanceCanister.create({
agent,
canisterId: MY_GOVERNANCE_CANISTER_ID,
});
const myNeurons = await listNeurons({ certified: false });
To execute this on a local environment, you will need to fetch the root key when initializing the agent. Additionally, you might need to adapt the port. The following snippet also demonstrates how you can inline a canister ID as well.
import { NnsGovernanceCanister } from "@dfinity/nns";
import { Principal } from "@icp-sdk/core/principal";
import { createAgent } from "@dfinity/utils";
const agent = await createAgent({
identity,
host: "http://localhost:8000",
fetchRootKey: true,
});
const { listNeurons } = NnsGovernanceCanister.create({
agent,
canisterId: Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),
});
const myNeurons = await listNeurons({ certified: false });
You can find the API docs here.
FAQs
A library for interfacing with the Internet Computer's Network Nervous System.
The npm package @dfinity/nns receives a total of 15,162 weekly downloads. As such, @dfinity/nns popularity was classified as popular.
We found that @dfinity/nns demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.