@dfinity/cmc 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -6
- package/dist/candid/cmc.did +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +3 -3
- package/dist/esm/{chunk-5XIQBCLB.js → chunk-4XJEWVN3.js} +2 -2
- package/dist/esm/chunk-4XJEWVN3.js.map +7 -0
- package/dist/esm/cmc.canister.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/types/cmc.canister.d.ts +14 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/esm/chunk-5XIQBCLB.js.map +0 -7
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ const rate = await getIcpToCyclesConversionRate();
|
|
|
55
55
|
|
|
56
56
|
### :factory: CMCCanister
|
|
57
57
|
|
|
58
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
58
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L15)
|
|
59
59
|
|
|
60
60
|
#### Methods
|
|
61
61
|
|
|
@@ -64,6 +64,7 @@ const rate = await getIcpToCyclesConversionRate();
|
|
|
64
64
|
- [notifyCreateCanister](#gear-notifycreatecanister)
|
|
65
65
|
- [notifyTopUp](#gear-notifytopup)
|
|
66
66
|
- [getDefaultSubnets](#gear-getdefaultsubnets)
|
|
67
|
+
- [getSubnetTypesToSubnets](#gear-getsubnettypestosubnets)
|
|
67
68
|
|
|
68
69
|
##### :gear: create
|
|
69
70
|
|
|
@@ -71,7 +72,7 @@ const rate = await getIcpToCyclesConversionRate();
|
|
|
71
72
|
| -------- | ---------------------------------------------- |
|
|
72
73
|
| `create` | `(options: CMCCanisterOptions) => CMCCanister` |
|
|
73
74
|
|
|
74
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
75
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L16)
|
|
75
76
|
|
|
76
77
|
##### :gear: getIcpToCyclesConversionRate
|
|
77
78
|
|
|
@@ -81,7 +82,7 @@ Returns conversion rate of ICP to Cycles
|
|
|
81
82
|
| ------------------------------ | ----------------------- |
|
|
82
83
|
| `getIcpToCyclesConversionRate` | `() => Promise<bigint>` |
|
|
83
84
|
|
|
84
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
85
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L32)
|
|
85
86
|
|
|
86
87
|
##### :gear: notifyCreateCanister
|
|
87
88
|
|
|
@@ -92,7 +93,7 @@ It returns the new canister principal.
|
|
|
92
93
|
| ---------------------- | ---------------------------------------------------------- |
|
|
93
94
|
| `notifyCreateCanister` | `(request: NotifyCreateCanisterArg) => Promise<Principal>` |
|
|
94
95
|
|
|
95
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
96
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L49)
|
|
96
97
|
|
|
97
98
|
##### :gear: notifyTopUp
|
|
98
99
|
|
|
@@ -103,7 +104,7 @@ It returns the new Cycles of the canister.
|
|
|
103
104
|
| ------------- | ---------------------------------------------- |
|
|
104
105
|
| `notifyTopUp` | `(request: NotifyTopUpArg) => Promise<bigint>` |
|
|
105
106
|
|
|
106
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
107
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L77)
|
|
107
108
|
|
|
108
109
|
##### :gear: getDefaultSubnets
|
|
109
110
|
|
|
@@ -120,6 +121,24 @@ Parameters:
|
|
|
120
121
|
- `params.certified`: - Determines whether the response should be certified
|
|
121
122
|
(default: non-certified if not specified).
|
|
122
123
|
|
|
123
|
-
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#
|
|
124
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L102)
|
|
125
|
+
|
|
126
|
+
##### :gear: getSubnetTypesToSubnets
|
|
127
|
+
|
|
128
|
+
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.
|
|
129
|
+
These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided
|
|
130
|
+
during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.
|
|
131
|
+
|
|
132
|
+
| Method | Type |
|
|
133
|
+
| ------------------------- | ------------------------------------------------------------------------- |
|
|
134
|
+
| `getSubnetTypesToSubnets` | `({ certified, }?: QueryParams) => Promise<SubnetTypesToSubnetsResponse>` |
|
|
135
|
+
|
|
136
|
+
Parameters:
|
|
137
|
+
|
|
138
|
+
- `params`: - The optional query parameters for the call.
|
|
139
|
+
- `params.certified`: - Specifies whether the response should be certified.
|
|
140
|
+
If not provided, the response defaults to non-certified.
|
|
141
|
+
|
|
142
|
+
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cmc/src/cmc.canister.ts#L121)
|
|
124
143
|
|
|
125
144
|
<!-- TSDOC_END -->
|
package/dist/candid/cmc.did
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit d9fe207 (2024-12-06 tags: release-2024-12-06_03-16-base) 'rs/nns/cmc/cmc.did' by import-candid
|
|
2
2
|
type Cycles = nat;
|
|
3
3
|
type BlockIndex = nat64;
|
|
4
4
|
type log_visibility = variant {
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var J=(t,
|
|
1
|
+
"use strict";var U=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var J=(t,r)=>{for(var n in r)U(t,n,{get:r[n],enumerable:!0})},Q=(t,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of $(r))!X.call(t,i)&&i!==n&&U(t,i,{get:()=>r[i],enumerable:!(e=q(r,i))||e.enumerable});return t};var B=t=>Q(U({},"__esModule",{value:!0}),t);var j={};J(j,{CMCCanister:()=>f,CMCError:()=>_,InvalidaTransactionError:()=>l,ProcessingError:()=>d,RefundedError:()=>p,TransactionTooOldError:()=>u,throwNotifyError:()=>y});module.exports=B(j);var O=require("@dfinity/utils");var M=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),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(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[x],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],[]),get_subnet_types_to_subnets:t.Func([],[T],[]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var z=({IDL:t})=>{let r=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(r),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(n),ledger_canister_id:t.Opt(t.Principal)}),i=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:i,Subnet:t.Record({subnet:t.Principal})}),C=t.Variant({controllers:t.Null,public:t.Null}),a=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(C),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),m=t.Record({subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),N=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),g=t.Variant({Ok:t.Principal,Err:N}),b=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),x=t.Record({certificate:t.Vec(t.Nat8),data:b,hash_tree:t.Vec(t.Nat8)}),R=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),T=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),c=t.Nat64,P=t.Record({controller:t.Principal,block_index:c,subnet_selection:t.Opt(o),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),s=t.Variant({Refunded:t.Record({block_index:t.Opt(c),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:c}),h=t.Variant({Ok:t.Principal,Err:s}),S=t.Opt(t.Vec(t.Nat8)),V=t.Opt(t.Vec(t.Nat8)),v=t.Record({block_index:c,deposit_memo:S,to_subaccount:V}),E=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:E,Err:s}),F=t.Record({block_index:c,canister_id:t.Principal}),k=t.Nat,A=t.Variant({Ok:k,Err:s});return t.Service({create_canister:t.Func([m],[g],[]),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([],[x],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[R],["query"]),get_subnet_types_to_subnets:t.Func([],[T],["query"]),notify_create_canister:t.Func([P],[h],[]),notify_mint_cycles:t.Func([v],[w],[]),notify_top_up:t.Func([F],[A],[])})};var p=class extends Error{},l=class extends Error{},_=class extends Error{},d=class extends Error{},u=class extends Error{},y=({Err:t})=>{throw"Refunded"in t?new p(t.Refunded.reason):"InvalidTransaction"in t?new l(t.InvalidTransaction):"Processing"in t?new d:"TransactionTooOld"in t?new u:"Other"in t?new _(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`):new Error(`Unsupported error type ${JSON.stringify(t)}`)};var f=class t extends O.Canister{constructor(){super(...arguments);this.getIcpToCyclesConversionRate=async()=>{let{data:n}=await this.service.get_icp_xdr_conversion_rate();return n.xdr_permyriad_per_icp};this.notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};this.notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&y(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};this.getDefaultSubnets=async({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};this.getSubnetTypesToSubnets=async({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}}static create(n){let{service:e,certifiedService:i,canisterId:o}=(0,O.createServices)({options:n,idlFactory:z,certifiedIdlFactory:M});return new t(o,e,i)}};0&&(module.exports={CMCCanister,CMCError,InvalidaTransactionError,ProcessingError,RefundedError,TransactionTooOldError,throwNotifyError});
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../src/cmc.canister.ts", "../../candid/cmc.certified.idl.js", "../../candid/cmc.idl.js", "../../src/cmc.errors.ts"],
|
|
4
|
-
"sourcesContent": ["export type {\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n} from \"../candid/cmc\";\nexport { CMCCanister } from \"./cmc.canister\";\nexport * from \"./cmc.errors\";\n", "import type { Principal } from \"@dfinity/principal\";\nimport { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\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\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async (): Promise<bigint> => {\n const { data } = await this.service.get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/FOLLOW-223\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 = async ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import 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 // Edge case\n throw new Error(`Unsupported error type ${JSON.stringify(error)}`);\n};\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,aAAAC,EAAA,6BAAAC,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,2BAAAC,EAAA,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,CAAC,CACH,EACF,cAAkBvB,EAAI,KAAK,CAACwB,CAAc,EAAG,CAACE,CAAiB,EAAG,CAAC,CAAC,CACtE,CAAC,CACH,EChJO,IAAMC,EAAN,cAA4B,KAAM,CAAC,EAC7BC,EAAN,cAAuC,KAAM,CAAC,EACxCC,EAAN,cAAuB,KAAM,CAAC,EACxBC,EAAN,cAA8B,KAAM,CAAC,EAC/BC,EAAN,cAAqC,KAAM,CAAC,EAGtCC,EAAmB,CAAC,CAC/B,IAAKC,CACP,IAEY,CACV,KAAI,aAAcA,EACV,IAAIN,EAAcM,EAAM,SAAS,MAAM,EAE3C,uBAAwBA,EACpB,IAAIL,EAAyBK,EAAM,kBAAkB,EAEzD,eAAgBA,EACZ,IAAIH,EAER,sBAAuBG,EACnB,IAAIF,EAER,UAAWE,EACP,IAAIJ,EACR,0BAA0BI,EAAM,MAAM,UAAU,KAAKA,EAAM,MAAM,aAAa,EAChF,EAGI,IAAI,MAAM,0BAA0B,KAAK,UAAUA,CAAK,CAAC,EAAE,CACnE,
|
|
6
|
-
"names": ["src_exports", "__export", "CMCCanister", "CMCError", "InvalidaTransactionError", "ProcessingError", "RefundedError", "TransactionTooOldError", "throwNotifyError", "__toCommonJS", "import_utils", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "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", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "data", "request", "response", "throwNotifyError", "certified", "get_default_subnets", "options", "service", "certifiedService", "canisterId", "idlFactory"]
|
|
4
|
+
"sourcesContent": ["export type {\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"../candid/cmc\";\nexport { CMCCanister } from \"./cmc.canister\";\nexport * from \"./cmc.errors\";\n", "import type { Principal } from \"@dfinity/principal\";\nimport { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\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\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async (): Promise<bigint> => {\n const { data } = await this.service.get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/FOLLOW-223\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 = async ({ 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 = async ({\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", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import 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 // Edge case\n throw new Error(`Unsupported error type ${JSON.stringify(error)}`);\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,aAAAC,EAAA,6BAAAC,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,2BAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAT,GCCA,IAAAU,EAA2D,0BCApD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAQA,EAAI,UACZ,MAAUA,EAAI,IAChB,CAAC,EACKE,EAAoBF,EAAI,KAC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A,KAAO,wBAA0B,MAAO,CACtC,UAAAD,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAE,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAF,CAAU,CAAC,EACjE,OAAOE,EAA4B,CACrC,EA9GA,OAAO,OAAOC,EAA0C,CACtD,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,KAC5C,kBAAmC,CACjC,QAAAH,EACA,WAAAI,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIZ,EAAYW,EAAYF,EAASC,CAAgB,CAC9D,CAsGF",
|
|
6
|
+
"names": ["src_exports", "__export", "CMCCanister", "CMCError", "InvalidaTransactionError", "ProcessingError", "RefundedError", "TransactionTooOldError", "throwNotifyError", "__toCommonJS", "import_utils", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "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", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "data", "request", "response", "throwNotifyError", "certified", "get_default_subnets", "get_subnet_types_to_subnets", "options", "service", "certifiedService", "canisterId", "idlFactory"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as V}from"./chunk-XRC5EOJ2.js";import{Canister as k,createServices as E}from"@dfinity/utils";var h=({IDL:t})=>{let s=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(s),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(n),ledger_canister_id:t.Opt(t.Principal)}),a=t.Record({subnet_type:t.Opt(t.Text)}),i=t.Variant({Filter:a,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(p),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),l=t.Record({subnet_selection:t.Opt(i),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),_=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),d=t.Variant({Ok:t.Principal,Err:_}),u=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),y=t.Record({certificate:t.Vec(t.Nat8),data:u,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),C=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,g=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(i),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}),m=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),f=t.Record({block_index:r,deposit_memo:m,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),P=t.Variant({Ok:R,Err:c}),T=t.Record({block_index:r,canister_id:t.Principal}),x=t.Nat,S=t.Variant({Ok:x,Err:c});return t.Service({create_canister:t.Func([l],[d],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[y],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],[]),get_subnet_types_to_subnets:t.Func([],[C],[]),notify_create_canister:t.Func([g],[N],[]),notify_mint_cycles:t.Func([f],[P],[]),notify_top_up:t.Func([T],[S],[])})};var v=({IDL:t})=>{let s=t.Variant({Set:t.Principal,Unset:t.Null}),n=t.Text,e=t.Record({exchange_rate_canister:t.Opt(s),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(n),ledger_canister_id:t.Opt(t.Principal)}),a=t.Record({subnet_type:t.Opt(t.Text)}),i=t.Variant({Filter:a,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),o=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(p),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),l=t.Record({subnet_selection:t.Opt(i),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),_=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),d=t.Variant({Ok:t.Principal,Err:_}),u=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),y=t.Record({certificate:t.Vec(t.Nat8),data:u,hash_tree:t.Vec(t.Nat8)}),O=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),C=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,g=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(i),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}),m=t.Opt(t.Vec(t.Nat8)),b=t.Opt(t.Vec(t.Nat8)),f=t.Record({block_index:r,deposit_memo:m,to_subaccount:b}),R=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),P=t.Variant({Ok:R,Err:c}),T=t.Record({block_index:r,canister_id:t.Principal}),x=t.Nat,S=t.Variant({Ok:x,Err:c});return t.Service({create_canister:t.Func([l],[d],[]),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([],[y],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[O],["query"]),get_subnet_types_to_subnets:t.Func([],[C],["query"]),notify_create_canister:t.Func([g],[N],[]),notify_mint_cycles:t.Func([f],[P],[]),notify_top_up:t.Func([T],[S],[])})};var F=class t extends k{constructor(){super(...arguments);this.getIcpToCyclesConversionRate=async()=>{let{data:n}=await this.service.get_icp_xdr_conversion_rate();return n.xdr_permyriad_per_icp};this.notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&V(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};this.notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&V(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};this.getDefaultSubnets=async({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};this.getSubnetTypesToSubnets=async({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}}static create(n){let{service:e,certifiedService:a,canisterId:i}=E({options:n,idlFactory:v,certifiedIdlFactory:h});return new t(i,e,a)}};export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-4XJEWVN3.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/cmc.canister.ts", "../../candid/cmc.certified.idl.js", "../../candid/cmc.idl.js"],
|
|
4
|
+
"sourcesContent": ["import type { Principal } from \"@dfinity/principal\";\nimport { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\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\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async (): Promise<bigint> => {\n const { data } = await this.service.get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/FOLLOW-223\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 = async ({ 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 = async ({\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", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n"],
|
|
5
|
+
"mappings": "wCACA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCApD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAQA,EAAI,UACZ,MAAUA,EAAI,IAChB,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAA2BA,EAAI,IAAIC,CAAoB,EACvD,0BAA8BD,EAAI,IAAIA,EAAI,SAAS,EACnD,yBAA6BA,EAAI,IAAIA,EAAI,KAAK,EAC9C,uBAA2BA,EAAI,IAAIA,EAAI,SAAS,EAChD,mBAAuBA,EAAI,IAAIE,CAAiB,EAChD,mBAAuBF,EAAI,IAAIA,EAAI,SAAS,CAC9C,CAAC,EACKI,EAAeJ,EAAI,OAAO,CAAE,YAAgBA,EAAI,IAAIA,EAAI,IAAI,CAAE,CAAC,EAC/DK,EAAkBL,EAAI,QAAQ,CAClC,OAAWI,EACX,OAAWJ,EAAI,OAAO,CAAE,OAAWA,EAAI,SAAU,CAAC,CACpD,CAAC,EACKM,EAAiBN,EAAI,QAAQ,CACjC,YAAgBA,EAAI,KACpB,OAAWA,EAAI,IACjB,CAAC,EACKO,EAAmBP,E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E,CAAU,EAAiB,CAAC,IAE3D,CACH,GAAM,CAAE,oBAAAC,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAD,CAAU,CAAC,EACzD,OAAOC,EAAoB,CAC7B,EAcA,KAAO,wBAA0B,MAAO,CACtC,UAAAD,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAE,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAF,CAAU,CAAC,EACjE,OAAOE,EAA4B,CACrC,EA9GA,OAAO,OAAOC,EAA0C,CACtD,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAAmC,CACjC,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAId,EAAYY,EAAYF,EAASC,CAAgB,CAC9D,CAsGF",
|
|
6
|
+
"names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "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", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "CMCCanister", "_CMCCanister", "Canister", "data", "request", "response", "throwNotifyError", "certified", "get_default_subnets", "get_subnet_types_to_subnets", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
+
}
|
package/dist/esm/cmc.canister.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-4XJEWVN3.js";import"./chunk-XRC5EOJ2.js";export{a as CMCCanister};
|
|
2
2
|
//# sourceMappingURL=cmc.canister.js.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as e}from"./chunk-4XJEWVN3.js";import{a as o,b as r,c as t,d as p,e as s,f as n}from"./chunk-XRC5EOJ2.js";export{e as CMCCanister,t as CMCError,r as InvalidaTransactionError,p as ProcessingError,o as RefundedError,s as TransactionTooOldError,n as throwNotifyError};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Principal } from "@dfinity/principal";
|
|
2
2
|
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
3
|
-
import type { _SERVICE as CMCCanisterService, Cycles, NotifyCreateCanisterArg, NotifyTopUpArg } from "../candid/cmc";
|
|
3
|
+
import type { _SERVICE as CMCCanisterService, Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse } from "../candid/cmc";
|
|
4
4
|
import type { CMCCanisterOptions } from "./cmc.options";
|
|
5
5
|
export declare class CMCCanister extends Canister<CMCCanisterService> {
|
|
6
6
|
static create(options: CMCCanisterOptions): CMCCanister;
|
|
@@ -44,4 +44,17 @@ export declare class CMCCanister extends Canister<CMCCanisterService> {
|
|
|
44
44
|
* representing the default subnets.
|
|
45
45
|
*/
|
|
46
46
|
getDefaultSubnets: ({ certified }?: QueryParams) => Promise<Principal[]>;
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
* These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided
|
|
50
|
+
* during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.
|
|
51
|
+
*
|
|
52
|
+
* @param {Object} [params] - The optional query parameters for the call.
|
|
53
|
+
* @param {boolean} [params.certified=false] - Specifies whether the response should be certified.
|
|
54
|
+
* If not provided, the response defaults to non-certified.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing
|
|
57
|
+
* the mapping of subnet types to subnets.
|
|
58
|
+
*/
|
|
59
|
+
getSubnetTypesToSubnets: ({ certified, }?: QueryParams) => Promise<SubnetTypesToSubnetsResponse>;
|
|
47
60
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, } from "../candid/cmc";
|
|
1
|
+
export type { Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse, } from "../candid/cmc";
|
|
2
2
|
export { CMCCanister } from "./cmc.canister";
|
|
3
3
|
export * from "./cmc.errors";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfinity/cmc",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A library for interfacing with the cycle minting canister.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/cjs/index.cjs.js",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"@dfinity/agent": "^2.0.0",
|
|
40
40
|
"@dfinity/candid": "^2.0.0",
|
|
41
41
|
"@dfinity/principal": "^2.0.0",
|
|
42
|
-
"@dfinity/utils": "^2.
|
|
42
|
+
"@dfinity/utils": "^2.8.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cmc.canister.ts", "../../candid/cmc.certified.idl.js", "../../candid/cmc.idl.js"],
|
|
4
|
-
"sourcesContent": ["import type { Principal } from \"@dfinity/principal\";\nimport { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\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\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async (): Promise<bigint> => {\n const { data } = await this.service.get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/FOLLOW-223\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 = async ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/cmc/candid/cmc.did */\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 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 '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 return IDL.Service({\n 'create_canister' : IDL.Func(\n [CreateCanisterArg],\n [CreateCanisterResult],\n [],\n ),\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};\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 return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n"],
|
|
5
|
-
"mappings": "wCACA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCApD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAQA,EAAI,UACZ,MAAUA,EAAI,IAChB,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAA2BA,EAAI,IAAIC,CAAoB,EACvD,0BAA8BD,EAAI,IAAIA,EAAI,SAAS,EACnD,yBAA6BA,EAAI,IAAIA,EAAI,KAAK,EAC9C,uBAA2BA,EAAI,IAAIA,EAAI,SAAS,EAChD,mBAAuBA,EAAI,IAAIE,CAAiB,EAChD,mBAAuBF,EAAI,IAAIA,EAAI,SAAS,CAC9C,CAAC,EACKI,EAAeJ,EAAI,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EAYA,KAAO,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,EAaA,KAAO,kBAAoB,MAAO,CAAE,UAAAE,CAAU,EAAiB,CAAC,IAE3D,CACH,GAAM,CAAE,oBAAAC,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAD,CAAU,CAAC,EACzD,OAAOC,EAAoB,CAC7B,EA3FA,OAAO,OAAOC,EAA0C,CACtD,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAAmC,CACjC,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIb,EAAYW,EAAYF,EAASC,CAAgB,CAC9D,CAmFF",
|
|
6
|
-
"names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "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", "log_visibility", "CanisterSettings", "CreateCanisterArg", "CreateCanisterError", "CreateCanisterResult", "IcpXdrConversionRate", "IcpXdrConversionRateResponse", "PrincipalsAuthorizedToCreateCanistersToSubnetsResponse", "SubnetTypesToSubnetsResponse", "BlockIndex", "NotifyCreateCanisterArg", "NotifyError", "NotifyCreateCanisterResult", "Memo", "Subaccount", "NotifyMintCyclesArg", "NotifyMintCyclesSuccess", "NotifyMintCyclesResult", "NotifyTopUpArg", "Cycles", "NotifyTopUpResult", "CMCCanister", "_CMCCanister", "Canister", "data", "request", "response", "throwNotifyError", "certified", "get_default_subnets", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
-
}
|