@dfinity/sns 3.7.0 → 3.7.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.
package/README.md CHANGED
@@ -460,6 +460,10 @@ Parameters:
460
460
 
461
461
  - `params.certified`: - Query or update calls
462
462
 
463
+ Returns:
464
+
465
+ - A list of canisters ('root' | 'governance' | 'ledger' | 'dapps' | 'swap' | 'archives')
466
+
463
467
  [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/sns/src/root.canister.ts#L32)
464
468
 
465
469
  ### :factory: SnsSwapCanister
@@ -1,5 +1,6 @@
1
1
  /* Do not edit. Compiled with ./scripts/compile-idl-js from packages/sns/candid/sns_governance.did */
2
2
  export const idlFactory = ({ IDL }) => {
3
+ const PreciseValue = IDL.Rec();
3
4
  const Timers = IDL.Record({
4
5
  'last_spawned_timestamp_seconds' : IDL.Opt(IDL.Nat64),
5
6
  'last_reset_timestamp_seconds' : IDL.Opt(IDL.Nat64),
@@ -45,7 +46,26 @@ export const idlFactory = ({ IDL }) => {
45
46
  'description' : IDL.Opt(IDL.Text),
46
47
  'function_type' : IDL.Opt(FunctionType),
47
48
  });
49
+ const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
50
+ const Account = IDL.Record({
51
+ 'owner' : IDL.Opt(IDL.Principal),
52
+ 'subaccount' : IDL.Opt(Subaccount),
53
+ });
54
+ const TreasuryMetrics = IDL.Record({
55
+ 'name' : IDL.Opt(IDL.Text),
56
+ 'original_amount_e8s' : IDL.Opt(IDL.Nat64),
57
+ 'amount_e8s' : IDL.Opt(IDL.Nat64),
58
+ 'account' : IDL.Opt(Account),
59
+ 'ledger_canister_id' : IDL.Opt(IDL.Principal),
60
+ 'treasury' : IDL.Int32,
61
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
62
+ });
63
+ const VotingPowerMetrics = IDL.Record({
64
+ 'governance_total_potential_voting_power' : IDL.Opt(IDL.Nat64),
65
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
66
+ });
48
67
  const GovernanceCachedMetrics = IDL.Record({
68
+ 'treasury_metrics' : IDL.Vec(TreasuryMetrics),
49
69
  'not_dissolving_neurons_e8s_buckets' : IDL.Vec(
50
70
  IDL.Tuple(IDL.Nat64, IDL.Float64)
51
71
  ),
@@ -58,6 +78,7 @@ export const idlFactory = ({ IDL }) => {
58
78
  'dissolved_neurons_count' : IDL.Nat64,
59
79
  'total_staked_e8s' : IDL.Nat64,
60
80
  'total_supply_governance_tokens' : IDL.Nat64,
81
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
61
82
  'not_dissolving_neurons_count' : IDL.Nat64,
62
83
  'dissolved_neurons_e8s' : IDL.Nat64,
63
84
  'neurons_with_less_than_6_months_dissolve_delay_e8s' : IDL.Nat64,
@@ -185,11 +206,6 @@ export const idlFactory = ({ IDL }) => {
185
206
  'error_message' : IDL.Text,
186
207
  'error_type' : IDL.Int32,
187
208
  });
188
- const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
189
- const Account = IDL.Record({
190
- 'owner' : IDL.Opt(IDL.Principal),
191
- 'subaccount' : IDL.Opt(Subaccount),
192
- });
193
209
  const Decimal = IDL.Record({ 'human_readable' : IDL.Opt(IDL.Text) });
194
210
  const Tokens = IDL.Record({ 'e8s' : IDL.Opt(IDL.Nat64) });
195
211
  const ValuationFactors = IDL.Record({
@@ -247,6 +263,27 @@ export const idlFactory = ({ IDL }) => {
247
263
  const SetTopicsForCustomProposals = IDL.Record({
248
264
  'custom_function_id_to_topic' : IDL.Vec(IDL.Tuple(IDL.Nat64, Topic)),
249
265
  });
266
+ const ChunkedCanisterWasm = IDL.Record({
267
+ 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
268
+ 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
269
+ 'store_canister_id' : IDL.Opt(IDL.Principal),
270
+ });
271
+ PreciseValue.fill(
272
+ IDL.Variant({
273
+ 'Int' : IDL.Int64,
274
+ 'Map' : IDL.Vec(IDL.Tuple(IDL.Text, PreciseValue)),
275
+ 'Nat' : IDL.Nat64,
276
+ 'Blob' : IDL.Vec(IDL.Nat8),
277
+ 'Bool' : IDL.Bool,
278
+ 'Text' : IDL.Text,
279
+ 'Array' : IDL.Vec(PreciseValue),
280
+ })
281
+ );
282
+ const ExtensionInit = IDL.Record({ 'value' : IDL.Opt(PreciseValue) });
283
+ const RegisterExtension = IDL.Record({
284
+ 'chunked_canister_wasm' : IDL.Opt(ChunkedCanisterWasm),
285
+ 'extension_init' : IDL.Opt(ExtensionInit),
286
+ });
250
287
  const RegisterDappCanisters = IDL.Record({
251
288
  'canister_ids' : IDL.Vec(IDL.Principal),
252
289
  });
@@ -257,11 +294,6 @@ export const idlFactory = ({ IDL }) => {
257
294
  'memo' : IDL.Opt(IDL.Nat64),
258
295
  'amount_e8s' : IDL.Nat64,
259
296
  });
260
- const ChunkedCanisterWasm = IDL.Record({
261
- 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
262
- 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
263
- 'store_canister_id' : IDL.Opt(IDL.Principal),
264
- });
265
297
  const UpgradeSnsControlledCanister = IDL.Record({
266
298
  'new_canister_wasm' : IDL.Vec(IDL.Nat8),
267
299
  'mode' : IDL.Opt(IDL.Int32),
@@ -305,6 +337,7 @@ export const idlFactory = ({ IDL }) => {
305
337
  'ManageDappCanisterSettings' : ManageDappCanisterSettings,
306
338
  'RemoveGenericNervousSystemFunction' : IDL.Nat64,
307
339
  'SetTopicsForCustomProposals' : SetTopicsForCustomProposals,
340
+ 'RegisterExtension' : RegisterExtension,
308
341
  'UpgradeSnsToNextVersion' : IDL.Record({}),
309
342
  'RegisterDappCanisters' : RegisterDappCanisters,
310
343
  'TransferSnsTreasuryFunds' : TransferSnsTreasuryFunds,
@@ -556,8 +589,12 @@ export const idlFactory = ({ IDL }) => {
556
589
  'time_window_seconds' : IDL.Opt(IDL.Nat64),
557
590
  });
558
591
  const Metrics = IDL.Record({
592
+ 'treasury_metrics' : IDL.Opt(IDL.Vec(TreasuryMetrics)),
593
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
559
594
  'last_ledger_block_timestamp' : IDL.Opt(IDL.Nat64),
595
+ 'num_recently_executed_proposals' : IDL.Opt(IDL.Nat64),
560
596
  'num_recently_submitted_proposals' : IDL.Opt(IDL.Nat64),
597
+ 'genesis_timestamp_seconds' : IDL.Opt(IDL.Nat64),
561
598
  });
562
599
  const GetMetricsResult = IDL.Variant({
563
600
  'Ok' : Metrics,
@@ -745,6 +782,11 @@ export const idlFactory = ({ IDL }) => {
745
782
  ),
746
783
  'get_metadata' : IDL.Func([IDL.Record({})], [GetMetadataResponse], []),
747
784
  'get_metrics' : IDL.Func([GetMetricsRequest], [GetMetricsResponse], []),
785
+ 'get_metrics_replicated' : IDL.Func(
786
+ [GetMetricsRequest],
787
+ [GetMetricsResponse],
788
+ [],
789
+ ),
748
790
  'get_mode' : IDL.Func([IDL.Record({})], [GetModeResponse], []),
749
791
  'get_nervous_system_parameters' : IDL.Func(
750
792
  [IDL.Null],
@@ -788,6 +830,7 @@ export const idlFactory = ({ IDL }) => {
788
830
  });
789
831
  };
790
832
  export const init = ({ IDL }) => {
833
+ const PreciseValue = IDL.Rec();
791
834
  const Timers = IDL.Record({
792
835
  'last_spawned_timestamp_seconds' : IDL.Opt(IDL.Nat64),
793
836
  'last_reset_timestamp_seconds' : IDL.Opt(IDL.Nat64),
@@ -833,7 +876,26 @@ export const init = ({ IDL }) => {
833
876
  'description' : IDL.Opt(IDL.Text),
834
877
  'function_type' : IDL.Opt(FunctionType),
835
878
  });
879
+ const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
880
+ const Account = IDL.Record({
881
+ 'owner' : IDL.Opt(IDL.Principal),
882
+ 'subaccount' : IDL.Opt(Subaccount),
883
+ });
884
+ const TreasuryMetrics = IDL.Record({
885
+ 'name' : IDL.Opt(IDL.Text),
886
+ 'original_amount_e8s' : IDL.Opt(IDL.Nat64),
887
+ 'amount_e8s' : IDL.Opt(IDL.Nat64),
888
+ 'account' : IDL.Opt(Account),
889
+ 'ledger_canister_id' : IDL.Opt(IDL.Principal),
890
+ 'treasury' : IDL.Int32,
891
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
892
+ });
893
+ const VotingPowerMetrics = IDL.Record({
894
+ 'governance_total_potential_voting_power' : IDL.Opt(IDL.Nat64),
895
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
896
+ });
836
897
  const GovernanceCachedMetrics = IDL.Record({
898
+ 'treasury_metrics' : IDL.Vec(TreasuryMetrics),
837
899
  'not_dissolving_neurons_e8s_buckets' : IDL.Vec(
838
900
  IDL.Tuple(IDL.Nat64, IDL.Float64)
839
901
  ),
@@ -846,6 +908,7 @@ export const init = ({ IDL }) => {
846
908
  'dissolved_neurons_count' : IDL.Nat64,
847
909
  'total_staked_e8s' : IDL.Nat64,
848
910
  'total_supply_governance_tokens' : IDL.Nat64,
911
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
849
912
  'not_dissolving_neurons_count' : IDL.Nat64,
850
913
  'dissolved_neurons_e8s' : IDL.Nat64,
851
914
  'neurons_with_less_than_6_months_dissolve_delay_e8s' : IDL.Nat64,
@@ -973,11 +1036,6 @@ export const init = ({ IDL }) => {
973
1036
  'error_message' : IDL.Text,
974
1037
  'error_type' : IDL.Int32,
975
1038
  });
976
- const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
977
- const Account = IDL.Record({
978
- 'owner' : IDL.Opt(IDL.Principal),
979
- 'subaccount' : IDL.Opt(Subaccount),
980
- });
981
1039
  const Decimal = IDL.Record({ 'human_readable' : IDL.Opt(IDL.Text) });
982
1040
  const Tokens = IDL.Record({ 'e8s' : IDL.Opt(IDL.Nat64) });
983
1041
  const ValuationFactors = IDL.Record({
@@ -1035,6 +1093,27 @@ export const init = ({ IDL }) => {
1035
1093
  const SetTopicsForCustomProposals = IDL.Record({
1036
1094
  'custom_function_id_to_topic' : IDL.Vec(IDL.Tuple(IDL.Nat64, Topic)),
1037
1095
  });
1096
+ const ChunkedCanisterWasm = IDL.Record({
1097
+ 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
1098
+ 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
1099
+ 'store_canister_id' : IDL.Opt(IDL.Principal),
1100
+ });
1101
+ PreciseValue.fill(
1102
+ IDL.Variant({
1103
+ 'Int' : IDL.Int64,
1104
+ 'Map' : IDL.Vec(IDL.Tuple(IDL.Text, PreciseValue)),
1105
+ 'Nat' : IDL.Nat64,
1106
+ 'Blob' : IDL.Vec(IDL.Nat8),
1107
+ 'Bool' : IDL.Bool,
1108
+ 'Text' : IDL.Text,
1109
+ 'Array' : IDL.Vec(PreciseValue),
1110
+ })
1111
+ );
1112
+ const ExtensionInit = IDL.Record({ 'value' : IDL.Opt(PreciseValue) });
1113
+ const RegisterExtension = IDL.Record({
1114
+ 'chunked_canister_wasm' : IDL.Opt(ChunkedCanisterWasm),
1115
+ 'extension_init' : IDL.Opt(ExtensionInit),
1116
+ });
1038
1117
  const RegisterDappCanisters = IDL.Record({
1039
1118
  'canister_ids' : IDL.Vec(IDL.Principal),
1040
1119
  });
@@ -1045,11 +1124,6 @@ export const init = ({ IDL }) => {
1045
1124
  'memo' : IDL.Opt(IDL.Nat64),
1046
1125
  'amount_e8s' : IDL.Nat64,
1047
1126
  });
1048
- const ChunkedCanisterWasm = IDL.Record({
1049
- 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
1050
- 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
1051
- 'store_canister_id' : IDL.Opt(IDL.Principal),
1052
- });
1053
1127
  const UpgradeSnsControlledCanister = IDL.Record({
1054
1128
  'new_canister_wasm' : IDL.Vec(IDL.Nat8),
1055
1129
  'mode' : IDL.Opt(IDL.Int32),
@@ -1093,6 +1167,7 @@ export const init = ({ IDL }) => {
1093
1167
  'ManageDappCanisterSettings' : ManageDappCanisterSettings,
1094
1168
  'RemoveGenericNervousSystemFunction' : IDL.Nat64,
1095
1169
  'SetTopicsForCustomProposals' : SetTopicsForCustomProposals,
1170
+ 'RegisterExtension' : RegisterExtension,
1096
1171
  'UpgradeSnsToNextVersion' : IDL.Record({}),
1097
1172
  'RegisterDappCanisters' : RegisterDappCanisters,
1098
1173
  'TransferSnsTreasuryFunds' : TransferSnsTreasuryFunds,
@@ -14,6 +14,7 @@ export type Action =
14
14
  | { ManageDappCanisterSettings: ManageDappCanisterSettings }
15
15
  | { RemoveGenericNervousSystemFunction: bigint }
16
16
  | { SetTopicsForCustomProposals: SetTopicsForCustomProposals }
17
+ | { RegisterExtension: RegisterExtension }
17
18
  | { UpgradeSnsToNextVersion: {} }
18
19
  | { RegisterDappCanisters: RegisterDappCanisters }
19
20
  | { TransferSnsTreasuryFunds: TransferSnsTreasuryFunds }
@@ -190,6 +191,9 @@ export interface ExecuteGenericNervousSystemFunction {
190
191
  function_id: bigint;
191
192
  payload: Uint8Array | number[];
192
193
  }
194
+ export interface ExtensionInit {
195
+ value: [] | [PreciseValue];
196
+ }
193
197
  export interface FinalizeDisburseMaturity {
194
198
  amount_to_be_disbursed_e8s: bigint;
195
199
  to_account: [] | [Account];
@@ -306,6 +310,7 @@ export interface Governance {
306
310
  genesis_timestamp_seconds: bigint;
307
311
  }
308
312
  export interface GovernanceCachedMetrics {
313
+ treasury_metrics: Array<TreasuryMetrics>;
309
314
  not_dissolving_neurons_e8s_buckets: Array<[bigint, number]>;
310
315
  garbage_collectable_neurons_count: bigint;
311
316
  neurons_with_invalid_stake_count: bigint;
@@ -314,6 +319,7 @@ export interface GovernanceCachedMetrics {
314
319
  dissolved_neurons_count: bigint;
315
320
  total_staked_e8s: bigint;
316
321
  total_supply_governance_tokens: bigint;
322
+ voting_power_metrics: [] | [VotingPowerMetrics];
317
323
  not_dissolving_neurons_count: bigint;
318
324
  dissolved_neurons_e8s: bigint;
319
325
  neurons_with_less_than_6_months_dissolve_delay_e8s: bigint;
@@ -404,8 +410,12 @@ export interface MergeMaturityResponse {
404
410
  new_stake_e8s: bigint;
405
411
  }
406
412
  export interface Metrics {
413
+ treasury_metrics: [] | [Array<TreasuryMetrics>];
414
+ voting_power_metrics: [] | [VotingPowerMetrics];
407
415
  last_ledger_block_timestamp: [] | [bigint];
416
+ num_recently_executed_proposals: [] | [bigint];
408
417
  num_recently_submitted_proposals: [] | [bigint];
418
+ genesis_timestamp_seconds: [] | [bigint];
409
419
  }
410
420
  export interface MintSnsTokens {
411
421
  to_principal: [] | [Principal];
@@ -519,6 +529,14 @@ export interface PendingVersion {
519
529
  export interface Percentage {
520
530
  basis_points: [] | [bigint];
521
531
  }
532
+ export type PreciseValue =
533
+ | { Int: bigint }
534
+ | { Map: Array<[string, PreciseValue]> }
535
+ | { Nat: bigint }
536
+ | { Blob: Uint8Array | number[] }
537
+ | { Bool: boolean }
538
+ | { Text: string }
539
+ | { Array: Array<PreciseValue> };
522
540
  export interface Principals {
523
541
  principals: Array<Principal>;
524
542
  }
@@ -565,6 +583,10 @@ export interface QueryStats {
565
583
  export interface RegisterDappCanisters {
566
584
  canister_ids: Array<Principal>;
567
585
  }
586
+ export interface RegisterExtension {
587
+ chunked_canister_wasm: [] | [ChunkedCanisterWasm];
588
+ extension_init: [] | [ExtensionInit];
589
+ }
568
590
  export interface RegisterVote {
569
591
  vote: number;
570
592
  proposal: [] | [ProposalId];
@@ -675,6 +697,15 @@ export interface TransferSnsTreasuryFunds {
675
697
  memo: [] | [bigint];
676
698
  amount_e8s: bigint;
677
699
  }
700
+ export interface TreasuryMetrics {
701
+ name: [] | [string];
702
+ original_amount_e8s: [] | [bigint];
703
+ amount_e8s: [] | [bigint];
704
+ account: [] | [Account];
705
+ ledger_canister_id: [] | [Principal];
706
+ treasury: number;
707
+ timestamp_seconds: [] | [bigint];
708
+ }
678
709
  export interface UpgradeInProgress {
679
710
  mark_failed_at_seconds: bigint;
680
711
  checking_upgrade_lock: bigint;
@@ -754,6 +785,10 @@ export interface Version {
754
785
  export interface Versions {
755
786
  versions: Array<Version>;
756
787
  }
788
+ export interface VotingPowerMetrics {
789
+ governance_total_potential_voting_power: [] | [bigint];
790
+ timestamp_seconds: [] | [bigint];
791
+ }
757
792
  export interface VotingRewardsParameters {
758
793
  final_reward_rate_basis_points: [] | [bigint];
759
794
  initial_reward_rate_basis_points: [] | [bigint];
@@ -774,6 +809,7 @@ export interface _SERVICE {
774
809
  get_maturity_modulation: ActorMethod<[{}], GetMaturityModulationResponse>;
775
810
  get_metadata: ActorMethod<[{}], GetMetadataResponse>;
776
811
  get_metrics: ActorMethod<[GetMetricsRequest], GetMetricsResponse>;
812
+ get_metrics_replicated: ActorMethod<[GetMetricsRequest], GetMetricsResponse>;
777
813
  get_mode: ActorMethod<[{}], GetModeResponse>;
778
814
  get_nervous_system_parameters: ActorMethod<[null], NervousSystemParameters>;
779
815
  get_neuron: ActorMethod<[GetNeuron], GetNeuronResponse>;
@@ -1,4 +1,4 @@
1
- // Generated from IC repo commit b72c6253fa (2025-06-10) 'rs/sns/governance/canister/governance.did' by import-candid
1
+ // Generated from IC repo commit 5f36668c9b (2025-07-11) 'rs/sns/governance/canister/governance.did' by import-candid
2
2
  type Account = record {
3
3
  owner : opt principal;
4
4
  subaccount : opt Subaccount;
@@ -13,6 +13,7 @@ type Action = variant {
13
13
  UpgradeSnsToNextVersion : record {};
14
14
  AdvanceSnsTargetVersion : AdvanceSnsTargetVersion;
15
15
  RegisterDappCanisters : RegisterDappCanisters;
16
+ RegisterExtension : RegisterExtension;
16
17
  TransferSnsTreasuryFunds : TransferSnsTreasuryFunds;
17
18
  UpgradeSnsControlledCanister : UpgradeSnsControlledCanister;
18
19
  DeregisterDappCanisters : DeregisterDappCanisters;
@@ -253,9 +254,43 @@ type GetMetricsRequest = record {
253
254
  time_window_seconds : opt nat64;
254
255
  };
255
256
 
257
+ type TreasuryMetrics = record {
258
+ // Same as, e.g., `TransferSnsTreasuryFunds.from_treasury`.
259
+ treasury : int32;
260
+
261
+ // A human-readable identified for this treasury, e.g., "ICP".
262
+ name : opt text;
263
+
264
+ // The source of truth for the treasury balance is this ledger canister / account.
265
+ ledger_canister_id : opt principal;
266
+ account : opt Account;
267
+
268
+ // The regularly updated amount of tokens in this treasury.
269
+ amount_e8s : opt nat64;
270
+ // The amount of tokens in this treasury at the end of swap finalization.
271
+ original_amount_e8s : opt nat64;
272
+
273
+ // When the metrics were last updated.
274
+ timestamp_seconds : opt nat64;
275
+ };
276
+
277
+ type VotingPowerMetrics = record {
278
+ governance_total_potential_voting_power : opt nat64;
279
+
280
+ // When the metrics were last updated.
281
+ timestamp_seconds : opt nat64;
282
+ };
283
+
256
284
  type Metrics = record {
257
285
  num_recently_submitted_proposals : opt nat64;
286
+ num_recently_executed_proposals: opt nat64;
287
+
258
288
  last_ledger_block_timestamp : opt nat64;
289
+
290
+ // The metrics below are cached (albeit this is an implementation detail).
291
+ treasury_metrics : opt vec TreasuryMetrics;
292
+ voting_power_metrics : opt VotingPowerMetrics;
293
+ genesis_timestamp_seconds : opt nat64;
259
294
  };
260
295
 
261
296
  type GetMetricsResult = variant {
@@ -358,6 +393,8 @@ type GovernanceCachedMetrics = record {
358
393
  dissolving_neurons_count : nat64;
359
394
  dissolving_neurons_e8s_buckets : vec record { nat64; float64 };
360
395
  timestamp_seconds : nat64;
396
+ treasury_metrics : vec TreasuryMetrics;
397
+ voting_power_metrics : opt VotingPowerMetrics;
361
398
  };
362
399
 
363
400
  type GovernanceError = record {
@@ -664,6 +701,40 @@ type RegisterDappCanisters = record {
664
701
  canister_ids : vec principal;
665
702
  };
666
703
 
704
+ // This type is equivalant to `ICRC3Value`, but we give it another name since it is used here not
705
+ // in the context of the ICRC-3 ledger standard. The justification is the same: The candid format
706
+ // supports sharing information even when the client and the server involved do not have the same
707
+ // schema (see the Upgrading and subtyping section of the candid spec). While this mechanism allows
708
+ // to evolve services and clients independently without breaking them, it also means that a client
709
+ // may not receive all the information that the server is sending, e.g. in case the client schema
710
+ // lacks some fields that the server schema has.
711
+ //
712
+ // This loss of information is not an option for SNS voters deciding if an extension with particular
713
+ // init args should be installed or if an extension function with particular arguments should be
714
+ // called. The client must receive the same exact data the server sent in order to verify it.
715
+ //
716
+ // Verification of a priorly installed extension is done by hashing the extension's init arg data
717
+ // and checking that the result is consistent with what has been certified by the SNS.
718
+ type PreciseValue = variant {
719
+ Bool : bool;
720
+ Blob : blob;
721
+ Text : text;
722
+ Nat : nat64;
723
+ Int : int64;
724
+ Array : vec PreciseValue;
725
+ Map : vec record { text; PreciseValue };
726
+ };
727
+
728
+ type ExtensionInit = record {
729
+ value : opt PreciseValue;
730
+ };
731
+
732
+ type RegisterExtension = record {
733
+ chunked_canister_wasm : opt ChunkedCanisterWasm;
734
+
735
+ extension_init : opt ExtensionInit;
736
+ };
737
+
667
738
  type RegisterVote = record {
668
739
  vote : int32;
669
740
  proposal : opt ProposalId;
@@ -914,6 +985,7 @@ service : (Governance) -> {
914
985
  get_maturity_modulation : (record {}) -> (GetMaturityModulationResponse);
915
986
  get_metadata : (record {}) -> (GetMetadataResponse) query;
916
987
  get_metrics : (GetMetricsRequest) -> (GetMetricsResponse) composite_query;
988
+ get_metrics_replicated : (GetMetricsRequest) -> (GetMetricsResponse);
917
989
  get_mode : (record {}) -> (GetModeResponse) query;
918
990
  get_nervous_system_parameters : (null) -> (NervousSystemParameters) query;
919
991
  get_neuron : (GetNeuron) -> (GetNeuronResponse) query;
@@ -1,5 +1,6 @@
1
1
  /* Do not edit. Compiled with ./scripts/compile-idl-js from packages/sns/candid/sns_governance.did */
2
2
  export const idlFactory = ({ IDL }) => {
3
+ const PreciseValue = IDL.Rec();
3
4
  const Timers = IDL.Record({
4
5
  'last_spawned_timestamp_seconds' : IDL.Opt(IDL.Nat64),
5
6
  'last_reset_timestamp_seconds' : IDL.Opt(IDL.Nat64),
@@ -45,7 +46,26 @@ export const idlFactory = ({ IDL }) => {
45
46
  'description' : IDL.Opt(IDL.Text),
46
47
  'function_type' : IDL.Opt(FunctionType),
47
48
  });
49
+ const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
50
+ const Account = IDL.Record({
51
+ 'owner' : IDL.Opt(IDL.Principal),
52
+ 'subaccount' : IDL.Opt(Subaccount),
53
+ });
54
+ const TreasuryMetrics = IDL.Record({
55
+ 'name' : IDL.Opt(IDL.Text),
56
+ 'original_amount_e8s' : IDL.Opt(IDL.Nat64),
57
+ 'amount_e8s' : IDL.Opt(IDL.Nat64),
58
+ 'account' : IDL.Opt(Account),
59
+ 'ledger_canister_id' : IDL.Opt(IDL.Principal),
60
+ 'treasury' : IDL.Int32,
61
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
62
+ });
63
+ const VotingPowerMetrics = IDL.Record({
64
+ 'governance_total_potential_voting_power' : IDL.Opt(IDL.Nat64),
65
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
66
+ });
48
67
  const GovernanceCachedMetrics = IDL.Record({
68
+ 'treasury_metrics' : IDL.Vec(TreasuryMetrics),
49
69
  'not_dissolving_neurons_e8s_buckets' : IDL.Vec(
50
70
  IDL.Tuple(IDL.Nat64, IDL.Float64)
51
71
  ),
@@ -58,6 +78,7 @@ export const idlFactory = ({ IDL }) => {
58
78
  'dissolved_neurons_count' : IDL.Nat64,
59
79
  'total_staked_e8s' : IDL.Nat64,
60
80
  'total_supply_governance_tokens' : IDL.Nat64,
81
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
61
82
  'not_dissolving_neurons_count' : IDL.Nat64,
62
83
  'dissolved_neurons_e8s' : IDL.Nat64,
63
84
  'neurons_with_less_than_6_months_dissolve_delay_e8s' : IDL.Nat64,
@@ -185,11 +206,6 @@ export const idlFactory = ({ IDL }) => {
185
206
  'error_message' : IDL.Text,
186
207
  'error_type' : IDL.Int32,
187
208
  });
188
- const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
189
- const Account = IDL.Record({
190
- 'owner' : IDL.Opt(IDL.Principal),
191
- 'subaccount' : IDL.Opt(Subaccount),
192
- });
193
209
  const Decimal = IDL.Record({ 'human_readable' : IDL.Opt(IDL.Text) });
194
210
  const Tokens = IDL.Record({ 'e8s' : IDL.Opt(IDL.Nat64) });
195
211
  const ValuationFactors = IDL.Record({
@@ -247,6 +263,27 @@ export const idlFactory = ({ IDL }) => {
247
263
  const SetTopicsForCustomProposals = IDL.Record({
248
264
  'custom_function_id_to_topic' : IDL.Vec(IDL.Tuple(IDL.Nat64, Topic)),
249
265
  });
266
+ const ChunkedCanisterWasm = IDL.Record({
267
+ 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
268
+ 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
269
+ 'store_canister_id' : IDL.Opt(IDL.Principal),
270
+ });
271
+ PreciseValue.fill(
272
+ IDL.Variant({
273
+ 'Int' : IDL.Int64,
274
+ 'Map' : IDL.Vec(IDL.Tuple(IDL.Text, PreciseValue)),
275
+ 'Nat' : IDL.Nat64,
276
+ 'Blob' : IDL.Vec(IDL.Nat8),
277
+ 'Bool' : IDL.Bool,
278
+ 'Text' : IDL.Text,
279
+ 'Array' : IDL.Vec(PreciseValue),
280
+ })
281
+ );
282
+ const ExtensionInit = IDL.Record({ 'value' : IDL.Opt(PreciseValue) });
283
+ const RegisterExtension = IDL.Record({
284
+ 'chunked_canister_wasm' : IDL.Opt(ChunkedCanisterWasm),
285
+ 'extension_init' : IDL.Opt(ExtensionInit),
286
+ });
250
287
  const RegisterDappCanisters = IDL.Record({
251
288
  'canister_ids' : IDL.Vec(IDL.Principal),
252
289
  });
@@ -257,11 +294,6 @@ export const idlFactory = ({ IDL }) => {
257
294
  'memo' : IDL.Opt(IDL.Nat64),
258
295
  'amount_e8s' : IDL.Nat64,
259
296
  });
260
- const ChunkedCanisterWasm = IDL.Record({
261
- 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
262
- 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
263
- 'store_canister_id' : IDL.Opt(IDL.Principal),
264
- });
265
297
  const UpgradeSnsControlledCanister = IDL.Record({
266
298
  'new_canister_wasm' : IDL.Vec(IDL.Nat8),
267
299
  'mode' : IDL.Opt(IDL.Int32),
@@ -305,6 +337,7 @@ export const idlFactory = ({ IDL }) => {
305
337
  'ManageDappCanisterSettings' : ManageDappCanisterSettings,
306
338
  'RemoveGenericNervousSystemFunction' : IDL.Nat64,
307
339
  'SetTopicsForCustomProposals' : SetTopicsForCustomProposals,
340
+ 'RegisterExtension' : RegisterExtension,
308
341
  'UpgradeSnsToNextVersion' : IDL.Record({}),
309
342
  'RegisterDappCanisters' : RegisterDappCanisters,
310
343
  'TransferSnsTreasuryFunds' : TransferSnsTreasuryFunds,
@@ -556,8 +589,12 @@ export const idlFactory = ({ IDL }) => {
556
589
  'time_window_seconds' : IDL.Opt(IDL.Nat64),
557
590
  });
558
591
  const Metrics = IDL.Record({
592
+ 'treasury_metrics' : IDL.Opt(IDL.Vec(TreasuryMetrics)),
593
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
559
594
  'last_ledger_block_timestamp' : IDL.Opt(IDL.Nat64),
595
+ 'num_recently_executed_proposals' : IDL.Opt(IDL.Nat64),
560
596
  'num_recently_submitted_proposals' : IDL.Opt(IDL.Nat64),
597
+ 'genesis_timestamp_seconds' : IDL.Opt(IDL.Nat64),
561
598
  });
562
599
  const GetMetricsResult = IDL.Variant({
563
600
  'Ok' : Metrics,
@@ -753,6 +790,11 @@ export const idlFactory = ({ IDL }) => {
753
790
  [GetMetricsResponse],
754
791
  ['composite_query'],
755
792
  ),
793
+ 'get_metrics_replicated' : IDL.Func(
794
+ [GetMetricsRequest],
795
+ [GetMetricsResponse],
796
+ [],
797
+ ),
756
798
  'get_mode' : IDL.Func([IDL.Record({})], [GetModeResponse], ['query']),
757
799
  'get_nervous_system_parameters' : IDL.Func(
758
800
  [IDL.Null],
@@ -804,6 +846,7 @@ export const idlFactory = ({ IDL }) => {
804
846
  });
805
847
  };
806
848
  export const init = ({ IDL }) => {
849
+ const PreciseValue = IDL.Rec();
807
850
  const Timers = IDL.Record({
808
851
  'last_spawned_timestamp_seconds' : IDL.Opt(IDL.Nat64),
809
852
  'last_reset_timestamp_seconds' : IDL.Opt(IDL.Nat64),
@@ -849,7 +892,26 @@ export const init = ({ IDL }) => {
849
892
  'description' : IDL.Opt(IDL.Text),
850
893
  'function_type' : IDL.Opt(FunctionType),
851
894
  });
895
+ const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
896
+ const Account = IDL.Record({
897
+ 'owner' : IDL.Opt(IDL.Principal),
898
+ 'subaccount' : IDL.Opt(Subaccount),
899
+ });
900
+ const TreasuryMetrics = IDL.Record({
901
+ 'name' : IDL.Opt(IDL.Text),
902
+ 'original_amount_e8s' : IDL.Opt(IDL.Nat64),
903
+ 'amount_e8s' : IDL.Opt(IDL.Nat64),
904
+ 'account' : IDL.Opt(Account),
905
+ 'ledger_canister_id' : IDL.Opt(IDL.Principal),
906
+ 'treasury' : IDL.Int32,
907
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
908
+ });
909
+ const VotingPowerMetrics = IDL.Record({
910
+ 'governance_total_potential_voting_power' : IDL.Opt(IDL.Nat64),
911
+ 'timestamp_seconds' : IDL.Opt(IDL.Nat64),
912
+ });
852
913
  const GovernanceCachedMetrics = IDL.Record({
914
+ 'treasury_metrics' : IDL.Vec(TreasuryMetrics),
853
915
  'not_dissolving_neurons_e8s_buckets' : IDL.Vec(
854
916
  IDL.Tuple(IDL.Nat64, IDL.Float64)
855
917
  ),
@@ -862,6 +924,7 @@ export const init = ({ IDL }) => {
862
924
  'dissolved_neurons_count' : IDL.Nat64,
863
925
  'total_staked_e8s' : IDL.Nat64,
864
926
  'total_supply_governance_tokens' : IDL.Nat64,
927
+ 'voting_power_metrics' : IDL.Opt(VotingPowerMetrics),
865
928
  'not_dissolving_neurons_count' : IDL.Nat64,
866
929
  'dissolved_neurons_e8s' : IDL.Nat64,
867
930
  'neurons_with_less_than_6_months_dissolve_delay_e8s' : IDL.Nat64,
@@ -989,11 +1052,6 @@ export const init = ({ IDL }) => {
989
1052
  'error_message' : IDL.Text,
990
1053
  'error_type' : IDL.Int32,
991
1054
  });
992
- const Subaccount = IDL.Record({ 'subaccount' : IDL.Vec(IDL.Nat8) });
993
- const Account = IDL.Record({
994
- 'owner' : IDL.Opt(IDL.Principal),
995
- 'subaccount' : IDL.Opt(Subaccount),
996
- });
997
1055
  const Decimal = IDL.Record({ 'human_readable' : IDL.Opt(IDL.Text) });
998
1056
  const Tokens = IDL.Record({ 'e8s' : IDL.Opt(IDL.Nat64) });
999
1057
  const ValuationFactors = IDL.Record({
@@ -1051,6 +1109,27 @@ export const init = ({ IDL }) => {
1051
1109
  const SetTopicsForCustomProposals = IDL.Record({
1052
1110
  'custom_function_id_to_topic' : IDL.Vec(IDL.Tuple(IDL.Nat64, Topic)),
1053
1111
  });
1112
+ const ChunkedCanisterWasm = IDL.Record({
1113
+ 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
1114
+ 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
1115
+ 'store_canister_id' : IDL.Opt(IDL.Principal),
1116
+ });
1117
+ PreciseValue.fill(
1118
+ IDL.Variant({
1119
+ 'Int' : IDL.Int64,
1120
+ 'Map' : IDL.Vec(IDL.Tuple(IDL.Text, PreciseValue)),
1121
+ 'Nat' : IDL.Nat64,
1122
+ 'Blob' : IDL.Vec(IDL.Nat8),
1123
+ 'Bool' : IDL.Bool,
1124
+ 'Text' : IDL.Text,
1125
+ 'Array' : IDL.Vec(PreciseValue),
1126
+ })
1127
+ );
1128
+ const ExtensionInit = IDL.Record({ 'value' : IDL.Opt(PreciseValue) });
1129
+ const RegisterExtension = IDL.Record({
1130
+ 'chunked_canister_wasm' : IDL.Opt(ChunkedCanisterWasm),
1131
+ 'extension_init' : IDL.Opt(ExtensionInit),
1132
+ });
1054
1133
  const RegisterDappCanisters = IDL.Record({
1055
1134
  'canister_ids' : IDL.Vec(IDL.Principal),
1056
1135
  });
@@ -1061,11 +1140,6 @@ export const init = ({ IDL }) => {
1061
1140
  'memo' : IDL.Opt(IDL.Nat64),
1062
1141
  'amount_e8s' : IDL.Nat64,
1063
1142
  });
1064
- const ChunkedCanisterWasm = IDL.Record({
1065
- 'wasm_module_hash' : IDL.Vec(IDL.Nat8),
1066
- 'chunk_hashes_list' : IDL.Vec(IDL.Vec(IDL.Nat8)),
1067
- 'store_canister_id' : IDL.Opt(IDL.Principal),
1068
- });
1069
1143
  const UpgradeSnsControlledCanister = IDL.Record({
1070
1144
  'new_canister_wasm' : IDL.Vec(IDL.Nat8),
1071
1145
  'mode' : IDL.Opt(IDL.Int32),
@@ -1109,6 +1183,7 @@ export const init = ({ IDL }) => {
1109
1183
  'ManageDappCanisterSettings' : ManageDappCanisterSettings,
1110
1184
  'RemoveGenericNervousSystemFunction' : IDL.Nat64,
1111
1185
  'SetTopicsForCustomProposals' : SetTopicsForCustomProposals,
1186
+ 'RegisterExtension' : RegisterExtension,
1112
1187
  'UpgradeSnsToNextVersion' : IDL.Record({}),
1113
1188
  'RegisterDappCanisters' : RegisterDappCanisters,
1114
1189
  'TransferSnsTreasuryFunds' : TransferSnsTreasuryFunds,