@dfinity/cmc 7.0.1 → 8.0.0-next-2025-11-18

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  // @ts-nocheck
4
4
 
5
- // This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
5
+ // This file was automatically generated by @icp-sdk/bindgen@0.2.0.
6
6
  // You should NOT make any changes in this file as it will be overwritten.
7
7
  // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
8
8
 
@@ -20,6 +20,14 @@ export const idlFactory = ({ IDL }) => {
20
20
  minting_account_id: IDL.Opt(AccountIdentifier),
21
21
  ledger_canister_id: IDL.Opt(IDL.Principal),
22
22
  });
23
+ const SubnetListWithType = IDL.Record({
24
+ subnets: IDL.Vec(IDL.Principal),
25
+ subnet_type: IDL.Text,
26
+ });
27
+ const ChangeSubnetTypeAssignmentArgs = IDL.Variant({
28
+ Add: SubnetListWithType,
29
+ Remove: SubnetListWithType,
30
+ });
23
31
  const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });
24
32
  const SubnetSelection = IDL.Variant({
25
33
  Filter: SubnetFilter,
@@ -32,6 +40,7 @@ export const idlFactory = ({ IDL }) => {
32
40
  const log_visibility = IDL.Variant({
33
41
  controllers: IDL.Null,
34
42
  public: IDL.Null,
43
+ allowed_viewers: IDL.Vec(IDL.Principal),
35
44
  });
36
45
  const CanisterSettings = IDL.Record({
37
46
  freezing_threshold: IDL.Opt(IDL.Nat),
@@ -40,6 +49,7 @@ export const idlFactory = ({ IDL }) => {
40
49
  controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
41
50
  reserved_cycles_limit: IDL.Opt(IDL.Nat),
42
51
  log_visibility: IDL.Opt(log_visibility),
52
+ log_memory_limit: IDL.Opt(IDL.Nat),
43
53
  wasm_memory_limit: IDL.Opt(IDL.Nat),
44
54
  memory_allocation: IDL.Opt(IDL.Nat),
45
55
  compute_allocation: IDL.Opt(IDL.Nat),
@@ -121,8 +131,21 @@ export const idlFactory = ({ IDL }) => {
121
131
  });
122
132
  const Cycles = IDL.Nat;
123
133
  const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });
134
+ const SetAuthorizedSubnetworkListArgs = IDL.Record({
135
+ who: IDL.Opt(IDL.Principal),
136
+ subnets: IDL.Vec(IDL.Principal),
137
+ });
138
+ const UpdateSubnetTypeArgs = IDL.Variant({
139
+ Add: IDL.Text,
140
+ Remove: IDL.Text,
141
+ });
124
142
 
125
143
  return IDL.Service({
144
+ change_subnet_type_assignment: IDL.Func(
145
+ [ChangeSubnetTypeAssignmentArgs],
146
+ [],
147
+ [],
148
+ ),
126
149
  create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),
127
150
  get_build_metadata: IDL.Func([], [IDL.Text], []),
128
151
  get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),
@@ -152,6 +175,12 @@ export const idlFactory = ({ IDL }) => {
152
175
  [],
153
176
  ),
154
177
  notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
178
+ set_authorized_subnetwork_list: IDL.Func(
179
+ [SetAuthorizedSubnetworkListArgs],
180
+ [],
181
+ [],
182
+ ),
183
+ update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),
155
184
  });
156
185
  };
157
186
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  // @ts-nocheck
4
4
 
5
- // This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
5
+ // This file was automatically generated by @icp-sdk/bindgen@0.2.0.
6
6
  // You should NOT make any changes in this file as it will be overwritten.
7
7
  // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
8
8
 
@@ -19,10 +19,14 @@ export interface CanisterSettings {
19
19
  controllers: [] | [Array<Principal>];
20
20
  reserved_cycles_limit: [] | [bigint];
21
21
  log_visibility: [] | [log_visibility];
22
+ log_memory_limit: [] | [bigint];
22
23
  wasm_memory_limit: [] | [bigint];
23
24
  memory_allocation: [] | [bigint];
24
25
  compute_allocation: [] | [bigint];
25
26
  }
27
+ export type ChangeSubnetTypeAssignmentArgs =
28
+ | { Add: SubnetListWithType }
29
+ | { Remove: SubnetListWithType };
26
30
  /**
27
31
  * The argument of the [create_canister] method.
28
32
  */
@@ -106,7 +110,7 @@ export interface IcpXdrConversionRateResponse {
106
110
  * System certificate as specified in
107
111
  * https://internetcomputer.org/docs/interface-spec/index.html#certification-encoding
108
112
  */
109
- certificate: Uint8Array | number[];
113
+ certificate: Uint8Array;
110
114
  /**
111
115
  * The latest ICP/XDR conversion rate.
112
116
  */
@@ -123,9 +127,9 @@ export interface IcpXdrConversionRateResponse {
123
127
  * `-- AVERAGE_ICP_XDR_CONVERSION_RATE -- [ Candid encoded IcpXdrConversionRate ]
124
128
  * ```
125
129
  */
126
- hash_tree: Uint8Array | number[];
130
+ hash_tree: Uint8Array;
127
131
  }
128
- export type Memo = [] | [Uint8Array | number[]];
132
+ export type Memo = [] | [Uint8Array];
129
133
  /**
130
134
  * The argument of the [notify_create_canister] method.
131
135
  */
@@ -255,10 +259,18 @@ export type NotifyTopUpResult =
255
259
  export interface PrincipalsAuthorizedToCreateCanistersToSubnetsResponse {
256
260
  data: Array<[Principal, Array<Principal>]>;
257
261
  }
258
- export type Subaccount = [] | [Uint8Array | number[]];
262
+ export interface SetAuthorizedSubnetworkListArgs {
263
+ who: [] | [Principal];
264
+ subnets: Array<Principal>;
265
+ }
266
+ export type Subaccount = [] | [Uint8Array];
259
267
  export interface SubnetFilter {
260
268
  subnet_type: [] | [string];
261
269
  }
270
+ export interface SubnetListWithType {
271
+ subnets: Array<Principal>;
272
+ subnet_type: string;
273
+ }
262
274
  export type SubnetSelection =
263
275
  | {
264
276
  /**
@@ -275,12 +287,20 @@ export type SubnetSelection =
275
287
  export interface SubnetTypesToSubnetsResponse {
276
288
  data: Array<[string, Array<Principal>]>;
277
289
  }
290
+ export type UpdateSubnetTypeArgs = { Add: string } | { Remove: string };
278
291
  export interface environment_variable {
279
292
  value: string;
280
293
  name: string;
281
294
  }
282
- export type log_visibility = { controllers: null } | { public: null };
295
+ export type log_visibility =
296
+ | { controllers: null }
297
+ | { public: null }
298
+ | { allowed_viewers: Array<Principal> };
283
299
  export interface _SERVICE {
300
+ change_subnet_type_assignment: ActorMethod<
301
+ [ChangeSubnetTypeAssignmentArgs],
302
+ undefined
303
+ >;
284
304
  /**
285
305
  * Creates a canister using the cycles attached to the function call.
286
306
  */
@@ -322,6 +342,14 @@ export interface _SERVICE {
322
342
  * into cycles and sending the cycles the specified canister.
323
343
  */
324
344
  notify_top_up: ActorMethod<[NotifyTopUpArg], NotifyTopUpResult>;
345
+ /**
346
+ * Below are methods that can only be called by other NNS canisters.
347
+ */
348
+ set_authorized_subnetwork_list: ActorMethod<
349
+ [SetAuthorizedSubnetworkListArgs],
350
+ undefined
351
+ >;
352
+ update_subnet_type: ActorMethod<[UpdateSubnetTypeArgs], undefined>;
325
353
  }
326
354
  export declare const idlFactory: IDL.InterfaceFactory;
327
355
  export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -1,10 +1,11 @@
1
- // Generated from IC repo commit 199fb79 (2025-10-29 tags: release-2025-10-30_03-22-base) 'rs/nns/cmc/cmc.did' by import-candid
1
+ // Generated from IC repo commit fa06b0e (2025-11-12 tags: release-2025-11-13_03-24-base) 'rs/nns/cmc/cmc.did' by import-candid
2
2
 
3
3
  type Cycles = nat;
4
4
  type BlockIndex = nat64;
5
5
  type log_visibility = variant {
6
6
  controllers;
7
7
  public;
8
+ allowed_viewers : vec principal;
8
9
  };
9
10
  type environment_variable = record {
10
11
  name: text;
@@ -20,6 +21,7 @@ type CanisterSettings = record {
20
21
  wasm_memory_limit : opt nat;
21
22
  wasm_memory_threshold : opt nat;
22
23
  environment_variables : opt vec environment_variable;
24
+ log_memory_limit : opt nat;
23
25
  };
24
26
  type Subaccount = opt blob;
25
27
  type Memo = opt blob;
@@ -218,6 +220,26 @@ type NotifyMintCyclesSuccess = record {
218
220
  balance : nat;
219
221
  };
220
222
 
223
+ type SetAuthorizedSubnetworkListArgs = record {
224
+ who : opt principal;
225
+ subnets : vec principal;
226
+ };
227
+
228
+ type UpdateSubnetTypeArgs = variant {
229
+ Add : text;
230
+ Remove : text;
231
+ };
232
+
233
+ type SubnetListWithType = record {
234
+ subnets : vec principal;
235
+ subnet_type : text;
236
+ };
237
+
238
+ type ChangeSubnetTypeAssignmentArgs = variant {
239
+ Add : SubnetListWithType;
240
+ Remove : SubnetListWithType;
241
+ };
242
+
221
243
  service : (opt CyclesCanisterInitPayload) -> {
222
244
  // Prompts the cycles minting canister to process a payment by converting ICP
223
245
  // into cycles and sending the cycles the specified canister.
@@ -245,4 +267,9 @@ service : (opt CyclesCanisterInitPayload) -> {
245
267
  get_default_subnets: () -> (vec principal) query;
246
268
 
247
269
  get_build_metadata : () -> (text) query;
270
+
271
+ // Below are methods that can only be called by other NNS canisters.
272
+ set_authorized_subnetwork_list : (SetAuthorizedSubnetworkListArgs) -> ();
273
+ update_subnet_type : (UpdateSubnetTypeArgs) -> ();
274
+ change_subnet_type_assignment : (ChangeSubnetTypeAssignmentArgs) -> ();
248
275
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  // @ts-nocheck
4
4
 
5
- // This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
5
+ // This file was automatically generated by @icp-sdk/bindgen@0.2.0.
6
6
  // You should NOT make any changes in this file as it will be overwritten.
7
7
  // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
8
8
 
@@ -20,6 +20,14 @@ export const idlFactory = ({ IDL }) => {
20
20
  minting_account_id: IDL.Opt(AccountIdentifier),
21
21
  ledger_canister_id: IDL.Opt(IDL.Principal),
22
22
  });
23
+ const SubnetListWithType = IDL.Record({
24
+ subnets: IDL.Vec(IDL.Principal),
25
+ subnet_type: IDL.Text,
26
+ });
27
+ const ChangeSubnetTypeAssignmentArgs = IDL.Variant({
28
+ Add: SubnetListWithType,
29
+ Remove: SubnetListWithType,
30
+ });
23
31
  const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });
24
32
  const SubnetSelection = IDL.Variant({
25
33
  Filter: SubnetFilter,
@@ -32,6 +40,7 @@ export const idlFactory = ({ IDL }) => {
32
40
  const log_visibility = IDL.Variant({
33
41
  controllers: IDL.Null,
34
42
  public: IDL.Null,
43
+ allowed_viewers: IDL.Vec(IDL.Principal),
35
44
  });
36
45
  const CanisterSettings = IDL.Record({
37
46
  freezing_threshold: IDL.Opt(IDL.Nat),
@@ -40,6 +49,7 @@ export const idlFactory = ({ IDL }) => {
40
49
  controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
41
50
  reserved_cycles_limit: IDL.Opt(IDL.Nat),
42
51
  log_visibility: IDL.Opt(log_visibility),
52
+ log_memory_limit: IDL.Opt(IDL.Nat),
43
53
  wasm_memory_limit: IDL.Opt(IDL.Nat),
44
54
  memory_allocation: IDL.Opt(IDL.Nat),
45
55
  compute_allocation: IDL.Opt(IDL.Nat),
@@ -121,8 +131,21 @@ export const idlFactory = ({ IDL }) => {
121
131
  });
122
132
  const Cycles = IDL.Nat;
123
133
  const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });
134
+ const SetAuthorizedSubnetworkListArgs = IDL.Record({
135
+ who: IDL.Opt(IDL.Principal),
136
+ subnets: IDL.Vec(IDL.Principal),
137
+ });
138
+ const UpdateSubnetTypeArgs = IDL.Variant({
139
+ Add: IDL.Text,
140
+ Remove: IDL.Text,
141
+ });
124
142
 
125
143
  return IDL.Service({
144
+ change_subnet_type_assignment: IDL.Func(
145
+ [ChangeSubnetTypeAssignmentArgs],
146
+ [],
147
+ [],
148
+ ),
126
149
  create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),
127
150
  get_build_metadata: IDL.Func([], [IDL.Text], ["query"]),
128
151
  get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], ["query"]),
@@ -152,6 +175,12 @@ export const idlFactory = ({ IDL }) => {
152
175
  [],
153
176
  ),
154
177
  notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
178
+ set_authorized_subnetwork_list: IDL.Func(
179
+ [SetAuthorizedSubnetworkListArgs],
180
+ [],
181
+ [],
182
+ ),
183
+ update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),
155
184
  });
156
185
  };
157
186
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @module api/cmc
3
+ */
1
4
  export type { Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse, } from "./candid/cmc";
2
5
  export { CMCCanister } from "./cmc.canister";
3
6
  export * from "./cmc.errors";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{Canister as $,createServices as Q}from"@dfinity/utils";var U=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Record({value:t.Text,name:t.Text}),l=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(p)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(l),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),_=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),d=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),u=t.Variant({Ok:t.Principal,Err:d}),y=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),m=t.Record({certificate:t.Vec(t.Nat8),data:y,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),g=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),x=t.Record({block_index:r,deposit_memo:g,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),T=t.Variant({Ok:R,Err:i}),P=t.Record({block_index:r,canister_id:t.Principal}),h=t.Nat,S=t.Variant({Ok:h,Err:i});return t.Service({create_canister:t.Func([_],[u],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[m],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],[]),get_subnet_types_to_subnets:t.Func([],[f],[]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([x],[T],[]),notify_top_up:t.Func([P],[S],[])})};var M=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Record({value:t.Text,name:t.Text}),l=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(p)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(l),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),_=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),d=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),u=t.Variant({Ok:t.Principal,Err:d}),y=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),m=t.Record({certificate:t.Vec(t.Nat8),data:y,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),g=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),x=t.Record({block_index:r,deposit_memo:g,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),T=t.Variant({Ok:R,Err:i}),P=t.Record({block_index:r,canister_id:t.Principal}),h=t.Nat,S=t.Variant({Ok:h,Err:i});return t.Service({create_canister:t.Func([_],[u],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[m],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],["query"]),get_subnet_types_to_subnets:t.Func([],[f],["query"]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([x],[T],[]),notify_top_up:t.Func([P],[S],[])})};import{assertNever as z,jsonReplacer as q}from"@dfinity/utils";var v=class extends Error{},V=class extends Error{},E=class extends Error{},F=class extends Error{},k=class extends Error{},w=({Err:t})=>{if("Refunded"in t)throw new v(t.Refunded.reason);if("InvalidTransaction"in t)throw new V(t.InvalidTransaction);if("Processing"in t)throw new F;if("TransactionTooOld"in t)throw new k;if("Other"in t)throw new E(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);z(t,`Unsupported error type ${JSON.stringify(t,q)}`)};var A=class t extends ${static create(n){let{service:e,certifiedService:s,canisterId:c}=Q({options:n,idlFactory:M,certifiedIdlFactory:U});return new t(c,e,s)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&w(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&w(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{A as CMCCanister,E as CMCError,V as InvalidaTransactionError,F as ProcessingError,v as RefundedError,k as TransactionTooOldError,w as throwNotifyError};
1
+ import{Canister as B,createServices as W}from"@dfinity/utils";var $=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnets:t.Vec(t.Principal),subnet_type:t.Text}),p=t.Variant({Add:i,Remove:i}),l=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:l,Subnet:t.Record({subnet:t.Principal})}),_=t.Record({value:t.Text,name:t.Text}),d=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(_)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(d),log_memory_limit:t.Opt(t.Nat),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),u=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),y=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),m=t.Variant({Ok:t.Principal,Err:y}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),g=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:c}),x=t.Opt(t.Vec(t.Nat8)),R=t.Opt(t.Vec(t.Nat8)),T=t.Record({block_index:r,deposit_memo:x,to_subaccount:R}),P=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),h=t.Variant({Ok:P,Err:c}),S=t.Record({block_index:r,canister_id:t.Principal}),V=t.Nat,v=t.Variant({Ok:V,Err:c}),w=t.Record({who:t.Opt(t.Principal),subnets:t.Vec(t.Principal)}),A=t.Variant({Add:t.Text,Remove:t.Text});return t.Service({change_subnet_type_assignment:t.Func([p],[],[]),create_canister:t.Func([u],[m],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[g],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],[]),get_subnet_types_to_subnets:t.Func([],[f],[]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([T],[h],[]),notify_top_up:t.Func([S],[v],[]),set_authorized_subnetwork_list:t.Func([w],[],[]),update_subnet_type:t.Func([A],[],[])})};var Q=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnets:t.Vec(t.Principal),subnet_type:t.Text}),p=t.Variant({Add:i,Remove:i}),l=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:l,Subnet:t.Record({subnet:t.Principal})}),_=t.Record({value:t.Text,name:t.Text}),d=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(_)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(d),log_memory_limit:t.Opt(t.Nat),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),u=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),y=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),m=t.Variant({Ok:t.Principal,Err:y}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),g=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:c}),x=t.Opt(t.Vec(t.Nat8)),R=t.Opt(t.Vec(t.Nat8)),T=t.Record({block_index:r,deposit_memo:x,to_subaccount:R}),P=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),h=t.Variant({Ok:P,Err:c}),S=t.Record({block_index:r,canister_id:t.Principal}),V=t.Nat,v=t.Variant({Ok:V,Err:c}),w=t.Record({who:t.Opt(t.Principal),subnets:t.Vec(t.Principal)}),A=t.Variant({Add:t.Text,Remove:t.Text});return t.Service({change_subnet_type_assignment:t.Func([p],[],[]),create_canister:t.Func([u],[m],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[g],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],["query"]),get_subnet_types_to_subnets:t.Func([],[f],["query"]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([T],[h],[]),notify_top_up:t.Func([S],[v],[]),set_authorized_subnetwork_list:t.Func([w],[],[]),update_subnet_type:t.Func([A],[],[])})};import{assertNever as X,jsonReplacer as J}from"@dfinity/utils";var F=class extends Error{},k=class extends Error{},E=class extends Error{},U=class extends Error{},M=class extends Error{},z=({Err:t})=>{if("Refunded"in t)throw new F(t.Refunded.reason);if("InvalidTransaction"in t)throw new k(t.InvalidTransaction);if("Processing"in t)throw new U;if("TransactionTooOld"in t)throw new M;if("Other"in t)throw new E(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);X(t,`Unsupported error type ${JSON.stringify(t,J)}`)};var q=class t extends B{static create(n){let{service:e,certifiedService:a,canisterId:i}=W({options:n,idlFactory:Q,certifiedIdlFactory:$});return new t(i,e,a)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&z(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&z(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{q as CMCCanister,E as CMCError,k as InvalidaTransactionError,U as ProcessingError,F as RefundedError,M as TransactionTooOldError,z as throwNotifyError};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/cmc.canister.ts", "../src/candid/cmc.certified.idl.js", "../src/candid/cmc.idl.js", "../src/cmc.errors.ts"],
4
- "sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
5
- "mappings": "AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCQpD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAKA,EAAI,UACT,MAAOA,EAAI,IACb,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAAwBA,EAAI,IAAIC,CAAoB,EACpD,0BAA2BD,EAAI,IAAIA,EAAI,SAAS,EAChD,yBAA0BA,EAAI,IAAIA,EAAI,KAAK,EAC3C,uBAAwBA,EAAI,IAAIA,EAAI,SAAS,EAC7C,mBAAoBA,EAAI,IAAIE,CAAiB,EAC7C,mBAAoBF,EAAI,IAAIA,EAAI,SAAS,CAC3C,CAAC,EACKI,EAAeJ,EAAI,OAAO,CAAE,YAAaA,EAAI,IAAIA,EAAI,IAAI,CAAE,CAAC,EAC5DK,EAAkBL,EAAI,QAAQ,CAClC,OAAQI,EACR,OAAQJ,EAAI,OAAO,CAAE,OAAQA,EAAI,SAAU,CAAC,CAC9C,CAAC,EACKM,EAAuBN,EAAI,OAAO,CACtC,MAAOA,EAAI,KACX,KAAMA,EAAI,IACZ,CAAC,EACKO,EAAiBP,EAAI,QAAQ,CACjC,YAAaA,EAAI,KACjB,OAAQA,EAAI,IACd,CAAC,EACKQ,EAAmBR,EAAI,OAAO,C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A6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
6
- "names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
4
+ "sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetListWithType = IDL.Record({\n subnets: IDL.Vec(IDL.Principal),\n subnet_type: IDL.Text,\n });\n const ChangeSubnetTypeAssignmentArgs = IDL.Variant({\n Add: SubnetListWithType,\n Remove: SubnetListWithType,\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n allowed_viewers: IDL.Vec(IDL.Principal),\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n log_memory_limit: IDL.Opt(IDL.Nat),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n const SetAuthorizedSubnetworkListArgs = IDL.Record({\n who: IDL.Opt(IDL.Principal),\n subnets: IDL.Vec(IDL.Principal),\n });\n const UpdateSubnetTypeArgs = IDL.Variant({\n Add: IDL.Text,\n Remove: IDL.Text,\n });\n\n return IDL.Service({\n change_subnet_type_assignment: IDL.Func(\n [ChangeSubnetTypeAssignmentArgs],\n [],\n [],\n ),\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n set_authorized_subnetwork_list: IDL.Func(\n [SetAuthorizedSubnetworkListArgs],\n [],\n [],\n ),\n update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetListWithType = IDL.Record({\n subnets: IDL.Vec(IDL.Principal),\n subnet_type: IDL.Text,\n });\n const ChangeSubnetTypeAssignmentArgs = IDL.Variant({\n Add: SubnetListWithType,\n Remove: SubnetListWithType,\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n allowed_viewers: IDL.Vec(IDL.Principal),\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n log_memory_limit: IDL.Opt(IDL.Nat),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n const SetAuthorizedSubnetworkListArgs = IDL.Record({\n who: IDL.Opt(IDL.Principal),\n subnets: IDL.Vec(IDL.Principal),\n });\n const UpdateSubnetTypeArgs = IDL.Variant({\n Add: IDL.Text,\n Remove: IDL.Text,\n });\n\n return IDL.Service({\n change_subnet_type_assignment: IDL.Func(\n [ChangeSubnetTypeAssignmentArgs],\n [],\n [],\n ),\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n set_authorized_subnetwork_list: IDL.Func(\n [SetAuthorizedSubnetworkListArgs],\n [],\n [],\n ),\n update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],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,CACjC,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIP,EAAYK,EAAYF,EAASC,CAAgB,CAC9D,CAUO,6BAA+B,MAAO,CAC3C,UAAAI,CACF,EAAiB,CAAC,IAAuB,CACvC,GAAM,CAAE,KAAAC,CAAK,EAAI,MAAM,KAAK,OAAO,CACjC,UAAAD,CACF,CAAC,EAAE,4BAA4B,EAI/B,OAAOC,EAAK,qBACd,EAYO,qBAAuB,MAC5BC,GACuB,CACvB,IAAMC,EAAW,MAAM,KAAK,QAAQ,uBAAuBD,CAAO,EAIlE,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,qDAAqD,KAAK,UACxDA,CACF,CAAC,EACH,CACF,EAYO,YAAc,MAAOD,GAA6C,CACvE,IAAMC,EAAW,MAAM,KAAK,QAAQ,cAAcD,CAAO,EAIzD,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,4CAA4C,KAAK,UAAUA,CAAQ,CAAC,EACtE,CACF,EAaO,kBAAoB,CAAC,CAAE,UAAAH,CAAU,EAAiB,CAAC,IAErD,CACH,GAAM,CAAE,oBAAAK,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
6
+ "names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetListWithType", "ChangeSubnetTypeAssignmentArgs", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "SetAuthorizedSubnetworkListArgs", "UpdateSubnetTypeArgs", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetListWithType", "ChangeSubnetTypeAssignmentArgs", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "SetAuthorizedSubnetworkListArgs", "UpdateSubnetTypeArgs", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { createRequire as topLevelCreateRequire } from 'module';
2
2
  const require = topLevelCreateRequire(import.meta.url);
3
- import{Canister as $,createServices as Q}from"@dfinity/utils";var U=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Record({value:t.Text,name:t.Text}),l=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(p)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(l),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),_=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),d=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),u=t.Variant({Ok:t.Principal,Err:d}),y=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),m=t.Record({certificate:t.Vec(t.Nat8),data:y,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),g=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),x=t.Record({block_index:r,deposit_memo:g,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),T=t.Variant({Ok:R,Err:i}),P=t.Record({block_index:r,canister_id:t.Principal}),h=t.Nat,S=t.Variant({Ok:h,Err:i});return t.Service({create_canister:t.Func([_],[u],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[m],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],[]),get_subnet_types_to_subnets:t.Func([],[f],[]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([x],[T],[]),notify_top_up:t.Func([P],[S],[])})};var M=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Record({value:t.Text,name:t.Text}),l=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(p)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(l),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),_=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),d=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),u=t.Variant({Ok:t.Principal,Err:d}),y=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),m=t.Record({certificate:t.Vec(t.Nat8),data:y,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),g=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),x=t.Record({block_index:r,deposit_memo:g,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),T=t.Variant({Ok:R,Err:i}),P=t.Record({block_index:r,canister_id:t.Principal}),h=t.Nat,S=t.Variant({Ok:h,Err:i});return t.Service({create_canister:t.Func([_],[u],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[m],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],["query"]),get_subnet_types_to_subnets:t.Func([],[f],["query"]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([x],[T],[]),notify_top_up:t.Func([P],[S],[])})};import{assertNever as z,jsonReplacer as q}from"@dfinity/utils";var v=class extends Error{},V=class extends Error{},E=class extends Error{},F=class extends Error{},k=class extends Error{},w=({Err:t})=>{if("Refunded"in t)throw new v(t.Refunded.reason);if("InvalidTransaction"in t)throw new V(t.InvalidTransaction);if("Processing"in t)throw new F;if("TransactionTooOld"in t)throw new k;if("Other"in t)throw new E(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);z(t,`Unsupported error type ${JSON.stringify(t,q)}`)};var A=class t extends ${static create(n){let{service:e,certifiedService:s,canisterId:c}=Q({options:n,idlFactory:M,certifiedIdlFactory:U});return new t(c,e,s)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&w(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&w(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{A as CMCCanister,E as CMCError,V as InvalidaTransactionError,F as ProcessingError,v as RefundedError,k as TransactionTooOldError,w as throwNotifyError};
3
+ import{Canister as B,createServices as W}from"@dfinity/utils";var $=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnets:t.Vec(t.Principal),subnet_type:t.Text}),p=t.Variant({Add:i,Remove:i}),l=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:l,Subnet:t.Record({subnet:t.Principal})}),_=t.Record({value:t.Text,name:t.Text}),d=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(_)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(d),log_memory_limit:t.Opt(t.Nat),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),u=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),y=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),m=t.Variant({Ok:t.Principal,Err:y}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),g=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:c}),x=t.Opt(t.Vec(t.Nat8)),R=t.Opt(t.Vec(t.Nat8)),T=t.Record({block_index:r,deposit_memo:x,to_subaccount:R}),P=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),h=t.Variant({Ok:P,Err:c}),S=t.Record({block_index:r,canister_id:t.Principal}),V=t.Nat,v=t.Variant({Ok:V,Err:c}),w=t.Record({who:t.Opt(t.Principal),subnets:t.Vec(t.Principal)}),A=t.Variant({Add:t.Text,Remove:t.Text});return t.Service({change_subnet_type_assignment:t.Func([p],[],[]),create_canister:t.Func([u],[m],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[g],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],[]),get_subnet_types_to_subnets:t.Func([],[f],[]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([T],[h],[]),notify_top_up:t.Func([S],[v],[]),set_authorized_subnetwork_list:t.Func([w],[],[]),update_subnet_type:t.Func([A],[],[])})};var Q=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnets:t.Vec(t.Principal),subnet_type:t.Text}),p=t.Variant({Add:i,Remove:i}),l=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:l,Subnet:t.Record({subnet:t.Principal})}),_=t.Record({value:t.Text,name:t.Text}),d=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),environment_variables:t.Opt(t.Vec(_)),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(d),log_memory_limit:t.Opt(t.Nat),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),u=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),y=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),m=t.Variant({Ok:t.Principal,Err:y}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),g=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),f=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(s),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:c}),x=t.Opt(t.Vec(t.Nat8)),R=t.Opt(t.Vec(t.Nat8)),T=t.Record({block_index:r,deposit_memo:x,to_subaccount:R}),P=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),h=t.Variant({Ok:P,Err:c}),S=t.Record({block_index:r,canister_id:t.Principal}),V=t.Nat,v=t.Variant({Ok:V,Err:c}),w=t.Record({who:t.Opt(t.Principal),subnets:t.Vec(t.Principal)}),A=t.Variant({Add:t.Text,Remove:t.Text});return t.Service({change_subnet_type_assignment:t.Func([p],[],[]),create_canister:t.Func([u],[m],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],["query"]),get_icp_xdr_conversion_rate:t.Func([],[g],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],["query"]),get_subnet_types_to_subnets:t.Func([],[f],["query"]),notify_create_canister:t.Func([C],[N],[]),notify_mint_cycles:t.Func([T],[h],[]),notify_top_up:t.Func([S],[v],[]),set_authorized_subnetwork_list:t.Func([w],[],[]),update_subnet_type:t.Func([A],[],[])})};import{assertNever as X,jsonReplacer as J}from"@dfinity/utils";var F=class extends Error{},k=class extends Error{},E=class extends Error{},U=class extends Error{},M=class extends Error{},z=({Err:t})=>{if("Refunded"in t)throw new F(t.Refunded.reason);if("InvalidTransaction"in t)throw new k(t.InvalidTransaction);if("Processing"in t)throw new U;if("TransactionTooOld"in t)throw new M;if("Other"in t)throw new E(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);X(t,`Unsupported error type ${JSON.stringify(t,J)}`)};var q=class t extends B{static create(n){let{service:e,certifiedService:a,canisterId:i}=W({options:n,idlFactory:Q,certifiedIdlFactory:$});return new t(i,e,a)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&z(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&z(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{q as CMCCanister,E as CMCError,k as InvalidaTransactionError,U as ProcessingError,F as RefundedError,M as TransactionTooOldError,z as throwNotifyError};
4
4
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/cmc.canister.ts", "../src/candid/cmc.certified.idl.js", "../src/candid/cmc.idl.js", "../src/cmc.errors.ts"],
4
- "sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
5
- "mappings": ";;AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCQpD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAKA,EAAI,UACT,MAAOA,EAAI,IACb,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAAwBA,EAAI,IAAIC,CAAoB,EACpD,0BAA2BD,EA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GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,qDAAqD,KAAK,UACxDA,CACF,CAAC,EACH,CACF,EAYO,YAAc,MAAOD,GAA6C,CACvE,IAAMC,EAAW,MAAM,KAAK,QAAQ,cAAcD,CAAO,EAIzD,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,4CAA4C,KAAK,UAAUA,CAAQ,CAAC,EACtE,CACF,EAaO,kBAAoB,CAAC,CAAE,UAAAH,CAAU,EAAiB,CAAC,IAErD,CACH,GAAM,CAAE,oBAAAK,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
6
- "names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
4
+ "sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetListWithType = IDL.Record({\n subnets: IDL.Vec(IDL.Principal),\n subnet_type: IDL.Text,\n });\n const ChangeSubnetTypeAssignmentArgs = IDL.Variant({\n Add: SubnetListWithType,\n Remove: SubnetListWithType,\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n allowed_viewers: IDL.Vec(IDL.Principal),\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n log_memory_limit: IDL.Opt(IDL.Nat),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n const SetAuthorizedSubnetworkListArgs = IDL.Record({\n who: IDL.Opt(IDL.Principal),\n subnets: IDL.Vec(IDL.Principal),\n });\n const UpdateSubnetTypeArgs = IDL.Variant({\n Add: IDL.Text,\n Remove: IDL.Text,\n });\n\n return IDL.Service({\n change_subnet_type_assignment: IDL.Func(\n [ChangeSubnetTypeAssignmentArgs],\n [],\n [],\n ),\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n set_authorized_subnetwork_list: IDL.Func(\n [SetAuthorizedSubnetworkListArgs],\n [],\n [],\n ),\n update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetListWithType = IDL.Record({\n subnets: IDL.Vec(IDL.Principal),\n subnet_type: IDL.Text,\n });\n const ChangeSubnetTypeAssignmentArgs = IDL.Variant({\n Add: SubnetListWithType,\n Remove: SubnetListWithType,\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const environment_variable = IDL.Record({\n value: IDL.Text,\n name: IDL.Text,\n });\n const log_visibility = IDL.Variant({\n controllers: IDL.Null,\n public: IDL.Null,\n allowed_viewers: IDL.Vec(IDL.Principal),\n });\n const CanisterSettings = IDL.Record({\n freezing_threshold: IDL.Opt(IDL.Nat),\n wasm_memory_threshold: IDL.Opt(IDL.Nat),\n environment_variables: IDL.Opt(IDL.Vec(environment_variable)),\n controllers: IDL.Opt(IDL.Vec(IDL.Principal)),\n reserved_cycles_limit: IDL.Opt(IDL.Nat),\n log_visibility: IDL.Opt(log_visibility),\n log_memory_limit: IDL.Opt(IDL.Nat),\n wasm_memory_limit: IDL.Opt(IDL.Nat),\n memory_allocation: IDL.Opt(IDL.Nat),\n compute_allocation: IDL.Opt(IDL.Nat),\n });\n const CreateCanisterArg = IDL.Record({\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const CreateCanisterError = IDL.Variant({\n Refunded: IDL.Record({\n create_error: IDL.Text,\n refund_amount: IDL.Nat,\n }),\n });\n const CreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: CreateCanisterError,\n });\n const IcpXdrConversionRate = IDL.Record({\n xdr_permyriad_per_icp: IDL.Nat64,\n timestamp_seconds: IDL.Nat64,\n });\n const IcpXdrConversionRateResponse = IDL.Record({\n certificate: IDL.Vec(IDL.Nat8),\n data: IcpXdrConversionRate,\n hash_tree: IDL.Vec(IDL.Nat8),\n });\n const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),\n });\n const SubnetTypesToSubnetsResponse = IDL.Record({\n data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),\n });\n const BlockIndex = IDL.Nat64;\n const NotifyCreateCanisterArg = IDL.Record({\n controller: IDL.Principal,\n block_index: BlockIndex,\n subnet_selection: IDL.Opt(SubnetSelection),\n settings: IDL.Opt(CanisterSettings),\n subnet_type: IDL.Opt(IDL.Text),\n });\n const NotifyError = IDL.Variant({\n Refunded: IDL.Record({\n block_index: IDL.Opt(BlockIndex),\n reason: IDL.Text,\n }),\n InvalidTransaction: IDL.Text,\n Other: IDL.Record({\n error_message: IDL.Text,\n error_code: IDL.Nat64,\n }),\n Processing: IDL.Null,\n TransactionTooOld: BlockIndex,\n });\n const NotifyCreateCanisterResult = IDL.Variant({\n Ok: IDL.Principal,\n Err: NotifyError,\n });\n const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));\n const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));\n const NotifyMintCyclesArg = IDL.Record({\n block_index: BlockIndex,\n deposit_memo: Memo,\n to_subaccount: Subaccount,\n });\n const NotifyMintCyclesSuccess = IDL.Record({\n balance: IDL.Nat,\n block_index: IDL.Nat,\n minted: IDL.Nat,\n });\n const NotifyMintCyclesResult = IDL.Variant({\n Ok: NotifyMintCyclesSuccess,\n Err: NotifyError,\n });\n const NotifyTopUpArg = IDL.Record({\n block_index: BlockIndex,\n canister_id: IDL.Principal,\n });\n const Cycles = IDL.Nat;\n const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });\n const SetAuthorizedSubnetworkListArgs = IDL.Record({\n who: IDL.Opt(IDL.Principal),\n subnets: IDL.Vec(IDL.Principal),\n });\n const UpdateSubnetTypeArgs = IDL.Variant({\n Add: IDL.Text,\n Remove: IDL.Text,\n });\n\n return IDL.Service({\n change_subnet_type_assignment: IDL.Func(\n [ChangeSubnetTypeAssignmentArgs],\n [],\n [],\n ),\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n set_authorized_subnetwork_list: IDL.Func(\n [SetAuthorizedSubnetworkListArgs],\n [],\n [],\n ),\n update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
5
+ "mappings": ";;AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCQpD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAKA,EAAI,UACT,MAAOA,EAAI,IACb,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAAwBA,EAAI,IAAIC,CAAoB,EACpD,0BAA2BD,EAAI,IAAIA,EAAI,SAAS,EAChD,yBAA0BA,EAAI,IAAIA,EAAI,KAAK,EAC3C,uBAAwBA,EAAI,IAAIA,EAAI,SAAS,EAC7C,mBAAoBA,EAAI,IAAIE,CAAiB,EAC7C,mBAAoBF,EAAI,IAAIA,EAAI,SAAS,CAC3C,CAAC,EACKI,EAAqBJ,EAAI,OAAO,CACpC,QAASA,EAAI,IAAIA,EAAI,SAAS,EAC9B,YAAaA,EAAI,IACnB,CAAC,EACKK,EAAiCL,EAAI,QAAQ,CACjD,IAAKI,EACL,OAAQA,CACV,CAAC,EACKE,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,GAGlB,MAAM,IAAI,MACR,4CAA4C,KAAK,UAAUA,CAAQ,CAAC,EACtE,CACF,EAaO,kBAAoB,CAAC,CAAE,UAAAH,CAAU,EAAiB,CAAC,IAErD,CACH,GAAM,CAAE,oBAAAK,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
6
+ "names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetListWithType", "ChangeSubnetTypeAssignmentArgs", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "SetAuthorizedSubnetworkListArgs", "UpdateSubnetTypeArgs", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetListWithType", "ChangeSubnetTypeAssignmentArgs", "SubnetFilter", "SubnetSelection", "environment_variable", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "SetAuthorizedSubnetworkListArgs", "UpdateSubnetTypeArgs", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfinity/cmc",
3
- "version": "7.0.1",
3
+ "version": "8.0.0-next-2025-11-18",
4
4
  "description": "A library for interfacing with the cycle minting canister.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "homepage": "https://github.com/dfinity/icp-js-canisters#readme",
51
51
  "peerDependencies": {
52
- "@dfinity/utils": "^4",
53
- "@icp-sdk/core": "^4"
52
+ "@dfinity/utils": "next",
53
+ "@icp-sdk/core": "*"
54
54
  }
55
- }
55
+ }