@dfinity/nns 10.3.0 → 10.3.1-next-2025-10-15

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.
@@ -262,8 +262,29 @@ export const idlFactory = ({ IDL }) => {
262
262
  'total' : IDL.Nat64,
263
263
  'timestamp_seconds' : IDL.Nat64,
264
264
  });
265
+ const TopicToFollow = IDL.Variant({
266
+ 'Kyc' : IDL.Null,
267
+ 'ServiceNervousSystemManagement' : IDL.Null,
268
+ 'ApiBoundaryNodeManagement' : IDL.Null,
269
+ 'ApplicationCanisterManagement' : IDL.Null,
270
+ 'SubnetRental' : IDL.Null,
271
+ 'NeuronManagement' : IDL.Null,
272
+ 'NodeProviderRewards' : IDL.Null,
273
+ 'SubnetManagement' : IDL.Null,
274
+ 'ExchangeRate' : IDL.Null,
275
+ 'CatchAll' : IDL.Null,
276
+ 'NodeAdmin' : IDL.Null,
277
+ 'IcOsVersionElection' : IDL.Null,
278
+ 'ProtocolCanisterManagement' : IDL.Null,
279
+ 'NetworkEconomics' : IDL.Null,
280
+ 'IcOsVersionDeployment' : IDL.Null,
281
+ 'ParticipantManagement' : IDL.Null,
282
+ 'Governance' : IDL.Null,
283
+ 'SnsAndCommunityFund' : IDL.Null,
284
+ });
265
285
  const KnownNeuronData = IDL.Record({
266
286
  'name' : IDL.Text,
287
+ 'committed_topics' : IDL.Opt(IDL.Vec(IDL.Opt(TopicToFollow))),
267
288
  'description' : IDL.Opt(IDL.Text),
268
289
  'links' : IDL.Opt(IDL.Vec(IDL.Text)),
269
290
  });
@@ -706,6 +727,10 @@ export const idlFactory = ({ IDL }) => {
706
727
  'Ok' : MonthlyNodeProviderRewards,
707
728
  'Err' : GovernanceError,
708
729
  });
730
+ const GetNeuronIndexRequest = IDL.Record({
731
+ 'page_size' : IDL.Opt(IDL.Nat32),
732
+ 'exclusive_start_neuron_id' : IDL.Opt(NeuronId),
733
+ });
709
734
  const NeuronInfo = IDL.Record({
710
735
  'dissolve_delay_seconds' : IDL.Nat64,
711
736
  'recent_ballots' : IDL.Vec(BallotInfo),
@@ -723,6 +748,11 @@ export const idlFactory = ({ IDL }) => {
723
748
  'voting_power' : IDL.Nat64,
724
749
  'age_seconds' : IDL.Nat64,
725
750
  });
751
+ const NeuronIndexData = IDL.Record({ 'neurons' : IDL.Vec(NeuronInfo) });
752
+ const GetNeuronIndexResult = IDL.Variant({
753
+ 'Ok' : NeuronIndexData,
754
+ 'Err' : GovernanceError,
755
+ });
726
756
  const Result_5 = IDL.Variant({ 'Ok' : NeuronInfo, 'Err' : GovernanceError });
727
757
  const GetNeuronsFundAuditInfoRequest = IDL.Record({
728
758
  'nns_proposal_id' : IDL.Opt(ProposalId),
@@ -978,6 +1008,11 @@ export const idlFactory = ({ IDL }) => {
978
1008
  ),
979
1009
  'get_network_economics_parameters' : IDL.Func([], [NetworkEconomics], []),
980
1010
  'get_neuron_ids' : IDL.Func([], [IDL.Vec(IDL.Nat64)], []),
1011
+ 'get_neuron_index' : IDL.Func(
1012
+ [GetNeuronIndexRequest],
1013
+ [GetNeuronIndexResult],
1014
+ [],
1015
+ ),
981
1016
  'get_neuron_info' : IDL.Func([IDL.Nat64], [Result_5], []),
982
1017
  'get_neuron_info_by_id_or_subaccount' : IDL.Func(
983
1018
  [NeuronIdOrSubaccount],
@@ -1293,8 +1328,29 @@ export const init = ({ IDL }) => {
1293
1328
  'total' : IDL.Nat64,
1294
1329
  'timestamp_seconds' : IDL.Nat64,
1295
1330
  });
1331
+ const TopicToFollow = IDL.Variant({
1332
+ 'Kyc' : IDL.Null,
1333
+ 'ServiceNervousSystemManagement' : IDL.Null,
1334
+ 'ApiBoundaryNodeManagement' : IDL.Null,
1335
+ 'ApplicationCanisterManagement' : IDL.Null,
1336
+ 'SubnetRental' : IDL.Null,
1337
+ 'NeuronManagement' : IDL.Null,
1338
+ 'NodeProviderRewards' : IDL.Null,
1339
+ 'SubnetManagement' : IDL.Null,
1340
+ 'ExchangeRate' : IDL.Null,
1341
+ 'CatchAll' : IDL.Null,
1342
+ 'NodeAdmin' : IDL.Null,
1343
+ 'IcOsVersionElection' : IDL.Null,
1344
+ 'ProtocolCanisterManagement' : IDL.Null,
1345
+ 'NetworkEconomics' : IDL.Null,
1346
+ 'IcOsVersionDeployment' : IDL.Null,
1347
+ 'ParticipantManagement' : IDL.Null,
1348
+ 'Governance' : IDL.Null,
1349
+ 'SnsAndCommunityFund' : IDL.Null,
1350
+ });
1296
1351
  const KnownNeuronData = IDL.Record({
1297
1352
  'name' : IDL.Text,
1353
+ 'committed_topics' : IDL.Opt(IDL.Vec(IDL.Opt(TopicToFollow))),
1298
1354
  'description' : IDL.Opt(IDL.Text),
1299
1355
  'links' : IDL.Opt(IDL.Vec(IDL.Text)),
1300
1356
  });
@@ -94,6 +94,9 @@ export interface ClaimOrRefreshNeuronFromAccountResponse {
94
94
  export interface ClaimOrRefreshResponse {
95
95
  refreshed_neuron_id: [] | [NeuronId];
96
96
  }
97
+ /**
98
+ * KEEP THIS IN SYNC WITH ManageNeuronCommandRequest!
99
+ */
97
100
  export type Command =
98
101
  | { Spawn: Spawn }
99
102
  | { Split: Split }
@@ -264,6 +267,13 @@ export interface FulfillSubnetRentalRequest {
264
267
  */
265
268
  node_ids: [] | [Array<Principal>];
266
269
  }
270
+ export interface GetNeuronIndexRequest {
271
+ page_size: [] | [number];
272
+ exclusive_start_neuron_id: [] | [NeuronId];
273
+ }
274
+ export type GetNeuronIndexResult =
275
+ | { Ok: NeuronIndexData }
276
+ | { Err: GovernanceError };
267
277
  export interface GetNeuronsFundAuditInfoRequest {
268
278
  nns_proposal_id: [] | [ProposalId];
269
279
  }
@@ -394,6 +404,12 @@ export interface KnownNeuron {
394
404
  }
395
405
  export interface KnownNeuronData {
396
406
  name: string;
407
+ /**
408
+ * The first `opt` makes it so that the field can be renamed/deprecated in the future, and
409
+ * the second `opt` makes it so that an older client not recognizing a new variant can still
410
+ * get the rest of the `vec`.
411
+ */
412
+ committed_topics: [] | [Array<[] | [TopicToFollow]>];
397
413
  description: [] | [string];
398
414
  links: [] | [Array<string>];
399
415
  }
@@ -406,17 +422,45 @@ export interface LedgerParameters {
406
422
  export interface ListKnownNeuronsResponse {
407
423
  known_neurons: Array<KnownNeuron>;
408
424
  }
425
+ /**
426
+ * Parameters of the list_neurons method.
427
+ */
409
428
  export interface ListNeurons {
410
429
  page_size: [] | [bigint];
430
+ /**
431
+ * When a public neuron is a member of the result set, include it in the
432
+ * full_neurons field (of ListNeuronsResponse). This does not affect which
433
+ * neurons are part of the result set.
434
+ */
411
435
  include_public_neurons_in_full_neurons: [] | [boolean];
436
+ /**
437
+ * These fields select neurons to be in the result set.
438
+ */
412
439
  neuron_ids: BigUint64Array | bigint[];
413
440
  page_number: [] | [bigint];
441
+ /**
442
+ * Only has an effect when include_neurons_readable_by_caller.
443
+ */
414
444
  include_empty_neurons_readable_by_caller: [] | [boolean];
415
445
  neuron_subaccounts: [] | [Array<NeuronSubaccount>];
416
446
  include_neurons_readable_by_caller: boolean;
417
447
  }
448
+ /**
449
+ * Output of the list_neurons method.
450
+ */
418
451
  export interface ListNeuronsResponse {
452
+ /**
453
+ * Per the NeuronInfo type, this is a redacted view of the neurons in the
454
+ * result set consisting of information that require no special privileges to
455
+ * view.
456
+ */
419
457
  neuron_infos: Array<[bigint, NeuronInfo]>;
458
+ /**
459
+ * If the caller has the necessary special privileges (or the neuron is
460
+ * public, and the request sets include_public_neurons_in_full_neurons to
461
+ * true), then all the information about the neurons in the result set is made
462
+ * available here.
463
+ */
420
464
  full_neurons: Array<Neuron>;
421
465
  total_pages_available: [] | [bigint];
422
466
  }
@@ -451,11 +495,18 @@ export interface MakeProposalResponse {
451
495
  message: [] | [string];
452
496
  proposal_id: [] | [ProposalId];
453
497
  }
498
+ /**
499
+ * Not to be confused with ManageNeuronRequest. (Yes, this is very structurally
500
+ * similar to that, but not actually exactly equivalent.)
501
+ */
454
502
  export interface ManageNeuron {
455
503
  id: [] | [NeuronId];
456
504
  command: [] | [Command];
457
505
  neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount];
458
506
  }
507
+ /**
508
+ * KEEP THIS IN SYNC WITH COMMAND!
509
+ */
459
510
  export type ManageNeuronCommandRequest =
460
511
  | { Spawn: Spawn }
461
512
  | { Split: Split }
@@ -472,12 +523,31 @@ export type ManageNeuronCommandRequest =
472
523
  | { StakeMaturity: StakeMaturity }
473
524
  | { MergeMaturity: MergeMaturity }
474
525
  | { Disburse: Disburse };
526
+ /**
527
+ * Parameters of the manage_neuron method.
528
+ */
475
529
  export interface ManageNeuronRequest {
530
+ /**
531
+ * Deprecated. Use neuron_id_or_subaccount instead.
532
+ */
476
533
  id: [] | [NeuronId];
534
+ /**
535
+ * What operation to perform on the neuron.
536
+ */
477
537
  command: [] | [ManageNeuronCommandRequest];
538
+ /**
539
+ * Which neuron to operate on.
540
+ */
478
541
  neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount];
479
542
  }
543
+ /**
544
+ * Output of the manage_neuron method.
545
+ */
480
546
  export interface ManageNeuronResponse {
547
+ /**
548
+ * Corresponds to the command field in ManageNeuronRequest, which determines
549
+ * what operation was performed.
550
+ */
481
551
  command: [] | [Command_1];
482
552
  }
483
553
  export interface MaturityDisbursement {
@@ -537,10 +607,67 @@ export interface Neuron {
537
607
  recent_ballots: Array<BallotInfo>;
538
608
  voting_power_refreshed_timestamp_seconds: [] | [bigint];
539
609
  kyc_verified: boolean;
610
+ /**
611
+ * The amount of "sway" this neuron can have if it refreshes its voting power
612
+ * frequently enough.
613
+ *
614
+ * Unlike deciding_voting_power, this does NOT take refreshing into account.
615
+ * Rather, this only takes three factors into account:
616
+ *
617
+ * 1. (Net) staked amount - This is the "base" of a neuron's voting power.
618
+ * This primarily consists of the neuron's ICP balance.
619
+ *
620
+ * 2. Age - Neurons with more age have more voting power (all else being
621
+ * equal).
622
+ *
623
+ * 3. Dissolve delay - Neurons with longer dissolve delay have more voting
624
+ * power (all else being equal). Neurons with a dissolve delay of less
625
+ * than six months are not eligible to vote. Therefore, such neurons
626
+ * are considered to have 0 voting power.
627
+ *
628
+ * Per NNS policy, this is opt. Nevertheless, it will never be null.
629
+ */
540
630
  potential_voting_power: [] | [bigint];
541
631
  neuron_type: [] | [number];
542
632
  not_for_profit: boolean;
543
633
  maturity_e8s_equivalent: bigint;
634
+ /**
635
+ * The amount of "sway" this neuron has when voting on proposals.
636
+ *
637
+ * When a proposal is created, each eligible neuron gets a "blank" ballot. The
638
+ * amount of voting power in that ballot is set to the neuron's deciding
639
+ * voting power at the time of proposal creation. There are two ways that a
640
+ * proposal can become decided:
641
+ *
642
+ * 1. Early: Either more than half of the total voting power in the ballots
643
+ * votes in favor (then the proposal is approved), or at least half of the
644
+ * votal voting power in the ballots votes against (then, the proposal is
645
+ * rejected).
646
+ *
647
+ * 2. The proposal's voting deadline is reached. At that point, if there is
648
+ * more voting power in favor than against, and at least 3% of the total
649
+ * voting power voted in favor, then the proposal is approved. Otherwise, it
650
+ * is rejected.
651
+ *
652
+ * If a neuron regularly refreshes its voting power, this has the same value
653
+ * as potential_voting_power. Actions that cause a refresh are as follows:
654
+ *
655
+ * 1. voting directly (not via following)
656
+ * 2. set following
657
+ * 3. refresh voting power
658
+ *
659
+ * (All of these actions are performed via the manage_neuron method.)
660
+ *
661
+ * However, if a neuron has not refreshed in a "long" time, this will be less
662
+ * than potential voting power. See VotingPowerEconomics. As a further result
663
+ * of less deciding voting power, not only does it have less influence on the
664
+ * outcome of proposals, the neuron receives less voting rewards (when it
665
+ * votes indirectly via following).
666
+ *
667
+ * For details, see https://dashboard.internetcomputer.org/proposal/132411.
668
+ *
669
+ * Per NNS policy, this is opt. Nevertheless, it will never be null.
670
+ */
544
671
  deciding_voting_power: [] | [bigint];
545
672
  cached_neuron_stake_e8s: bigint;
546
673
  created_timestamp_seconds: bigint;
@@ -549,6 +676,10 @@ export interface Neuron {
549
676
  hot_keys: Array<Principal>;
550
677
  account: Uint8Array | number[];
551
678
  joined_community_fund_timestamp_seconds: [] | [bigint];
679
+ /**
680
+ * The maturity disbursements in progress, i.e. the disbursements that are initiated but not
681
+ * finalized. The finalization happens 7 days after the disbursement is initiated.
682
+ */
552
683
  maturity_disbursements_in_progress: [] | [Array<MaturityDisbursement>];
553
684
  dissolve_state: [] | [DissolveState];
554
685
  followees: Array<[number, Followees]>;
@@ -583,6 +714,17 @@ export interface NeuronInFlightCommand {
583
714
  command: [] | [Command_2];
584
715
  timestamp: bigint;
585
716
  }
717
+ export interface NeuronIndexData {
718
+ neurons: Array<NeuronInfo>;
719
+ }
720
+ /**
721
+ * A limit view of Neuron that allows some aspects of all neurons to be read by
722
+ * anyone (i.e. without having to be the neuron's controller nor one of its
723
+ * hotkeys).
724
+ *
725
+ * As such, the meaning of each field in this type is generally the same as the
726
+ * one of the same (or at least similar) name in Neuron.
727
+ */
586
728
  export interface NeuronInfo {
587
729
  dissolve_delay_seconds: bigint;
588
730
  recent_ballots: Array<BallotInfo>;
@@ -592,11 +734,27 @@ export interface NeuronInfo {
592
734
  deciding_voting_power: [] | [bigint];
593
735
  created_timestamp_seconds: bigint;
594
736
  state: number;
737
+ /**
738
+ * The amount of ICP (and staked maturity) locked in this neuron.
739
+ *
740
+ * This is the foundation of the neuron's voting power.
741
+ *
742
+ * cached_neuron_stake_e8s - neuron_fees_e8s + staked_maturity_e8s_equivalent
743
+ */
595
744
  stake_e8s: bigint;
596
745
  joined_community_fund_timestamp_seconds: [] | [bigint];
597
746
  retrieved_at_timestamp_seconds: bigint;
598
747
  visibility: [] | [number];
599
748
  known_neuron_data: [] | [KnownNeuronData];
749
+ /**
750
+ * Deprecated. Use either deciding_voting_power or potential_voting_power
751
+ * instead. Has the same value as deciding_voting_power.
752
+ *
753
+ * Previously, if a neuron had < 6 months dissolve delay (making it ineligible
754
+ * to vote), this would not get set to 0 (zero). That was pretty confusing.
755
+ * Now that this is set to deciding_voting_power, this actually does get
756
+ * zeroed out.
757
+ */
600
758
  voting_power: bigint;
601
759
  age_seconds: bigint;
602
760
  }
@@ -964,6 +1122,31 @@ export interface TimeWindow {
964
1122
  export interface Tokens {
965
1123
  e8s: [] | [bigint];
966
1124
  }
1125
+ /**
1126
+ * A topic that can be followed. It is almost the same as the topic on the
1127
+ * proposal, except that the `CatchAll` is a special value and following on this
1128
+ * `topic` will let the neuron follow the votes on all topics except for
1129
+ * Governance and SnsAndCommunityFund.
1130
+ */
1131
+ export type TopicToFollow =
1132
+ | { Kyc: null }
1133
+ | { ServiceNervousSystemManagement: null }
1134
+ | { ApiBoundaryNodeManagement: null }
1135
+ | { ApplicationCanisterManagement: null }
1136
+ | { SubnetRental: null }
1137
+ | { NeuronManagement: null }
1138
+ | { NodeProviderRewards: null }
1139
+ | { SubnetManagement: null }
1140
+ | { ExchangeRate: null }
1141
+ | { CatchAll: null }
1142
+ | { NodeAdmin: null }
1143
+ | { IcOsVersionElection: null }
1144
+ | { ProtocolCanisterManagement: null }
1145
+ | { NetworkEconomics: null }
1146
+ | { IcOsVersionDeployment: null }
1147
+ | { ParticipantManagement: null }
1148
+ | { Governance: null }
1149
+ | { SnsAndCommunityFund: null };
967
1150
  export interface UpdateCanisterSettings {
968
1151
  canister_id: [] | [Principal];
969
1152
  settings: [] | [CanisterSettings];
@@ -1041,6 +1224,7 @@ export interface _SERVICE {
1041
1224
  >;
1042
1225
  get_network_economics_parameters: ActorMethod<[], NetworkEconomics>;
1043
1226
  get_neuron_ids: ActorMethod<[], BigUint64Array | bigint[]>;
1227
+ get_neuron_index: ActorMethod<[GetNeuronIndexRequest], GetNeuronIndexResult>;
1044
1228
  get_neuron_info: ActorMethod<[bigint], Result_5>;
1045
1229
  get_neuron_info_by_id_or_subaccount: ActorMethod<
1046
1230
  [NeuronIdOrSubaccount],
@@ -1076,6 +1260,9 @@ export interface _SERVICE {
1076
1260
  ManageNeuronResponse
1077
1261
  >;
1078
1262
  transfer_gtc_neuron: ActorMethod<[NeuronId, NeuronId], Result>;
1263
+ /**
1264
+ * The following are methods for feature = "test"
1265
+ */
1079
1266
  update_neuron: ActorMethod<[Neuron], [] | [GovernanceError]>;
1080
1267
  update_node_provider: ActorMethod<[UpdateNodeProvider], Result>;
1081
1268
  }