@dfinity/sns 6.0.0 → 6.0.1

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 -962
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,9 @@ A library for interfacing with a Service Nervous System (SNS) project.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@dfinity/sns.svg?logo=npm)](https://www.npmjs.com/package/@dfinity/sns) [![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/sns`? Upgrade to [`@icp-sdk/canisters/sns`](https://js.icp.build/canisters/latest/upgrading/v1/)!
9
+
7
10
  ## Table of contents
8
11
 
9
12
  - [Installation](#installation)
@@ -78,966 +81,6 @@ const data = await metadata({ certified: true });
78
81
  console.log("Summary data:", data);
79
82
  ```
80
83
 
81
- ## Features
82
-
83
- `sns-js` implements following features:
84
-
85
- <!-- TSDOC_START -->
86
-
87
- ### :toolbox: Functions
88
-
89
- - [initSnsWrapper](#gear-initsnswrapper)
90
-
91
- #### :gear: initSnsWrapper
92
-
93
- Lookup for the canister ids of a Sns and initialize the wrapper to access its features.
94
-
95
- | Function | Type |
96
- | ---------------- | ---------------- |
97
- | `initSnsWrapper` | `InitSnsWrapper` |
98
-
99
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.ts#L36)
100
-
101
- ### :factory: SnsGovernanceCanister
102
-
103
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L66)
104
-
105
- #### Static Methods
106
-
107
- - [create](#gear-create)
108
-
109
- ##### :gear: create
110
-
111
- Instantiate a canister to interact with the governance of a Sns project.
112
-
113
- | Method | Type |
114
- | -------- | ------------------------------------------------------------------ |
115
- | `create` | `(options: SnsCanisterOptions<_SERVICE>) => SnsGovernanceCanister` |
116
-
117
- Parameters:
118
-
119
- - `options`: Miscellaneous options to initialize the canister. Its ID being the only mandatory parammeter.
120
-
121
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L72)
122
-
123
- #### Methods
124
-
125
- - [listNeurons](#gear-listneurons)
126
- - [listProposals](#gear-listproposals)
127
- - [listTopics](#gear-listtopics)
128
- - [getProposal](#gear-getproposal)
129
- - [listNervousSystemFunctions](#gear-listnervoussystemfunctions)
130
- - [metadata](#gear-metadata)
131
- - [nervousSystemParameters](#gear-nervoussystemparameters)
132
- - [getNeuron](#gear-getneuron)
133
- - [queryNeuron](#gear-queryneuron)
134
- - [manageNeuron](#gear-manageneuron)
135
- - [addNeuronPermissions](#gear-addneuronpermissions)
136
- - [removeNeuronPermissions](#gear-removeneuronpermissions)
137
- - [splitNeuron](#gear-splitneuron)
138
- - [disburse](#gear-disburse)
139
- - [startDissolving](#gear-startdissolving)
140
- - [stopDissolving](#gear-stopdissolving)
141
- - [stakeMaturity](#gear-stakematurity)
142
- - [disburseMaturity](#gear-disbursematurity)
143
- - [autoStakeMaturity](#gear-autostakematurity)
144
- - [setDissolveTimestamp](#gear-setdissolvetimestamp)
145
- - [increaseDissolveDelay](#gear-increasedissolvedelay)
146
- - [setTopicFollowees](#gear-settopicfollowees)
147
- - [setFollowing](#gear-setfollowing)
148
- - [registerVote](#gear-registervote)
149
- - [refreshNeuron](#gear-refreshneuron)
150
- - [claimNeuron](#gear-claimneuron)
151
-
152
- ##### :gear: listNeurons
153
-
154
- List the neurons of the Sns
155
-
156
- | Method | Type |
157
- | ------------- | ----------------------------------------------------- |
158
- | `listNeurons` | `(params: SnsListNeuronsParams) => Promise<Neuron[]>` |
159
-
160
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L86)
161
-
162
- ##### :gear: listProposals
163
-
164
- List the proposals of the Sns
165
-
166
- | Method | Type |
167
- | --------------- | -------------------------------------------------------------------- |
168
- | `listProposals` | `(params: SnsListProposalsParams) => Promise<ListProposalsResponse>` |
169
-
170
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L100)
171
-
172
- ##### :gear: listTopics
173
-
174
- List the topics of the Sns
175
-
176
- | Method | Type |
177
- | ------------ | ------------------------------------------------------ |
178
- | `listTopics` | `(params: QueryParams) => Promise<ListTopicsResponse>` |
179
-
180
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L115)
181
-
182
- ##### :gear: getProposal
183
-
184
- Get the proposal of the Sns
185
-
186
- | Method | Type |
187
- | ------------- | --------------------------------------------------------- |
188
- | `getProposal` | `(params: SnsGetProposalParams) => Promise<ProposalData>` |
189
-
190
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L126)
191
-
192
- ##### :gear: listNervousSystemFunctions
193
-
194
- List Nervous System Functions
195
- Neurons can follow other neurons in specific Nervous System Functions.
196
-
197
- | Method | Type |
198
- | ---------------------------- | ---------------------------------------------------------------------- |
199
- | `listNervousSystemFunctions` | `(params: QueryParams) => Promise<ListNervousSystemFunctionsResponse>` |
200
-
201
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L145)
202
-
203
- ##### :gear: metadata
204
-
205
- Get the Sns metadata (title, description, etc.)
206
-
207
- | Method | Type |
208
- | ---------- | ------------------------------------------------------- |
209
- | `metadata` | `(params: QueryParams) => Promise<GetMetadataResponse>` |
210
-
211
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L153)
212
-
213
- ##### :gear: nervousSystemParameters
214
-
215
- Get the Sns nervous system parameters (default followees, max dissolve delay, max number of neurons, etc.)
216
-
217
- | Method | Type |
218
- | ------------------------- | ----------------------------------------------------------- |
219
- | `nervousSystemParameters` | `(params: QueryParams) => Promise<NervousSystemParameters>` |
220
-
221
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L159)
222
-
223
- ##### :gear: getNeuron
224
-
225
- Get the neuron of the Sns
226
-
227
- | Method | Type |
228
- | ----------- | ------------------------------------------------- |
229
- | `getNeuron` | `(params: SnsGetNeuronParams) => Promise<Neuron>` |
230
-
231
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L167)
232
-
233
- ##### :gear: queryNeuron
234
-
235
- Same as `getNeuron` but returns undefined instead of raising error when not found.
236
-
237
- | Method | Type |
238
- | ------------- | -------------------------------------------------------------- |
239
- | `queryNeuron` | `(params: SnsGetNeuronParams) => Promise<Neuron or undefined>` |
240
-
241
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L185)
242
-
243
- ##### :gear: manageNeuron
244
-
245
- Manage neuron. For advanced users.
246
-
247
- | Method | Type |
248
- | -------------- | ---------------------------------------------------------- |
249
- | `manageNeuron` | `(request: ManageNeuron) => Promise<ManageNeuronResponse>` |
250
-
251
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L205)
252
-
253
- ##### :gear: addNeuronPermissions
254
-
255
- Add permissions to a neuron for a specific principal
256
-
257
- | Method | Type |
258
- | ---------------------- | ------------------------------------------------------- |
259
- | `addNeuronPermissions` | `(params: SnsNeuronPermissionsParams) => Promise<void>` |
260
-
261
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L218)
262
-
263
- ##### :gear: removeNeuronPermissions
264
-
265
- Remove permissions to a neuron for a specific principal
266
-
267
- | Method | Type |
268
- | ------------------------- | ------------------------------------------------------- |
269
- | `removeNeuronPermissions` | `(params: SnsNeuronPermissionsParams) => Promise<void>` |
270
-
271
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L228)
272
-
273
- ##### :gear: splitNeuron
274
-
275
- Split neuron
276
-
277
- | Method | Type |
278
- | ------------- | ------------------------------------------------------------------ |
279
- | `splitNeuron` | `(params: SnsSplitNeuronParams) => Promise<NeuronId or undefined>` |
280
-
281
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L238)
282
-
283
- ##### :gear: disburse
284
-
285
- Disburse neuron on Account
286
-
287
- | Method | Type |
288
- | ---------- | ---------------------------------------------------- |
289
- | `disburse` | `(params: SnsDisburseNeuronParams) => Promise<void>` |
290
-
291
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L269)
292
-
293
- ##### :gear: startDissolving
294
-
295
- Start dissolving process of a neuron
296
-
297
- | Method | Type |
298
- | ----------------- | --------------------------------------- |
299
- | `startDissolving` | `(neuronId: NeuronId) => Promise<void>` |
300
-
301
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L277)
302
-
303
- ##### :gear: stopDissolving
304
-
305
- Stop dissolving process of a neuron
306
-
307
- | Method | Type |
308
- | ---------------- | --------------------------------------- |
309
- | `stopDissolving` | `(neuronId: NeuronId) => Promise<void>` |
310
-
311
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L285)
312
-
313
- ##### :gear: stakeMaturity
314
-
315
- Stake the maturity of a neuron.
316
-
317
- | Method | Type |
318
- | --------------- | ----------------------------------------------------------------------------------- |
319
- | `stakeMaturity` | `({ neuronId, percentageToStake, }: SnsNeuronStakeMaturityParams) => Promise<void>` |
320
-
321
- Parameters:
322
-
323
- - `neuronId`: The id of the neuron for which to stake the maturity
324
- - `percentageToStake`: Optional. Percentage of the current maturity to stake. If not provided, all of the neuron's current maturity will be staked.
325
-
326
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L297)
327
-
328
- ##### :gear: disburseMaturity
329
-
330
- Disburse the maturity of a neuron.
331
-
332
- | Method | Type |
333
- | ------------------ | ------------------------------------------------------------ |
334
- | `disburseMaturity` | `(params: SnsNeuronDisburseMaturityParams) => Promise<void>` |
335
-
336
- Parameters:
337
-
338
- - `toAccount. Account`: to disburse maturity.
339
- - `neuronId`: The id of the neuron for which to disburse the maturity
340
- - `percentageToDisburse`: What percentage of the available maturity to disburse.
341
-
342
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L318)
343
-
344
- ##### :gear: autoStakeMaturity
345
-
346
- Changes auto-stake maturity for a Neuron.
347
-
348
- | Method | Type |
349
- | ------------------- | ------------------------------------------------------------- |
350
- | `autoStakeMaturity` | `(params: SnsNeuronAutoStakeMaturityParams) => Promise<void>` |
351
-
352
- Parameters:
353
-
354
- - `neuronId`: The id of the neuron for which to request a change of the auto stake feature
355
- - `autoStake`: `true` to enable the auto-stake maturity for this neuron, `false` to turn it off
356
-
357
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L334)
358
-
359
- ##### :gear: setDissolveTimestamp
360
-
361
- Increase dissolve delay of a neuron
362
-
363
- | Method | Type |
364
- | ---------------------- | ---------------------------------------------------------- |
365
- | `setDissolveTimestamp` | `(params: SnsSetDissolveTimestampParams) => Promise<void>` |
366
-
367
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L344)
368
-
369
- ##### :gear: increaseDissolveDelay
370
-
371
- Increase dissolve delay of a neuron
372
-
373
- | Method | Type |
374
- | ----------------------- | ----------------------------------------------------------- |
375
- | `increaseDissolveDelay` | `(params: SnsIncreaseDissolveDelayParams) => Promise<void>` |
376
-
377
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L354)
378
-
379
- ##### :gear: setTopicFollowees
380
-
381
- Sets followees of a neuron for a specific Nervous System Function
382
-
383
- | Method | Type |
384
- | ------------------- | ------------------------------------------------- |
385
- | `setTopicFollowees` | `(params: SnsSetTopicFollowees) => Promise<void>` |
386
-
387
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L365)
388
-
389
- ##### :gear: setFollowing
390
-
391
- Sets followees of a neuron for topics
392
-
393
- | Method | Type |
394
- | -------------- | -------------------------------------------------- |
395
- | `setFollowing` | `(params: SnsSetFollowingParams) => Promise<void>` |
396
-
397
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L373)
398
-
399
- ##### :gear: registerVote
400
-
401
- Registers vote for a proposal from the neuron passed.
402
-
403
- | Method | Type |
404
- | -------------- | -------------------------------------------------- |
405
- | `registerVote` | `(params: SnsRegisterVoteParams) => Promise<void>` |
406
-
407
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L381)
408
-
409
- ##### :gear: refreshNeuron
410
-
411
- Refresh neuron
412
-
413
- | Method | Type |
414
- | --------------- | --------------------------------------- |
415
- | `refreshNeuron` | `(neuronId: NeuronId) => Promise<void>` |
416
-
417
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L389)
418
-
419
- ##### :gear: claimNeuron
420
-
421
- Claim neuron
422
-
423
- | Method | Type |
424
- | ------------- | -------------------------------------------------------------------------------- |
425
- | `claimNeuron` | `({ memo, controller, subaccount, }: SnsClaimNeuronParams) => Promise<NeuronId>` |
426
-
427
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/governance.canister.ts#L399)
428
-
429
- ### :factory: SnsRootCanister
430
-
431
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/root.canister.ts#L10)
432
-
433
- #### Static Methods
434
-
435
- - [create](#gear-create)
436
-
437
- ##### :gear: create
438
-
439
- | Method | Type |
440
- | -------- | ------------------------------------------------------------ |
441
- | `create` | `(options: SnsCanisterOptions<_SERVICE>) => SnsRootCanister` |
442
-
443
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/root.canister.ts#L11)
444
-
445
- #### Methods
446
-
447
- - [listSnsCanisters](#gear-listsnscanisters)
448
-
449
- ##### :gear: listSnsCanisters
450
-
451
- List the canisters that are part of the Sns.
452
-
453
- Source code: https://github.com/dfinity/ic/blob/master/rs/sns/root/src/lib.rs
454
-
455
- | Method | Type |
456
- | ------------------ | ---------------------------------------------------------------------------------------------- |
457
- | `listSnsCanisters` | `({ certified, }: { certified?: boolean or undefined; }) => Promise<ListSnsCanistersResponse>` |
458
-
459
- Parameters:
460
-
461
- - `params.certified`: - Query or update calls
462
-
463
- Returns:
464
-
465
- - A list of canisters ('root' | 'governance' | 'ledger' | 'dapps' | 'swap' | 'archives')
466
-
467
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/root.canister.ts#L32)
468
-
469
- ### :factory: SnsSwapCanister
470
-
471
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L33)
472
-
473
- #### Static Methods
474
-
475
- - [create](#gear-create)
476
-
477
- ##### :gear: create
478
-
479
- | Method | Type |
480
- | -------- | ------------------------------------------------------------ |
481
- | `create` | `(options: SnsCanisterOptions<_SERVICE>) => SnsSwapCanister` |
482
-
483
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L34)
484
-
485
- #### Methods
486
-
487
- - [state](#gear-state)
488
- - [notifyPaymentFailure](#gear-notifypaymentfailure)
489
- - [notifyParticipation](#gear-notifyparticipation)
490
- - [getUserCommitment](#gear-getusercommitment)
491
- - [getDerivedState](#gear-getderivedstate)
492
- - [getSaleParameters](#gear-getsaleparameters)
493
- - [getOpenTicket](#gear-getopenticket)
494
- - [newSaleTicket](#gear-newsaleticket)
495
- - [getLifecycle](#gear-getlifecycle)
496
- - [getFinalizationStatus](#gear-getfinalizationstatus)
497
-
498
- ##### :gear: state
499
-
500
- Get the state of the swap
501
-
502
- | Method | Type |
503
- | ------- | ---------------------------------------------------- |
504
- | `state` | `(params: QueryParams) => Promise<GetStateResponse>` |
505
-
506
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L48)
507
-
508
- ##### :gear: notifyPaymentFailure
509
-
510
- Notify of the payment failure to remove the ticket
511
-
512
- | Method | Type |
513
- | ---------------------- | ------------------------------------ |
514
- | `notifyPaymentFailure` | `() => Promise<Ticket or undefined>` |
515
-
516
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L54)
517
-
518
- ##### :gear: notifyParticipation
519
-
520
- Notify of the user participating in the swap
521
-
522
- | Method | Type |
523
- | --------------------- | ---------------------------------------------------------------------------- |
524
- | `notifyParticipation` | `(params: RefreshBuyerTokensRequest) => Promise<RefreshBuyerTokensResponse>` |
525
-
526
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L64)
527
-
528
- ##### :gear: getUserCommitment
529
-
530
- Get user commitment
531
-
532
- | Method | Type |
533
- | ------------------- | ------------------------------------------------------------------------------------ |
534
- | `getUserCommitment` | `(params: GetBuyerStateRequest and QueryParams) => Promise<BuyerState or undefined>` |
535
-
536
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L72)
537
-
538
- ##### :gear: getDerivedState
539
-
540
- Get sale buyers state
541
-
542
- | Method | Type |
543
- | ----------------- | ------------------------------------------------------------------- |
544
- | `getDerivedState` | `({ certified, }: QueryParams) => Promise<GetDerivedStateResponse>` |
545
-
546
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L84)
547
-
548
- ##### :gear: getSaleParameters
549
-
550
- Get sale parameters
551
-
552
- | Method | Type |
553
- | ------------------- | --------------------------------------------------------------------- |
554
- | `getSaleParameters` | `({ certified, }: QueryParams) => Promise<GetSaleParametersResponse>` |
555
-
556
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L92)
557
-
558
- ##### :gear: getOpenTicket
559
-
560
- Return a sale ticket if created and not yet removed (payment flow)
561
-
562
- | Method | Type |
563
- | --------------- | ------------------------------------------------------- |
564
- | `getOpenTicket` | `(params: QueryParams) => Promise<Ticket or undefined>` |
565
-
566
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L100)
567
-
568
- ##### :gear: newSaleTicket
569
-
570
- Create a sale ticket (payment flow)
571
-
572
- | Method | Type |
573
- | --------------- | -------------------------------------------------- |
574
- | `newSaleTicket` | `(params: NewSaleTicketParams) => Promise<Ticket>` |
575
-
576
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L117)
577
-
578
- ##### :gear: getLifecycle
579
-
580
- Get sale lifecycle state
581
-
582
- | Method | Type |
583
- | -------------- | -------------------------------------------------------- |
584
- | `getLifecycle` | `(params: QueryParams) => Promise<GetLifecycleResponse>` |
585
-
586
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L142)
587
-
588
- ##### :gear: getFinalizationStatus
589
-
590
- Get sale lifecycle state
591
-
592
- | Method | Type |
593
- | ----------------------- | --------------------------------------------------------------------- |
594
- | `getFinalizationStatus` | `(params: QueryParams) => Promise<GetAutoFinalizationStatusResponse>` |
595
-
596
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/swap.canister.ts#L148)
597
-
598
- ### :factory: SnsWrapper
599
-
600
- Sns wrapper - notably used by NNS-dapp - ease the access to a particular Sns.
601
- It knows all the Sns' canisters, wrap and enhance their available features.
602
- A wrapper either performs query or update calls.
603
-
604
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L89)
605
-
606
- #### Constructors
607
-
608
- `public`: Constructor to instantiate a Sns
609
-
610
- Parameters:
611
-
612
- - `__0`
613
-
614
- #### Methods
615
-
616
- - [listNeurons](#gear-listneurons)
617
- - [listProposals](#gear-listproposals)
618
- - [getProposal](#gear-getproposal)
619
- - [listNervousSystemFunctions](#gear-listnervoussystemfunctions)
620
- - [metadata](#gear-metadata)
621
- - [nervousSystemParameters](#gear-nervoussystemparameters)
622
- - [ledgerMetadata](#gear-ledgermetadata)
623
- - [transactionFee](#gear-transactionfee)
624
- - [totalTokensSupply](#gear-totaltokenssupply)
625
- - [balance](#gear-balance)
626
- - [transfer](#gear-transfer)
627
- - [getNeuron](#gear-getneuron)
628
- - [queryNeuron](#gear-queryneuron)
629
- - [nextNeuronAccount](#gear-nextneuronaccount)
630
- - [stakeNeuron](#gear-stakeneuron)
631
- - [increaseStakeNeuron](#gear-increasestakeneuron)
632
- - [getNeuronBalance](#gear-getneuronbalance)
633
- - [addNeuronPermissions](#gear-addneuronpermissions)
634
- - [refreshNeuron](#gear-refreshneuron)
635
- - [claimNeuron](#gear-claimneuron)
636
- - [removeNeuronPermissions](#gear-removeneuronpermissions)
637
- - [splitNeuron](#gear-splitneuron)
638
- - [disburse](#gear-disburse)
639
- - [startDissolving](#gear-startdissolving)
640
- - [stopDissolving](#gear-stopdissolving)
641
- - [setDissolveTimestamp](#gear-setdissolvetimestamp)
642
- - [increaseDissolveDelay](#gear-increasedissolvedelay)
643
- - [setTopicFollowees](#gear-settopicfollowees)
644
- - [setFollowing](#gear-setfollowing)
645
- - [registerVote](#gear-registervote)
646
- - [swapState](#gear-swapstate)
647
- - [notifyPaymentFailure](#gear-notifypaymentfailure)
648
- - [notifyParticipation](#gear-notifyparticipation)
649
- - [getUserCommitment](#gear-getusercommitment)
650
- - [getOpenTicket](#gear-getopenticket)
651
- - [newSaleTicket](#gear-newsaleticket)
652
- - [getLifecycle](#gear-getlifecycle)
653
- - [getFinalizationStatus](#gear-getfinalizationstatus)
654
- - [getSaleParameters](#gear-getsaleparameters)
655
- - [getDerivedState](#gear-getderivedstate)
656
- - [getTransactions](#gear-gettransactions)
657
- - [stakeMaturity](#gear-stakematurity)
658
- - [disburseMaturity](#gear-disbursematurity)
659
- - [autoStakeMaturity](#gear-autostakematurity)
660
-
661
- ##### :gear: listNeurons
662
-
663
- | Method | Type |
664
- | ------------- | ------------------------------------------------------------------------ |
665
- | `listNeurons` | `(params: Omit<SnsListNeuronsParams, "certified">) => Promise<Neuron[]>` |
666
-
667
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L135)
668
-
669
- ##### :gear: listProposals
670
-
671
- | Method | Type |
672
- | --------------- | --------------------------------------------------------------------------------------- |
673
- | `listProposals` | `(params: Omit<SnsListProposalsParams, "certified">) => Promise<ListProposalsResponse>` |
674
-
675
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L139)
676
-
677
- ##### :gear: getProposal
678
-
679
- | Method | Type |
680
- | ------------- | ---------------------------------------------------------------------------- |
681
- | `getProposal` | `(params: Omit<SnsGetProposalParams, "certified">) => Promise<ProposalData>` |
682
-
683
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L144)
684
-
685
- ##### :gear: listNervousSystemFunctions
686
-
687
- | Method | Type |
688
- | ---------------------------- | ----------------------------------------------------------------------------------------- |
689
- | `listNervousSystemFunctions` | `(params: Omit<QueryParams, "certified">) => Promise<ListNervousSystemFunctionsResponse>` |
690
-
691
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L149)
692
-
693
- ##### :gear: metadata
694
-
695
- | Method | Type |
696
- | ---------- | ------------------------------------------------------------------------------------------------------- |
697
- | `metadata` | `(params: Omit<QueryParams, "certified">) => Promise<[GetMetadataResponse, IcrcTokenMetadataResponse]>` |
698
-
699
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L154)
700
-
701
- ##### :gear: nervousSystemParameters
702
-
703
- | Method | Type |
704
- | ------------------------- | ------------------------------------------------------------------------------ |
705
- | `nervousSystemParameters` | `(params: Omit<QueryParams, "certified">) => Promise<NervousSystemParameters>` |
706
-
707
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L162)
708
-
709
- ##### :gear: ledgerMetadata
710
-
711
- | Method | Type |
712
- | ---------------- | -------------------------------------------------------------------------------- |
713
- | `ledgerMetadata` | `(params: Omit<QueryParams, "certified">) => Promise<IcrcTokenMetadataResponse>` |
714
-
715
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L167)
716
-
717
- ##### :gear: transactionFee
718
-
719
- | Method | Type |
720
- | ---------------- | ------------------------------------------------------------- |
721
- | `transactionFee` | `(params: Omit<QueryParams, "certified">) => Promise<bigint>` |
722
-
723
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L172)
724
-
725
- ##### :gear: totalTokensSupply
726
-
727
- | Method | Type |
728
- | ------------------- | ------------------------------------------------------------- |
729
- | `totalTokensSupply` | `(params: Omit<QueryParams, "certified">) => Promise<bigint>` |
730
-
731
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L177)
732
-
733
- ##### :gear: balance
734
-
735
- | Method | Type |
736
- | --------- | --------------------------------------------------------------- |
737
- | `balance` | `(params: Omit<BalanceParams, "certified">) => Promise<bigint>` |
738
-
739
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L182)
740
-
741
- ##### :gear: transfer
742
-
743
- | Method | Type |
744
- | ---------- | --------------------------------------------- |
745
- | `transfer` | `(params: TransferParams) => Promise<bigint>` |
746
-
747
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L186)
748
-
749
- ##### :gear: getNeuron
750
-
751
- | Method | Type |
752
- | ----------- | -------------------------------------------------------------------- |
753
- | `getNeuron` | `(params: Omit<SnsGetNeuronParams, "certified">) => Promise<Neuron>` |
754
-
755
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L189)
756
-
757
- ##### :gear: queryNeuron
758
-
759
- | Method | Type |
760
- | ------------- | --------------------------------------------------------------------------------- |
761
- | `queryNeuron` | `(params: Omit<SnsGetNeuronParams, "certified">) => Promise<Neuron or undefined>` |
762
-
763
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L193)
764
-
765
- ##### :gear: nextNeuronAccount
766
-
767
- Returns the subaccount of the next neuron to be created.
768
-
769
- The neuron account is a subaccount of the governance canister.
770
- The subaccount is derived from the controller and an ascending index.
771
-
772
- ‼️ The id of the neuron is the subaccount (neuron ID = subaccount) ‼️.
773
-
774
- If the neuron does not exist for that subaccount, then we use it for the next neuron.
775
-
776
- The index is used in the memo of the transfer and when claiming the neuron.
777
- This is how the backend can identify which neuron is being claimed.
778
-
779
- | Method | Type |
780
- | ------------------- | ------------------------------------------------------------------------------ |
781
- | `nextNeuronAccount` | `(controller: Principal) => Promise<{ account: IcrcAccount; index: bigint; }>` |
782
-
783
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L214)
784
-
785
- ##### :gear: stakeNeuron
786
-
787
- Stakes a neuron.
788
-
789
- This is a convenient method that transfers the stake to the neuron subaccount and then claims the neuron.
790
-
791
- ⚠️ This feature is provided as it without warranty. It does not implement any additional checks of the validity of the payment flow - e.g. it does not handle refund nor retries claiming the neuron in case of errors.
792
-
793
- | Method | Type |
794
- | ------------- | ------------------------------------------------------------------------------------------------ |
795
- | `stakeNeuron` | `({ stakeE8s, source, controller, createdAt, fee, }: SnsStakeNeuronParams) => Promise<NeuronId>` |
796
-
797
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L261)
798
-
799
- ##### :gear: increaseStakeNeuron
800
-
801
- Increase the stake of a neuron.
802
-
803
- This is a convenient method that transfers the stake to the neuron subaccount and then refresh the neuron.
804
-
805
- ⚠️ This feature is provided as it without warranty. It does not implement any additional checks of the validity of the payment flow - e.g. it does not handle refund nor calls refresh again in case of errors.
806
-
807
- | Method | Type |
808
- | --------------------- | ---------------------------------------------------------------------------------- |
809
- | `increaseStakeNeuron` | `({ stakeE8s, source, neuronId, }: SnsIncreaseStakeNeuronParams) => Promise<void>` |
810
-
811
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L308)
812
-
813
- ##### :gear: getNeuronBalance
814
-
815
- | Method | Type |
816
- | ------------------ | ----------------------------------------- |
817
- | `getNeuronBalance` | `(neuronId: NeuronId) => Promise<bigint>` |
818
-
819
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L327)
820
-
821
- ##### :gear: addNeuronPermissions
822
-
823
- | Method | Type |
824
- | ---------------------- | ------------------------------------------------------- |
825
- | `addNeuronPermissions` | `(params: SnsNeuronPermissionsParams) => Promise<void>` |
826
-
827
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L336)
828
-
829
- ##### :gear: refreshNeuron
830
-
831
- | Method | Type |
832
- | --------------- | --------------------------------------- |
833
- | `refreshNeuron` | `(neuronId: NeuronId) => Promise<void>` |
834
-
835
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L340)
836
-
837
- ##### :gear: claimNeuron
838
-
839
- | Method | Type |
840
- | ------------- | ----------------------------------------------------- |
841
- | `claimNeuron` | `(params: SnsClaimNeuronParams) => Promise<NeuronId>` |
842
-
843
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L344)
844
-
845
- ##### :gear: removeNeuronPermissions
846
-
847
- | Method | Type |
848
- | ------------------------- | ------------------------------------------------------- |
849
- | `removeNeuronPermissions` | `(params: SnsNeuronPermissionsParams) => Promise<void>` |
850
-
851
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L348)
852
-
853
- ##### :gear: splitNeuron
854
-
855
- | Method | Type |
856
- | ------------- | ------------------------------------------------------------------ |
857
- | `splitNeuron` | `(params: SnsSplitNeuronParams) => Promise<NeuronId or undefined>` |
858
-
859
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L353)
860
-
861
- ##### :gear: disburse
862
-
863
- | Method | Type |
864
- | ---------- | ---------------------------------------------------- |
865
- | `disburse` | `(params: SnsDisburseNeuronParams) => Promise<void>` |
866
-
867
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L357)
868
-
869
- ##### :gear: startDissolving
870
-
871
- | Method | Type |
872
- | ----------------- | --------------------------------------- |
873
- | `startDissolving` | `(neuronId: NeuronId) => Promise<void>` |
874
-
875
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L361)
876
-
877
- ##### :gear: stopDissolving
878
-
879
- | Method | Type |
880
- | ---------------- | --------------------------------------- |
881
- | `stopDissolving` | `(neuronId: NeuronId) => Promise<void>` |
882
-
883
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L365)
884
-
885
- ##### :gear: setDissolveTimestamp
886
-
887
- | Method | Type |
888
- | ---------------------- | ---------------------------------------------------------- |
889
- | `setDissolveTimestamp` | `(params: SnsSetDissolveTimestampParams) => Promise<void>` |
890
-
891
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L369)
892
-
893
- ##### :gear: increaseDissolveDelay
894
-
895
- | Method | Type |
896
- | ----------------------- | ----------------------------------------------------------- |
897
- | `increaseDissolveDelay` | `(params: SnsIncreaseDissolveDelayParams) => Promise<void>` |
898
-
899
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L374)
900
-
901
- ##### :gear: setTopicFollowees
902
-
903
- | Method | Type |
904
- | ------------------- | ------------------------------------------------- |
905
- | `setTopicFollowees` | `(params: SnsSetTopicFollowees) => Promise<void>` |
906
-
907
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L379)
908
-
909
- ##### :gear: setFollowing
910
-
911
- | Method | Type |
912
- | -------------- | -------------------------------------------------- |
913
- | `setFollowing` | `(params: SnsSetFollowingParams) => Promise<void>` |
914
-
915
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L383)
916
-
917
- ##### :gear: registerVote
918
-
919
- | Method | Type |
920
- | -------------- | -------------------------------------------------- |
921
- | `registerVote` | `(params: SnsRegisterVoteParams) => Promise<void>` |
922
-
923
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L387)
924
-
925
- ##### :gear: swapState
926
-
927
- | Method | Type |
928
- | ----------- | ----------------------------------------------------------------------- |
929
- | `swapState` | `(params: Omit<QueryParams, "certified">) => Promise<GetStateResponse>` |
930
-
931
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L390)
932
-
933
- ##### :gear: notifyPaymentFailure
934
-
935
- Returns the ticket if a ticket was found for the caller and the ticket
936
- was removed successfully. Returns None if no ticket was found for the caller.
937
- Only the owner of a ticket can remove it.
938
-
939
- Always certified
940
-
941
- | Method | Type |
942
- | ---------------------- | ------------------------------------ |
943
- | `notifyPaymentFailure` | `() => Promise<Ticket or undefined>` |
944
-
945
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L403)
946
-
947
- ##### :gear: notifyParticipation
948
-
949
- | Method | Type |
950
- | --------------------- | ---------------------------------------------------------------------------- |
951
- | `notifyParticipation` | `(params: RefreshBuyerTokensRequest) => Promise<RefreshBuyerTokensResponse>` |
952
-
953
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L407)
954
-
955
- ##### :gear: getUserCommitment
956
-
957
- | Method | Type |
958
- | ------------------- | -------------------------------------------------------------------- |
959
- | `getUserCommitment` | `(params: GetBuyerStateRequest) => Promise<BuyerState or undefined>` |
960
-
961
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L412)
962
-
963
- ##### :gear: getOpenTicket
964
-
965
- | Method | Type |
966
- | --------------- | -------------------------------------------------------------------------- |
967
- | `getOpenTicket` | `(params: Omit<QueryParams, "certified">) => Promise<Ticket or undefined>` |
968
-
969
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L417)
970
-
971
- ##### :gear: newSaleTicket
972
-
973
- | Method | Type |
974
- | --------------- | -------------------------------------------------- |
975
- | `newSaleTicket` | `(params: NewSaleTicketParams) => Promise<Ticket>` |
976
-
977
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L423)
978
-
979
- ##### :gear: getLifecycle
980
-
981
- | Method | Type |
982
- | -------------- | ---------------------------------------------------------------------------------------- |
983
- | `getLifecycle` | `(params: Omit<QueryParams, "certified">) => Promise<GetLifecycleResponse or undefined>` |
984
-
985
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L426)
986
-
987
- ##### :gear: getFinalizationStatus
988
-
989
- | Method | Type |
990
- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
991
- | `getFinalizationStatus` | `(params: Omit<QueryParams, "certified">) => Promise<GetAutoFinalizationStatusResponse or undefined>` |
992
-
993
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L431)
994
-
995
- ##### :gear: getSaleParameters
996
-
997
- | Method | Type |
998
- | ------------------- | --------------------------------------------------------------------------------------------- |
999
- | `getSaleParameters` | `(params: Omit<QueryParams, "certified">) => Promise<GetSaleParametersResponse or undefined>` |
1000
-
1001
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L436)
1002
-
1003
- ##### :gear: getDerivedState
1004
-
1005
- | Method | Type |
1006
- | ----------------- | ------------------------------------------------------------------------------------------- |
1007
- | `getDerivedState` | `(params: Omit<QueryParams, "certified">) => Promise<GetDerivedStateResponse or undefined>` |
1008
-
1009
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L441)
1010
-
1011
- ##### :gear: getTransactions
1012
-
1013
- | Method | Type |
1014
- | ----------------- | -------------------------------------------------------------------- |
1015
- | `getTransactions` | `(params: GetAccountTransactionsParams) => Promise<GetTransactions>` |
1016
-
1017
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L447)
1018
-
1019
- ##### :gear: stakeMaturity
1020
-
1021
- | Method | Type |
1022
- | --------------- | --------------------------------------------------------- |
1023
- | `stakeMaturity` | `(params: SnsNeuronStakeMaturityParams) => Promise<void>` |
1024
-
1025
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L452)
1026
-
1027
- ##### :gear: disburseMaturity
1028
-
1029
- | Method | Type |
1030
- | ------------------ | ------------------------------------------------------------ |
1031
- | `disburseMaturity` | `(params: SnsNeuronDisburseMaturityParams) => Promise<void>` |
1032
-
1033
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L456)
1034
-
1035
- ##### :gear: autoStakeMaturity
1036
-
1037
- | Method | Type |
1038
- | ------------------- | ------------------------------------------------------------- |
1039
- | `autoStakeMaturity` | `(params: SnsNeuronAutoStakeMaturityParams) => Promise<void>` |
1040
-
1041
- [:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/sns/src/sns.wrapper.ts#L460)
84
+ ## Documentation
1042
85
 
1043
- <!-- TSDOC_END -->
86
+ You can find the API docs [here](https://js.icp.build/canisters/latest/api/sns/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/sns",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "A library for interfacing with a Service Nervous System (SNS) project.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",