@dfinity/nns 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +12 -24
  2. package/dist/candid/genesis_token.did +1 -1
  3. package/dist/candid/governance.certified.idl.js +488 -312
  4. package/dist/candid/governance.d.ts +101 -0
  5. package/dist/candid/governance.did +104 -3
  6. package/dist/candid/governance.idl.js +496 -320
  7. package/dist/candid/governance_test.certified.idl.js +115 -0
  8. package/dist/candid/governance_test.d.ts +69 -0
  9. package/dist/candid/governance_test.did +67 -2
  10. package/dist/candid/governance_test.idl.js +115 -0
  11. package/dist/candid/sns_wasm.certified.idl.js +2 -0
  12. package/dist/candid/sns_wasm.d.ts +2 -0
  13. package/dist/candid/sns_wasm.did +3 -1
  14. package/dist/candid/sns_wasm.idl.js +2 -0
  15. package/dist/cjs/index.cjs.js +2 -2
  16. package/dist/cjs/index.cjs.js.map +4 -4
  17. package/dist/esm/chunk-2MR4JA3T.js +20 -0
  18. package/dist/esm/chunk-2MR4JA3T.js.map +7 -0
  19. package/dist/esm/chunk-YGDWD6VV.js +2 -0
  20. package/dist/esm/chunk-YGDWD6VV.js.map +7 -0
  21. package/dist/esm/governance.canister.js +1 -1
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/index.js.map +4 -4
  24. package/dist/esm/sns_wasm.canister.js +1 -1
  25. package/dist/types/canisters/governance/request.converters.d.ts +1 -1
  26. package/dist/types/canisters/governance/response.converters.d.ts +2 -1
  27. package/dist/types/enums/governance.enums.d.ts +3 -1
  28. package/dist/types/governance_test.canister.d.ts +14 -0
  29. package/dist/types/index.d.ts +1 -0
  30. package/dist/types/types/governance_converters.d.ts +17 -11
  31. package/package.json +1 -1
  32. package/dist/esm/chunk-IJWQXUQ5.js +0 -2
  33. package/dist/esm/chunk-IJWQXUQ5.js.map +0 -7
  34. package/dist/esm/chunk-LARRGLCK.js +0 -20
  35. package/dist/esm/chunk-LARRGLCK.js.map +0 -7
package/README.md CHANGED
@@ -9,13 +9,6 @@ A library for interfacing with the Internet Computer's Network Nervous System.
9
9
  - [Installation](#installation)
10
10
  - [Usage](#usage)
11
11
  - [Features](#features)
12
- - [AccountIdentifier](#factory-accountidentifier)
13
- - [SubAccount](#factory-subaccount)
14
- - [GenesisTokenCanister](#factory-genesistokencanister)
15
- - [ICP](#factory-icp)
16
- - [LedgerCanister](#factory-ledgercanister)
17
- - [GovernanceCanister](#factory-governancecanister)
18
- - [SnsWasmCanister](#factory-snswasmcanister)
19
12
 
20
13
  ## Installation
21
14
 
@@ -33,28 +26,23 @@ npm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils @dfinity/
33
26
 
34
27
  ## Usage
35
28
 
36
- Most features are provided through the use of classes. e.g. querying the `ledger` for an account balance in a NodeJS context can be developed as following:
29
+ Most features are provided through the use of classes. For example, querying the list of neurons controlled by the caller with the `governance` canister:
37
30
 
38
31
  ```ts
39
- import { AccountIdentifier, LedgerCanister } from "@dfinity/nns";
32
+ import { GovernanceCanister } from "@dfinity/nns";
33
+ import { createAgent } from "@dfinity/utils";
40
34
 
41
- // If not running in browser, add polyfill of `window.fetch` for agent-js to work.
42
- import fetch from "cross-fetch";
43
- global.fetch = fetch;
35
+ const agent = await createAgent({
36
+ identity,
37
+ host: HOST,
38
+ });
44
39
 
45
- const main = async () => {
46
- const ledger = LedgerCanister.create();
40
+ const { listNeurons } = GovernanceCanister.create({
41
+ agent,
42
+ canisterId: MY_GOVERNANCE_CANISTER_ID,
43
+ });
47
44
 
48
- const accountIdentifier = AccountIdentifier.fromHex(
49
- "efa01544f509c56dd85449edf2381244a48fad1ede5183836229c00ab00d52df",
50
- );
51
-
52
- const balance = await ledger.accountBalance({ accountIdentifier });
53
-
54
- console.log(`Balance: ${balance}`);
55
- };
56
-
57
- await main();
45
+ const myNeurons = await listNeurons({ certified: false });
58
46
  ```
59
47
 
60
48
  ## Features
@@ -1,4 +1,4 @@
1
- // Generated from IC repo commit b9fc66eafca530e997313aa68aaac31d41e6a875 'rs/nns/gtc/canister/gtc.did' by import-candid
1
+ // Generated from IC repo commit 1a01f85fc1994e69dd5ba72b4d87fe9f9c4093ee 'rs/nns/gtc/canister/gtc.did' by import-candid
2
2
  type AccountState = record {
3
3
  authenticated_principal_id : opt principal;
4
4
  successfully_transferred_neurons : vec TransferredNeuron;