@dfinity/nns 0.7.0-nightly-2022-08-08.1 → 0.7.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 (52) hide show
  1. package/README.md +580 -7
  2. package/dist/candid/sns_wasm.certified.idl.js +1 -0
  3. package/dist/candid/sns_wasm.d.ts +1 -0
  4. package/dist/candid/sns_wasm.did +2 -1
  5. package/dist/candid/sns_wasm.idl.js +1 -0
  6. package/dist/cjs/index.cjs.js +9 -9
  7. package/dist/cjs/index.cjs.js.map +3 -3
  8. package/dist/esm/account_identifier.js +1 -1
  9. package/dist/esm/{chunk-N4C3FQZJ.js → chunk-EBY4MEUW.js} +5 -5
  10. package/dist/esm/{chunk-N4C3FQZJ.js.map → chunk-EBY4MEUW.js.map} +3 -3
  11. package/dist/esm/chunk-IL4SIX75.js +2 -0
  12. package/dist/esm/chunk-IL4SIX75.js.map +7 -0
  13. package/dist/esm/chunk-LBNBEXHT.js +2 -0
  14. package/dist/esm/chunk-LBNBEXHT.js.map +7 -0
  15. package/dist/esm/chunk-LWTBV6PO.js +2 -0
  16. package/dist/esm/chunk-LWTBV6PO.js.map +7 -0
  17. package/dist/esm/chunk-MM4DMXZG.js +2 -0
  18. package/dist/esm/chunk-MM4DMXZG.js.map +7 -0
  19. package/dist/esm/{chunk-QSF4NTRI.js → chunk-SXX75EEC.js} +3 -3
  20. package/dist/esm/{chunk-QSF4NTRI.js.map → chunk-SXX75EEC.js.map} +2 -2
  21. package/dist/esm/chunk-WMBK2I6I.js +2 -0
  22. package/dist/esm/chunk-WMBK2I6I.js.map +7 -0
  23. package/dist/esm/governance.canister.js +1 -1
  24. package/dist/esm/icp.js +1 -1
  25. package/dist/esm/index.js +1 -1
  26. package/dist/esm/index.js.map +2 -2
  27. package/dist/esm/ledger.canister.js +1 -1
  28. package/dist/esm/sns_wasm.canister.js +1 -1
  29. package/dist/esm/token.js +2 -0
  30. package/dist/esm/token.js.map +7 -0
  31. package/dist/types/account_identifier.d.ts +2 -0
  32. package/dist/types/canisters/governance/request.converters.d.ts +9 -3
  33. package/dist/types/constants/constants.d.ts +2 -1
  34. package/dist/types/enums/governance.enums.d.ts +74 -0
  35. package/dist/types/enums/token.enums.d.ts +4 -0
  36. package/dist/types/errors/governance.errors.d.ts +2 -3
  37. package/dist/types/errors/ledger.errors.d.ts +2 -3
  38. package/dist/types/governance.canister.d.ts +28 -4
  39. package/dist/types/icp.d.ts +8 -2
  40. package/dist/types/index.d.ts +3 -1
  41. package/dist/types/ledger.canister.d.ts +1 -2
  42. package/dist/types/token.d.ts +74 -0
  43. package/dist/types/types/governance_converters.d.ts +1 -41
  44. package/dist/types/types/ledger_converters.d.ts +1 -2
  45. package/package.json +3 -3
  46. package/dist/esm/chunk-6TCASUZN.js +0 -2
  47. package/dist/esm/chunk-6TCASUZN.js.map +0 -7
  48. package/dist/esm/chunk-BNACMCFC.js +0 -2
  49. package/dist/esm/chunk-BNACMCFC.js.map +0 -7
  50. package/dist/esm/chunk-FOZZBZOX.js +0 -2
  51. package/dist/esm/chunk-FOZZBZOX.js.map +0 -7
  52. package/dist/types/types/icp.d.ts +0 -4
package/README.md CHANGED
@@ -1,10 +1,39 @@
1
1
  # nns-js
2
2
 
3
- A library for interfacing with the ledger and governance canisters of the Internet Computer's Network Nervous System.
3
+ A library for interfacing with the Internet Computer's Network Nervous System.
4
4
 
5
- This library is still in active development, and new features will incrementally be available.
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
- ## Example Usage
7
+ ## Table of contents
8
+
9
+ - [Installation](#installation)
10
+ - [Usage](#usage)
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
+
20
+ ## Installation
21
+
22
+ You can use `nns-js` by installing it in your project.
23
+
24
+ ```bash
25
+ npm i @dfinity/nns
26
+ ```
27
+
28
+ The bundle needs peer dependencies, be sure that following resources are available in your project as well.
29
+
30
+ ```bash
31
+ npm i @dfinity/agent @dfinity/candid @dfinity/principal @dfinity/utils
32
+ ```
33
+
34
+ ## Usage
35
+
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:
8
37
 
9
38
  ```ts
10
39
  import { AccountIdentifier, LedgerCanister } from "@dfinity/nns";
@@ -13,7 +42,7 @@ import { AccountIdentifier, LedgerCanister } from "@dfinity/nns";
13
42
  import fetch from "cross-fetch";
14
43
  global.fetch = fetch;
15
44
 
16
- async function main() {
45
+ const main = async () => {
17
46
  const ledger = LedgerCanister.create();
18
47
 
19
48
  const accountIdentifier = AccountIdentifier.fromHex(
@@ -23,9 +52,553 @@ async function main() {
23
52
  const balance = await ledger.accountBalance({ accountIdentifier });
24
53
 
25
54
  console.log(`Balance: ${balance.toE8s()}`);
26
- }
55
+ };
27
56
 
28
- main();
57
+ await main();
29
58
  ```
30
59
 
31
- # [How-To](/HACKING.md)
60
+ ## Features
61
+
62
+ `nns-js` implements following features:
63
+
64
+ <!-- TSDOC_START -->
65
+
66
+ ### :toolbox: Functions
67
+
68
+ - [convertStringToE8s](#gear-convertstringtoe8s)
69
+
70
+ #### :gear: convertStringToE8s
71
+
72
+ Receives a string representing a number and returns the big int or error.
73
+
74
+ | Function | Type |
75
+ | -------------------- | ------------------------------------------------------ |
76
+ | `convertStringToE8s` | `(amount: string) => bigint or FromStringToTokenError` |
77
+
78
+ Parameters:
79
+
80
+ - `amount`: - in string format
81
+
82
+ ### :wrench: Constants
83
+
84
+ - [ICPToken](#gear-icptoken)
85
+
86
+ #### :gear: ICPToken
87
+
88
+ | Constant | Type |
89
+ | ---------- | ------- |
90
+ | `ICPToken` | `Token` |
91
+
92
+ ### :factory: AccountIdentifier
93
+
94
+ #### Methods
95
+
96
+ - [fromHex](#gear-fromhex)
97
+ - [fromPrincipal](#gear-fromprincipal)
98
+ - [toProto](#gear-toproto)
99
+ - [toHex](#gear-tohex)
100
+ - [toUint8Array](#gear-touint8array)
101
+ - [toNumbers](#gear-tonumbers)
102
+
103
+ ##### :gear: fromHex
104
+
105
+ | Method | Type |
106
+ | --------- | ------------------------------------ |
107
+ | `fromHex` | `(hex: string) => AccountIdentifier` |
108
+
109
+ ##### :gear: fromPrincipal
110
+
111
+ | Method | Type |
112
+ | --------------- | ------------------------------------------------------------------------------------------------------- |
113
+ | `fromPrincipal` | `({ principal, subAccount, }: { principal: Principal; subAccount?: SubAccount; }) => AccountIdentifier` |
114
+
115
+ ##### :gear: toProto
116
+
117
+ | Method | Type |
118
+ | --------- | ------------------------- |
119
+ | `toProto` | `() => AccountIdentifier` |
120
+
121
+ ##### :gear: toHex
122
+
123
+ | Method | Type |
124
+ | ------- | -------------- |
125
+ | `toHex` | `() => string` |
126
+
127
+ ##### :gear: toUint8Array
128
+
129
+ | Method | Type |
130
+ | -------------- | ------------------ |
131
+ | `toUint8Array` | `() => Uint8Array` |
132
+
133
+ ##### :gear: toNumbers
134
+
135
+ | Method | Type |
136
+ | ----------- | ---------------- |
137
+ | `toNumbers` | `() => number[]` |
138
+
139
+ ### :factory: SubAccount
140
+
141
+ #### Methods
142
+
143
+ - [fromBytes](#gear-frombytes)
144
+ - [fromPrincipal](#gear-fromprincipal)
145
+ - [fromID](#gear-fromid)
146
+ - [toUint8Array](#gear-touint8array)
147
+
148
+ ##### :gear: fromBytes
149
+
150
+ | Method | Type |
151
+ | ----------- | -------------------------------------------- |
152
+ | `fromBytes` | `(bytes: Uint8Array) => SubAccount or Error` |
153
+
154
+ ##### :gear: fromPrincipal
155
+
156
+ | Method | Type |
157
+ | --------------- | -------------------------------------- |
158
+ | `fromPrincipal` | `(principal: Principal) => SubAccount` |
159
+
160
+ ##### :gear: fromID
161
+
162
+ | Method | Type |
163
+ | -------- | ---------------------------- |
164
+ | `fromID` | `(id: number) => SubAccount` |
165
+
166
+ ##### :gear: toUint8Array
167
+
168
+ | Method | Type |
169
+ | -------------- | ------------------ |
170
+ | `toUint8Array` | `() => Uint8Array` |
171
+
172
+ ### :factory: GenesisTokenCanister
173
+
174
+ #### Methods
175
+
176
+ - [create](#gear-create)
177
+ - [claimNeurons](#gear-claimneurons)
178
+
179
+ ##### :gear: create
180
+
181
+ | Method | Type |
182
+ | -------- | --------------------------------------------------------------- |
183
+ | `create` | `(options?: CanisterOptions<_SERVICE>) => GenesisTokenCanister` |
184
+
185
+ ##### :gear: claimNeurons
186
+
187
+ | Method | Type |
188
+ | -------------- | --------------------------------------------------------------- |
189
+ | `claimNeurons` | `({ hexPubKey, }: { hexPubKey: string; }) => Promise<bigint[]>` |
190
+
191
+ ### :factory: TokenAmount
192
+
193
+ Represents an amount of tokens.
194
+
195
+ #### Methods
196
+
197
+ - [fromE8s](#gear-frome8s)
198
+ - [fromString](#gear-fromstring)
199
+ - [fromNumber](#gear-fromnumber)
200
+ - [toE8s](#gear-toe8s)
201
+ - [toProto](#gear-toproto)
202
+
203
+ ##### :gear: fromE8s
204
+
205
+ Initialize from a bigint. Bigint are considered e8s.
206
+
207
+ | Method | Type |
208
+ | --------- | ------------------------------------------------------------------------- |
209
+ | `fromE8s` | `({ amount, token, }: { amount: bigint; token?: Token; }) => TokenAmount` |
210
+
211
+ Parameters:
212
+
213
+ - `params.amount`: The amount in bigint format.
214
+ - `params.token`: The token type.
215
+
216
+ ##### :gear: fromString
217
+
218
+ Initialize from a string. Accepted formats:
219
+
220
+ 1234567.8901
221
+ 1'234'567.8901
222
+ 1,234,567.8901
223
+
224
+ | Method | Type |
225
+ | ------------ | --------------------------------------------------------------------------------------------------- |
226
+ | `fromString` | `({ amount, token, }: { amount: string; token?: Token; }) => FromStringToTokenError or TokenAmount` |
227
+
228
+ Parameters:
229
+
230
+ - `params.amount`: The amount in string format.
231
+ - `params.token`: The token type.
232
+
233
+ ##### :gear: fromNumber
234
+
235
+ Initialize from a number.
236
+
237
+ 1 integer is considered E8S_PER_TOKEN
238
+
239
+ | Method | Type |
240
+ | ------------ | --------------------------------------------------------------------------------------------------- |
241
+ | `fromNumber` | `({ amount, token, }: { amount: number; token?: Token; }) => FromStringToTokenError or TokenAmount` |
242
+
243
+ Parameters:
244
+
245
+ - `params.amount`: The amount in number format.
246
+ - `params.token`: The token type.
247
+
248
+ ##### :gear: toE8s
249
+
250
+ | Method | Type |
251
+ | ------- | -------------- |
252
+ | `toE8s` | `() => bigint` |
253
+
254
+ ##### :gear: toProto
255
+
256
+ TODO: Remove this method when ICP class is not used anymore
257
+
258
+ | Method | Type |
259
+ | --------- | ------------- |
260
+ | `toProto` | `() => ICPTs` |
261
+
262
+ ### :factory: LedgerCanister
263
+
264
+ #### Methods
265
+
266
+ - [create](#gear-create)
267
+ - [accountBalance](#gear-accountbalance)
268
+ - [transactionFee](#gear-transactionfee)
269
+ - [transfer](#gear-transfer)
270
+
271
+ ##### :gear: create
272
+
273
+ | Method | Type |
274
+ | -------- | ----------------------------------------------------- |
275
+ | `create` | `(options?: LedgerCanisterOptions) => LedgerCanister` |
276
+
277
+ ##### :gear: accountBalance
278
+
279
+ Returns the balance of the specified account identifier.
280
+
281
+ If `certified` is true, the request is fetched as an update call, otherwise
282
+ it is fetched using a query call.
283
+
284
+ | Method | Type |
285
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
286
+ | `accountBalance` | `({ accountIdentifier, certified, }: { accountIdentifier: AccountIdentifier; certified?: boolean; }) => Promise<bigint>` |
287
+
288
+ ##### :gear: transactionFee
289
+
290
+ Returns the transaction fee of the ledger canister
291
+
292
+ | Method | Type |
293
+ | ---------------- | ----------------------- |
294
+ | `transactionFee` | `() => Promise<bigint>` |
295
+
296
+ ##### :gear: transfer
297
+
298
+ Transfer ICP from the caller to the destination `accountIdentifier`.
299
+ Returns the index of the block containing the tx if it was successful.
300
+
301
+ | Method | Type |
302
+ | ---------- | ----------------------------------------------- |
303
+ | `transfer` | `(request: TransferRequest) => Promise<bigint>` |
304
+
305
+ ### :factory: GovernanceCanister
306
+
307
+ #### Methods
308
+
309
+ - [create](#gear-create)
310
+ - [listNeurons](#gear-listneurons)
311
+ - [listKnownNeurons](#gear-listknownneurons)
312
+ - [listProposals](#gear-listproposals)
313
+ - [stakeNeuron](#gear-stakeneuron)
314
+ - [increaseDissolveDelay](#gear-increasedissolvedelay)
315
+ - [startDissolving](#gear-startdissolving)
316
+ - [stopDissolving](#gear-stopdissolving)
317
+ - [joinCommunityFund](#gear-joincommunityfund)
318
+ - [leaveCommunityFund](#gear-leavecommunityfund)
319
+ - [mergeNeurons](#gear-mergeneurons)
320
+ - [splitNeuron](#gear-splitneuron)
321
+ - [getProposal](#gear-getproposal)
322
+ - [makeProposal](#gear-makeproposal)
323
+ - [registerVote](#gear-registervote)
324
+ - [setFollowees](#gear-setfollowees)
325
+ - [disburse](#gear-disburse)
326
+ - [mergeMaturity](#gear-mergematurity)
327
+ - [spawnNeuron](#gear-spawnneuron)
328
+ - [addHotkey](#gear-addhotkey)
329
+ - [removeHotkey](#gear-removehotkey)
330
+ - [claimOrRefreshNeuronFromAccount](#gear-claimorrefreshneuronfromaccount)
331
+ - [claimOrRefreshNeuron](#gear-claimorrefreshneuron)
332
+ - [getNeuron](#gear-getneuron)
333
+
334
+ ##### :gear: create
335
+
336
+ | Method | Type |
337
+ | -------- | ------------------------------------------------------------- |
338
+ | `create` | `(options?: GovernanceCanisterOptions) => GovernanceCanister` |
339
+
340
+ ##### :gear: listNeurons
341
+
342
+ Returns the list of neurons controlled by the caller.
343
+
344
+ If an array of neuron IDs is provided, precisely those neurons will be fetched.
345
+
346
+ If `certified` is true, the request is fetched as an update call, otherwise
347
+ it is fetched using a query call.
348
+
349
+ | Method | Type |
350
+ | ------------- | ----------------------------------------------------------------------------------------------------- |
351
+ | `listNeurons` | `({ certified, neuronIds, }: { certified: boolean; neuronIds?: bigint[]; }) => Promise<NeuronInfo[]>` |
352
+
353
+ ##### :gear: listKnownNeurons
354
+
355
+ Returns the list of neurons who have been approved by the community to
356
+ appear as the default followee options.
357
+
358
+ If `certified` is true, the request is fetched as an update call, otherwise
359
+ it is fetched using a query call.
360
+
361
+ | Method | Type |
362
+ | ------------------ | ------------------------------------------------- |
363
+ | `listKnownNeurons` | `(certified?: boolean) => Promise<KnownNeuron[]>` |
364
+
365
+ ##### :gear: listProposals
366
+
367
+ Returns the list of proposals made for the community to vote on,
368
+ paginated and filtered by the request.
369
+
370
+ If `certified` is true (default), the request is fetched as an update call, otherwise
371
+ it is fetched using a query call.
372
+
373
+ | Method | Type |
374
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------- |
375
+ | `listProposals` | `({ request, certified, }: { request: ListProposalsRequest; certified?: boolean; }) => Promise<ListProposalsResponse>` |
376
+
377
+ Parameters:
378
+
379
+ - `request`: the options to list the proposals (limit number of results, topics to search for, etc.)
380
+ - `certified`: query or update calls
381
+
382
+ ##### :gear: stakeNeuron
383
+
384
+ | Method | Type |
385
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
386
+ | `stakeNeuron` | `({ stake, principal, fromSubAccount, ledgerCanister, }: { stake: bigint; principal: Principal; fromSubAccount?: number[]; ledgerCanister: LedgerCanister; }) => Promise<bigint>` |
387
+
388
+ ##### :gear: increaseDissolveDelay
389
+
390
+ Increases dissolve delay of a neuron
391
+
392
+ | Method | Type |
393
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
394
+ | `increaseDissolveDelay` | `({ neuronId, additionalDissolveDelaySeconds, }: { neuronId: bigint; additionalDissolveDelaySeconds: number; }) => Promise<void>` |
395
+
396
+ ##### :gear: startDissolving
397
+
398
+ Start dissolving process of a neuron
399
+
400
+ | Method | Type |
401
+ | ----------------- | ------------------------------------- |
402
+ | `startDissolving` | `(neuronId: bigint) => Promise<void>` |
403
+
404
+ ##### :gear: stopDissolving
405
+
406
+ Stop dissolving process of a neuron
407
+
408
+ | Method | Type |
409
+ | ---------------- | ------------------------------------- |
410
+ | `stopDissolving` | `(neuronId: bigint) => Promise<void>` |
411
+
412
+ ##### :gear: joinCommunityFund
413
+
414
+ Neuron joins the community fund
415
+
416
+ | Method | Type |
417
+ | ------------------- | ------------------------------------- |
418
+ | `joinCommunityFund` | `(neuronId: bigint) => Promise<void>` |
419
+
420
+ ##### :gear: leaveCommunityFund
421
+
422
+ Neuron leaves the community fund
423
+
424
+ | Method | Type |
425
+ | -------------------- | ------------------------------------- |
426
+ | `leaveCommunityFund` | `(neuronId: bigint) => Promise<void>` |
427
+
428
+ ##### :gear: mergeNeurons
429
+
430
+ Merge two neurons
431
+
432
+ | Method | Type |
433
+ | -------------- | --------------------------------------------------------------------------------- |
434
+ | `mergeNeurons` | `(request: { sourceNeuronId: bigint; targetNeuronId: bigint; }) => Promise<void>` |
435
+
436
+ ##### :gear: splitNeuron
437
+
438
+ Splits a neuron creating a new one
439
+
440
+ | Method | Type |
441
+ | ------------- | ----------------------------------------------------------------------------------- |
442
+ | `splitNeuron` | `({ neuronId, amount, }: { neuronId: bigint; amount: bigint; }) => Promise<bigint>` |
443
+
444
+ ##### :gear: getProposal
445
+
446
+ Returns single proposal info
447
+
448
+ If `certified` is true (default), the request is fetched as an update call, otherwise
449
+ it is fetched using a query call.
450
+
451
+ | Method | Type |
452
+ | ------------- | ----------------------------------------------------------------------------------------------------- |
453
+ | `getProposal` | `({ proposalId, certified, }: { proposalId: bigint; certified?: boolean; }) => Promise<ProposalInfo>` |
454
+
455
+ ##### :gear: makeProposal
456
+
457
+ Create new proposal
458
+
459
+ | Method | Type |
460
+ | -------------- | ------------------------------------------------- |
461
+ | `makeProposal` | `(request: MakeProposalRequest) => Promise<void>` |
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
+ ##### :gear: setFollowees
472
+
473
+ Edit neuron followees per topic
474
+
475
+ | Method | Type |
476
+ | -------------- | ------------------------------------------------- |
477
+ | `setFollowees` | `(followRequest: FollowRequest) => Promise<void>` |
478
+
479
+ ##### :gear: disburse
480
+
481
+ Disburse neuron on Account
482
+
483
+ | Method | Type |
484
+ | ---------- | --------------------------------------------------------------------------------------------------------------------- |
485
+ | `disburse` | `({ neuronId, toAccountId, amount, }: { neuronId: bigint; toAccountId?: string; amount?: bigint; }) => Promise<void>` |
486
+
487
+ ##### :gear: mergeMaturity
488
+
489
+ Merge Maturity of a neuron
490
+
491
+ | Method | Type |
492
+ | --------------- | ------------------------------------------------------------------------------------------------------- |
493
+ | `mergeMaturity` | `({ neuronId, percentageToMerge, }: { neuronId: bigint; percentageToMerge: number; }) => Promise<void>` |
494
+
495
+ ##### :gear: spawnNeuron
496
+
497
+ Merge Maturity of a neuron
498
+
499
+ | Method | Type |
500
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
501
+ | `spawnNeuron` | `({ neuronId, percentageToSpawn, newController, nonce, }: { neuronId: bigint; percentageToSpawn?: number; newController?: Principal; nonce?: bigint; }) => Promise<bigint>` |
502
+
503
+ ##### :gear: addHotkey
504
+
505
+ Add hotkey to neuron
506
+
507
+ | Method | Type |
508
+ | ----------- | ------------------------------------------------------------------------------------------ |
509
+ | `addHotkey` | `({ neuronId, principal, }: { neuronId: bigint; principal: Principal; }) => Promise<void>` |
510
+
511
+ ##### :gear: removeHotkey
512
+
513
+ Remove hotkey to neuron
514
+
515
+ | Method | Type |
516
+ | -------------- | ------------------------------------------------------------------------------------------ |
517
+ | `removeHotkey` | `({ neuronId, principal, }: { neuronId: bigint; principal: Principal; }) => Promise<void>` |
518
+
519
+ ##### :gear: claimOrRefreshNeuronFromAccount
520
+
521
+ Gets the NeuronID of a newly created neuron.
522
+
523
+ | Method | Type |
524
+ | --------------------------------- | --------------------------------------------------------------------------------------- |
525
+ | `claimOrRefreshNeuronFromAccount` | `({ memo, controller, }: { memo: bigint; controller?: Principal; }) => Promise<bigint>` |
526
+
527
+ ##### :gear: claimOrRefreshNeuron
528
+
529
+ Refreshes neuron and returns neuronId when successful
530
+ Uses query call only.
531
+
532
+ | Method | Type |
533
+ | ---------------------- | ----------------------------------------------------------- |
534
+ | `claimOrRefreshNeuron` | `(request: ClaimOrRefreshNeuronRequest) => Promise<bigint>` |
535
+
536
+ ##### :gear: getNeuron
537
+
538
+ Return the data of the neuron provided as id.
539
+
540
+ | Method | Type |
541
+ | ----------- | ---------------------------------------------------------------------------------------------- |
542
+ | `getNeuron` | `({ certified, neuronId, }: { certified: boolean; neuronId: bigint; }) => Promise<NeuronInfo>` |
543
+
544
+ ### :factory: ICP
545
+
546
+ We don't extend to keep `fromE8s` and `fromString` as backwards compatible.
547
+
548
+ #### Methods
549
+
550
+ - [fromE8s](#gear-frome8s)
551
+ - [fromString](#gear-fromstring)
552
+ - [toE8s](#gear-toe8s)
553
+ - [toProto](#gear-toproto)
554
+
555
+ ##### :gear: fromE8s
556
+
557
+ | Method | Type |
558
+ | --------- | ------------------------- |
559
+ | `fromE8s` | `(amount: bigint) => ICP` |
560
+
561
+ ##### :gear: fromString
562
+
563
+ Initialize from a string. Accepted formats:
564
+
565
+ 1234567.8901
566
+ 1'234'567.8901
567
+ 1,234,567.8901
568
+
569
+ | Method | Type |
570
+ | ------------ | --------------------------------------------------- |
571
+ | `fromString` | `(amount: string) => FromStringToTokenError or ICP` |
572
+
573
+ ##### :gear: toE8s
574
+
575
+ | Method | Type |
576
+ | ------- | -------------- |
577
+ | `toE8s` | `() => bigint` |
578
+
579
+ ##### :gear: toProto
580
+
581
+ | Method | Type |
582
+ | --------- | ------------- |
583
+ | `toProto` | `() => ICPTs` |
584
+
585
+ ### :factory: SnsWasmCanister
586
+
587
+ #### Methods
588
+
589
+ - [create](#gear-create)
590
+ - [listSnses](#gear-listsnses)
591
+
592
+ ##### :gear: create
593
+
594
+ | Method | Type |
595
+ | -------- | ---------------------------------------------------------- |
596
+ | `create` | `(options?: CanisterOptions<_SERVICE>) => SnsWasmCanister` |
597
+
598
+ ##### :gear: listSnses
599
+
600
+ | Method | Type |
601
+ | ----------- | ---------------------------------------------------------------------- |
602
+ | `listSnses` | `({ certified, }: { certified?: boolean; }) => Promise<DeployedSns[]>` |
603
+
604
+ <!-- TSDOC_END -->
@@ -75,6 +75,7 @@ export const idlFactory = ({ IDL }) => {
75
75
  'canisters' : IDL.Opt(SnsCanisterIds),
76
76
  });
77
77
  const SnsVersion = IDL.Record({
78
+ 'archive_wasm_hash' : IDL.Vec(IDL.Nat8),
78
79
  'root_wasm_hash' : IDL.Vec(IDL.Nat8),
79
80
  'swap_wasm_hash' : IDL.Vec(IDL.Nat8),
80
81
  'ledger_wasm_hash' : IDL.Vec(IDL.Nat8),
@@ -77,6 +77,7 @@ export interface SnsInitPayload {
77
77
  min_icp_e8s: [] | [bigint];
78
78
  }
79
79
  export interface SnsVersion {
80
+ archive_wasm_hash: Array<number>;
80
81
  root_wasm_hash: Array<number>;
81
82
  swap_wasm_hash: Array<number>;
82
83
  ledger_wasm_hash: Array<number>;
@@ -1,4 +1,4 @@
1
- // Generated from IC repo commit 518271451cf8901c77c986e007e2c4762d1fc948 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid
1
+ // Generated from IC repo commit 12ea1aa1db0a3427eeec8e4b132b0bffb0362380 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid
2
2
  type AddWasmRequest = record { hash : vec nat8; wasm : opt SnsWasm };
3
3
  type AddWasmResponse = record { result : opt Result };
4
4
  type AirdropDistribution = record { airdrop_neurons : vec NeuronDistribution };
@@ -56,6 +56,7 @@ type SnsInitPayload = record {
56
56
  min_icp_e8s : opt nat64;
57
57
  };
58
58
  type SnsVersion = record {
59
+ archive_wasm_hash : vec nat8;
59
60
  root_wasm_hash : vec nat8;
60
61
  swap_wasm_hash : vec nat8;
61
62
  ledger_wasm_hash : vec nat8;
@@ -75,6 +75,7 @@ export const idlFactory = ({ IDL }) => {
75
75
  'canisters' : IDL.Opt(SnsCanisterIds),
76
76
  });
77
77
  const SnsVersion = IDL.Record({
78
+ 'archive_wasm_hash' : IDL.Vec(IDL.Nat8),
78
79
  'root_wasm_hash' : IDL.Vec(IDL.Nat8),
79
80
  'swap_wasm_hash' : IDL.Vec(IDL.Nat8),
80
81
  'ledger_wasm_hash' : IDL.Vec(IDL.Nat8),