@dfinity/nns 11.1.2 → 11.1.4

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 (2) hide show
  1. package/README.md +5 -601
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,6 +4,9 @@ A library for interfacing with the Internet Computer's Network Nervous System.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@dfinity/nns.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/nns) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
6
 
7
+ > [!TIP]
8
+ > Still using `@dfinity/nns`? Upgrade to [`@icp-sdk/canisters/nns`](https://js.icp.build/canisters/latest/upgrading/v1/)!
9
+
7
10
  ## Table of contents
8
11
 
9
12
  - [Installation](#installation)
@@ -66,605 +69,6 @@ const { listNeurons } = GovernanceCanister.create({
66
69
  const myNeurons = await listNeurons({ certified: false });
67
70
  ```
68
71
 
69
- ## Features
70
-
71
- `nns-js` implements following features:
72
-
73
- <!-- TSDOC_START -->
74
-
75
- ### :toolbox: Functions
76
-
77
- - [ineligibleNeurons](#gear-ineligibleneurons)
78
- - [votableNeurons](#gear-votableneurons)
79
- - [votedNeurons](#gear-votedneurons)
80
- - [memoToNeuronSubaccount](#gear-memotoneuronsubaccount)
81
- - [memoToNeuronAccountIdentifier](#gear-memotoneuronaccountidentifier)
82
-
83
- #### :gear: ineligibleNeurons
84
-
85
- Filter the neurons that are ineligible to vote to a proposal.
86
-
87
- This feature needs the ballots of the proposal to contains accurate data.
88
- If the proposal has settled, as the ballots of the proposal are emptied for archive purpose, the function might return a list of ineligible neurons that are actually neurons that have not voted but would have been eligible.
89
-
90
- Long story short, check the status of the proposal before using this function.
91
-
92
- | Function | Type |
93
- | ------------------- | ---------------------------------------------------------------------------------------------- |
94
- | `ineligibleNeurons` | `({ neurons, proposal, }: { neurons: NeuronInfo[]; proposal: ProposalInfo; }) => NeuronInfo[]` |
95
-
96
- Parameters:
97
-
98
- - `params.neurons`: The neurons to filter.
99
- - `params.proposal`: The proposal to match against the selected neurons.
100
-
101
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/utils/neurons.utils.ts#L37)
102
-
103
- #### :gear: votableNeurons
104
-
105
- Filter the neurons that can vote for a proposal - i.e. the neurons that have not voted yet and are eligible
106
-
107
- | Function | Type |
108
- | ---------------- | ---------------------------------------------------------------------------------------------- |
109
- | `votableNeurons` | `({ neurons, proposal, }: { neurons: NeuronInfo[]; proposal: ProposalInfo; }) => NeuronInfo[]` |
110
-
111
- Parameters:
112
-
113
- - `params.neurons`: The neurons to filter.
114
- - `params.proposal`: The proposal to match against the selected neurons.
115
-
116
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/utils/neurons.utils.ts#L66)
117
-
118
- #### :gear: votedNeurons
119
-
120
- Filter the neurons that have voted for a proposal.
121
-
122
- | Function | Type |
123
- | -------------- | ---------------------------------------------------------------------------------------------- |
124
- | `votedNeurons` | `({ neurons, proposal, }: { neurons: NeuronInfo[]; proposal: ProposalInfo; }) => NeuronInfo[]` |
125
-
126
- Parameters:
127
-
128
- - `params.neurons`: The neurons to filter.
129
- - `params.proposal`: The proposal for which some neurons might have already voted.
130
-
131
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/utils/neurons.utils.ts#L89)
132
-
133
- #### :gear: memoToNeuronSubaccount
134
-
135
- | Function | Type |
136
- | ------------------------ | --------------------------------------------------------------------------------- |
137
- | `memoToNeuronSubaccount` | `({ controller, memo, }: { controller: Principal; memo: bigint; }) => SubAccount` |
138
-
139
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/utils/neurons.utils.ts#L101)
140
-
141
- #### :gear: memoToNeuronAccountIdentifier
142
-
143
- | Function | Type |
144
- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
145
- | `memoToNeuronAccountIdentifier` | `({ controller, memo, governanceCanisterId, }: { controller: Principal; memo: bigint; governanceCanisterId: Principal; }) => AccountIdentifier` |
146
-
147
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/utils/neurons.utils.ts#L122)
148
-
149
- ### :factory: GenesisTokenCanister
150
-
151
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/genesis_token.canister.ts#L9)
152
-
153
- #### Static Methods
154
-
155
- - [create](#gear-create)
156
-
157
- ##### :gear: create
158
-
159
- | Method | Type |
160
- | -------- | --------------------------------------------------------------- |
161
- | `create` | `(options?: CanisterOptions<_SERVICE>) => GenesisTokenCanister` |
162
-
163
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/genesis_token.canister.ts#L14)
164
-
165
- #### Methods
166
-
167
- - [claimNeurons](#gear-claimneurons)
168
-
169
- ##### :gear: claimNeurons
170
-
171
- | Method | Type |
172
- | -------------- | --------------------------------------------------------------- |
173
- | `claimNeurons` | `({ hexPubKey, }: { hexPubKey: string; }) => Promise<bigint[]>` |
174
-
175
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/genesis_token.canister.ts#L27)
176
-
177
- ### :factory: GovernanceCanister
178
-
179
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L100)
180
-
181
- #### Static Methods
182
-
183
- - [create](#gear-create)
184
-
185
- ##### :gear: create
186
-
187
- | Method | Type |
188
- | -------- | ------------------------------------------------------------- |
189
- | `create` | `(options?: GovernanceCanisterOptions) => GovernanceCanister` |
190
-
191
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L115)
192
-
193
- #### Methods
194
-
195
- - [listNeurons](#gear-listneurons)
196
- - [listKnownNeurons](#gear-listknownneurons)
197
- - [getLatestRewardEvent](#gear-getlatestrewardevent)
198
- - [listProposals](#gear-listproposals)
199
- - [stakeNeuron](#gear-stakeneuron)
200
- - [increaseDissolveDelay](#gear-increasedissolvedelay)
201
- - [setDissolveDelay](#gear-setdissolvedelay)
202
- - [startDissolving](#gear-startdissolving)
203
- - [stopDissolving](#gear-stopdissolving)
204
- - [joinCommunityFund](#gear-joincommunityfund)
205
- - [autoStakeMaturity](#gear-autostakematurity)
206
- - [leaveCommunityFund](#gear-leavecommunityfund)
207
- - [setVisibility](#gear-setvisibility)
208
- - [setNodeProviderAccount](#gear-setnodeprovideraccount)
209
- - [mergeNeurons](#gear-mergeneurons)
210
- - [simulateMergeNeurons](#gear-simulatemergeneurons)
211
- - [splitNeuron](#gear-splitneuron)
212
- - [getProposal](#gear-getproposal)
213
- - [makeProposal](#gear-makeproposal)
214
- - [registerVote](#gear-registervote)
215
- - [setFollowees](#gear-setfollowees)
216
- - [disburse](#gear-disburse)
217
- - [refreshVotingPower](#gear-refreshvotingpower)
218
- - [mergeMaturity](#gear-mergematurity)
219
- - [stakeMaturity](#gear-stakematurity)
220
- - [spawnNeuron](#gear-spawnneuron)
221
- - [addHotkey](#gear-addhotkey)
222
- - [removeHotkey](#gear-removehotkey)
223
- - [claimOrRefreshNeuronFromAccount](#gear-claimorrefreshneuronfromaccount)
224
- - [claimOrRefreshNeuron](#gear-claimorrefreshneuron)
225
- - [getNeuron](#gear-getneuron)
226
- - [getNetworkEconomicsParameters](#gear-getnetworkeconomicsparameters)
227
- - [disburseMaturity](#gear-disbursematurity)
228
- - [setFollowing](#gear-setfollowing)
229
- - [getMetrics](#gear-getmetrics)
230
-
231
- ##### :gear: listNeurons
232
-
233
- Returns the list of neurons controlled by the caller.
234
-
235
- If an array of neuron IDs is provided, precisely those neurons will be fetched.
236
-
237
- If `certified` is true, the request is fetched as an update call, otherwise
238
- it is fetched using a query call.
239
-
240
- The backend treats `includeEmptyNeurons` as false if absent.
241
-
242
- The response from the canister might be paginated. In this case, all pages will be fetched in parallel and
243
- combined into a single return value.
244
-
245
- | Method | Type |
246
- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
247
- | `listNeurons` | `({ certified, neuronIds, includeEmptyNeurons, includePublicNeurons, neuronSubaccounts, }: { certified: boolean; neuronIds?: bigint[] or undefined; includeEmptyNeurons?: boolean or undefined; includePublicNeurons?: boolean or undefined; neuronSubaccounts?: NeuronSubaccount[] or undefined; }) => Promise<...>` |
248
-
249
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L158)
250
-
251
- ##### :gear: listKnownNeurons
252
-
253
- Returns the list of neurons who have been approved by the community to
254
- appear as the default followee options.
255
-
256
- If `certified` is true, the request is fetched as an update call, otherwise
257
- it is fetched using a query call.
258
-
259
- | Method | Type |
260
- | ------------------ | ------------------------------------------------- |
261
- | `listKnownNeurons` | `(certified?: boolean) => Promise<KnownNeuron[]>` |
262
-
263
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L291)
264
-
265
- ##### :gear: getLatestRewardEvent
266
-
267
- Returns the latest reward event.
268
-
269
- If `certified` is true, the request is fetched as an update call, otherwise
270
- it's fetched using a query call.
271
-
272
- | Method | Type |
273
- | ---------------------- | ----------------------------------------------- |
274
- | `getLatestRewardEvent` | `(certified?: boolean) => Promise<RewardEvent>` |
275
-
276
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L318)
277
-
278
- ##### :gear: listProposals
279
-
280
- Returns the list of proposals made for the community to vote on,
281
- paginated and filtered by the request.
282
-
283
- If `certified` is true (default), the request is fetched as an update call, otherwise
284
- it is fetched using a query call.
285
-
286
- | Method | Type |
287
- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
288
- | `listProposals` | `({ request, certified, }: { request: ListProposalsRequest; certified?: boolean or undefined; }) => Promise<ListProposalsResponse>` |
289
-
290
- Parameters:
291
-
292
- - `request`: the options to list the proposals (limit number of results, topics to search for, etc.)
293
- - `certified`: query or update calls
294
-
295
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L331)
296
-
297
- ##### :gear: stakeNeuron
298
-
299
- | Method | Type |
300
- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
301
- | `stakeNeuron` | `({ stake, principal, fromSubAccount, ledgerCanister, createdAt, fee, }: { stake: bigint; principal: Principal; fromSubAccount?: number[] or undefined; ledgerCanister: LedgerCanister; createdAt?: bigint or undefined; fee?: bigint or undefined; }) => Promise<...>` |
302
-
303
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L350)
304
-
305
- ##### :gear: increaseDissolveDelay
306
-
307
- Increases dissolve delay of a neuron
308
-
309
- | Method | Type |
310
- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
311
- | `increaseDissolveDelay` | `({ neuronId, additionalDissolveDelaySeconds, }: { neuronId: bigint; additionalDissolveDelaySeconds: number; }) => Promise<void>` |
312
-
313
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L411)
314
-
315
- ##### :gear: setDissolveDelay
316
-
317
- Sets dissolve delay of a neuron.
318
- The new date is now + dissolveDelaySeconds.
319
-
320
- | Method | Type |
321
- | ------------------ | ------------------------------------------------------------------------------------------------------------- |
322
- | `setDissolveDelay` | `({ neuronId, dissolveDelaySeconds, }: { neuronId: bigint; dissolveDelaySeconds: number; }) => Promise<void>` |
323
-
324
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L437)
325
-
326
- ##### :gear: startDissolving
327
-
328
- Start dissolving process of a neuron
329
-
330
- | Method | Type |
331
- | ----------------- | ------------------------------------- |
332
- | `startDissolving` | `(neuronId: bigint) => Promise<void>` |
333
-
334
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L460)
335
-
336
- ##### :gear: stopDissolving
337
-
338
- Stop dissolving process of a neuron
339
-
340
- | Method | Type |
341
- | ---------------- | ------------------------------------- |
342
- | `stopDissolving` | `(neuronId: bigint) => Promise<void>` |
343
-
344
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L474)
345
-
346
- ##### :gear: joinCommunityFund
347
-
348
- Neuron joins the community fund
349
-
350
- | Method | Type |
351
- | ------------------- | ------------------------------------- |
352
- | `joinCommunityFund` | `(neuronId: bigint) => Promise<void>` |
353
-
354
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L488)
355
-
356
- ##### :gear: autoStakeMaturity
357
-
358
- Changes auto-stake maturity for this Neuron. While on, auto-stake maturity will cause all the maturity generated by voting rewards to this neuron to be automatically staked and contribute to the voting power of the neuron.
359
-
360
- | Method | Type |
361
- | ------------------- | ---------------------------------------------------------------------- |
362
- | `autoStakeMaturity` | `(params: { neuronId: bigint; autoStake: boolean; }) => Promise<void>` |
363
-
364
- Parameters:
365
-
366
- - `neuronId`: The id of the neuron for which to request a change of the auto stake feature
367
- - `autoStake`: `true` to enable the auto-stake maturity for this neuron, `false` to turn it off
368
-
369
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L506)
370
-
371
- ##### :gear: leaveCommunityFund
372
-
373
- Neuron leaves the community fund
374
-
375
- | Method | Type |
376
- | -------------------- | ------------------------------------- |
377
- | `leaveCommunityFund` | `(neuronId: bigint) => Promise<void>` |
378
-
379
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L521)
380
-
381
- ##### :gear: setVisibility
382
-
383
- Set visibility of a neuron
384
-
385
- | Method | Type |
386
- | --------------- | ------------------------------------------------------------------- |
387
- | `setVisibility` | `(neuronId: bigint, visibility: NeuronVisibility) => Promise<void>` |
388
-
389
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L536)
390
-
391
- ##### :gear: setNodeProviderAccount
392
-
393
- Sets node provider reward account.
394
- Where the reward is paid to.
395
-
396
- | Method | Type |
397
- | ------------------------ | ---------------------------------------------- |
398
- | `setNodeProviderAccount` | `(accountIdentifier: string) => Promise<void>` |
399
-
400
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L556)
401
-
402
- ##### :gear: mergeNeurons
403
-
404
- Merge two neurons
405
-
406
- | Method | Type |
407
- | -------------- | --------------------------------------------------------------------------------- |
408
- | `mergeNeurons` | `(request: { sourceNeuronId: bigint; targetNeuronId: bigint; }) => Promise<void>` |
409
-
410
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L576)
411
-
412
- ##### :gear: simulateMergeNeurons
413
-
414
- Simulate merging two neurons
415
-
416
- | Method | Type |
417
- | ---------------------- | --------------------------------------------------------------------------------------- |
418
- | `simulateMergeNeurons` | `(request: { sourceNeuronId: bigint; targetNeuronId: bigint; }) => Promise<NeuronInfo>` |
419
-
420
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L593)
421
-
422
- ##### :gear: splitNeuron
423
-
424
- Splits a neuron creating a new one
425
-
426
- | Method | Type |
427
- | ------------- | --------------------------------------------------------------------------------------------------------------------- |
428
- | `splitNeuron` | `({ neuronId, amount, memo, }: { neuronId: bigint; amount: bigint; memo?: bigint or undefined; }) => Promise<bigint>` |
429
-
430
- Returns:
431
-
432
- newNeuronId
433
-
434
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L638)
435
-
436
- ##### :gear: getProposal
437
-
438
- Returns single proposal info
439
-
440
- If `certified` is true (default), the request is fetched as an update call, otherwise
441
- it is fetched using a query call.
442
-
443
- | Method | Type |
444
- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
445
- | `getProposal` | `({ proposalId, certified, }: { proposalId: bigint; certified?: boolean or undefined; }) => Promise<ProposalInfo or undefined>` |
446
-
447
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L681)
448
-
449
- ##### :gear: makeProposal
450
-
451
- Create new proposal
452
-
453
- | Method | Type |
454
- | -------------- | ---------------------------------------------------------------- |
455
- | `makeProposal` | `(request: MakeProposalRequest) => Promise<bigint or undefined>` |
456
-
457
- Returns:
458
-
459
- The newly created proposal ID or undefined if the success response returned by the Governance canister does not provide such information.
460
-
461
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L699)
462
-
463
- ##### :gear: registerVote
464
-
465
- Registers vote for a proposal from the neuron passed.
466
-
467
- | Method | Type |
468
- | -------------- | ----------------------------------------------------------------------------------------------------------- |
469
- | `registerVote` | `({ neuronId, vote, proposalId, }: { neuronId: bigint; vote: Vote; proposalId: bigint; }) => Promise<void>` |
470
-
471
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L720)
472
-
473
- ##### :gear: setFollowees
474
-
475
- Edit neuron followees per topic
476
-
477
- | Method | Type |
478
- | -------------- | ------------------------------------------------- |
479
- | `setFollowees` | `(followRequest: FollowRequest) => Promise<void>` |
480
-
481
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L742)
482
-
483
- ##### :gear: disburse
484
-
485
- Disburse neuron on Account
486
-
487
- | Method | Type |
488
- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
489
- | `disburse` | `({ neuronId, toAccountId, amount, }: { neuronId: bigint; toAccountId?: string or undefined; amount?: bigint or undefined; }) => Promise<void>` |
490
-
491
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L757)
492
-
493
- ##### :gear: refreshVotingPower
494
-
495
- Refreshes voting power of a neuron
496
- (Resets the `votingPowerRefreshedTimestampSeconds`
497
- parameter of the neuron to the current time).
498
-
499
- | Method | Type |
500
- | -------------------- | --------------------------------------------------------- |
501
- | `refreshVotingPower` | `({ neuronId, }: { neuronId: bigint; }) => Promise<void>` |
502
-
503
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L793)
504
-
505
- ##### :gear: mergeMaturity
506
-
507
- Merge Maturity of a neuron
508
-
509
- | Method | Type |
510
- | --------------- | ------------------------------------------------------------------------------------------------------- |
511
- | `mergeMaturity` | `({ neuronId, percentageToMerge, }: { neuronId: bigint; percentageToMerge: number; }) => Promise<void>` |
512
-
513
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L815)
514
-
515
- ##### :gear: stakeMaturity
516
-
517
- Stake the maturity of a neuron.
518
-
519
- | Method | Type |
520
- | --------------- | --------------------------------------------------------------------------------------------------------------------- |
521
- | `stakeMaturity` | `({ neuronId, percentageToStake, }: { neuronId: bigint; percentageToStake?: number or undefined; }) => Promise<void>` |
522
-
523
- Parameters:
524
-
525
- - `neuronId`: The id of the neuron for which to stake the maturity
526
- - `percentageToStake`: Optional. Percentage of the current maturity to stake. If not provided, all of the neuron's current maturity will be staked.
527
-
528
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L844)
529
-
530
- ##### :gear: spawnNeuron
531
-
532
- Merge Maturity of a neuron
533
-
534
- | Method | Type |
535
- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
536
- | `spawnNeuron` | `({ neuronId, percentageToSpawn, newController, nonce, }: { neuronId: bigint; percentageToSpawn?: number or undefined; newController?: any; nonce?: bigint or undefined; }) => Promise<bigint>` |
537
-
538
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L866)
539
-
540
- ##### :gear: addHotkey
541
-
542
- Add hotkey to neuron
543
-
544
- | Method | Type |
545
- | ----------- | ------------------------------------------------------------------------------------------ |
546
- | `addHotkey` | `({ neuronId, principal, }: { neuronId: bigint; principal: Principal; }) => Promise<void>` |
547
-
548
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L913)
549
-
550
- ##### :gear: removeHotkey
551
-
552
- Remove hotkey to neuron
553
-
554
- | Method | Type |
555
- | -------------- | ------------------------------------------------------------------------------------------ |
556
- | `removeHotkey` | `({ neuronId, principal, }: { neuronId: bigint; principal: Principal; }) => Promise<void>` |
557
-
558
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L933)
559
-
560
- ##### :gear: claimOrRefreshNeuronFromAccount
561
-
562
- Gets the NeuronID of a newly created neuron.
563
-
564
- | Method | Type |
565
- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
566
- | `claimOrRefreshNeuronFromAccount` | `({ memo, controller, }: { memo: bigint; controller?: any; }) => Promise<bigint or undefined>` |
567
-
568
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L951)
569
-
570
- ##### :gear: claimOrRefreshNeuron
571
-
572
- Refreshes neuron and returns neuronId when successful
573
- Uses query call only.
574
-
575
- | Method | Type |
576
- | ---------------------- | ------------------------------------------------------------------------ |
577
- | `claimOrRefreshNeuron` | `(request: ClaimOrRefreshNeuronRequest) => Promise<bigint or undefined>` |
578
-
579
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L982)
580
-
581
- ##### :gear: getNeuron
582
-
583
- Return the data of the neuron provided as id.
584
-
585
- | Method | Type |
586
- | ----------- | ----------------------------------------------------------------------------------------------------------- |
587
- | `getNeuron` | `({ certified, neuronId, }: { certified: boolean; neuronId: bigint; }) => Promise<NeuronInfo or undefined>` |
588
-
589
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L1007)
590
-
591
- ##### :gear: getNetworkEconomicsParameters
592
-
593
- Return the [Network Economics](https://github.com/dfinity/ic/blob/d90e934eb440c730d44d9d9b1ece2cc3f9505d05/rs/nns/governance/proto/ic_nns_governance/pb/v1/governance.proto#L1847).
594
-
595
- | Method | Type |
596
- | ------------------------------- | ------------------------------------------------------------------------ |
597
- | `getNetworkEconomicsParameters` | `({ certified, }: { certified: boolean; }) => Promise<NetworkEconomics>` |
598
-
599
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L1028)
600
-
601
- ##### :gear: disburseMaturity
602
-
603
- Disburses a neuron's maturity (always certified).
604
- Reference: https://github.com/dfinity/ic/blob/ca2be53acf413bb92478ee7694ac0fb92af07030/rs/sns/governance/src/governance.rs#L1614
605
-
606
- | Method | Type |
607
- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
608
- | `disburseMaturity` | `({ neuronId, percentageToDisburse, toAccountIdentifier, toAccount, }: { neuronId: bigint; percentageToDisburse: number; toAccountIdentifier?: string or undefined; toAccount?: Account or undefined; }) => Promise<void>` |
609
-
610
- Parameters:
611
-
612
- - `params.neuronId`: The id of the neuron for which to disburse maturity
613
- - `params.percentageToDisburse`: The percentage of the neuron's maturity to disburse, between 1 and 100 (inclusive).
614
- - `params.toAccountIdentifier`: Optional. The account identifier to which the maturity will be disbursed. If not provided, the maturity will be disbursed to the caller's Main account.
615
- - `params.toAccount`: Optional. The ICRC account to which the maturity will be disbursed. If not provided, the maturity will be disbursed to the caller's Main account.
616
-
617
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L1057)
618
-
619
- ##### :gear: setFollowing
620
-
621
- Set the following topics for a neuron.
622
-
623
- | Method | Type |
624
- | -------------- | -------------------------------------------------------------------------------------------------------------- |
625
- | `setFollowing` | `({ neuronId, topicFollowing, }: { neuronId: bigint; topicFollowing: FolloweesForTopic[]; }) => Promise<void>` |
626
-
627
- Parameters:
628
-
629
- - `params.neuronId`: The id of the neuron for which to set the following topics
630
- - `params.topicFollowing`: The topics and the followees for each topic that the neuron should follow.
631
-
632
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L1088)
633
-
634
- ##### :gear: getMetrics
635
-
636
- | Method | Type |
637
- | ------------ | ------------------------------------------------------------------------------- |
638
- | `getMetrics` | `({ certified, }: { certified: boolean; }) => Promise<GovernanceCachedMetrics>` |
639
-
640
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/governance.canister.ts#L1103)
641
-
642
- ### :factory: SnsWasmCanister
643
-
644
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/sns_wasm.canister.ts#L10)
645
-
646
- #### Static Methods
647
-
648
- - [create](#gear-create)
649
-
650
- ##### :gear: create
651
-
652
- | Method | Type |
653
- | -------- | ---------------------------------------------------------- |
654
- | `create` | `(options?: CanisterOptions<_SERVICE>) => SnsWasmCanister` |
655
-
656
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/sns_wasm.canister.ts#L16)
657
-
658
- #### Methods
659
-
660
- - [listSnses](#gear-listsnses)
661
-
662
- ##### :gear: listSnses
663
-
664
- | Method | Type |
665
- | ----------- | ----------------------------------------------------------------------------------- |
666
- | `listSnses` | `({ certified, }: { certified?: boolean or undefined; }) => Promise<DeployedSns[]>` |
667
-
668
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/nns/src/sns_wasm.canister.ts#L29)
72
+ ## Documentation
669
73
 
670
- <!-- TSDOC_END -->
74
+ You can find the API docs [here](https://js.icp.build/canisters/latest/api/nns/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/nns",
3
- "version": "11.1.2",
3
+ "version": "11.1.4",
4
4
  "description": "A library for interfacing with the Internet Computer's Network Nervous System.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  "network-nervous-system"
61
61
  ],
62
62
  "peerDependencies": {
63
- "@dfinity/ledger-icp": "^8",
63
+ "@dfinity/ledger-icp": ">=7",
64
64
  "@dfinity/utils": "^4",
65
65
  "@icp-sdk/core": "^4"
66
66
  }