@dfinity/cmc 8.0.1 → 9.0.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 +3 -3
- package/dist/index.d.ts +12 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +4 -4
- package/package.json +3 -4
- package/dist/candid/cmc.certified.idl.d.ts +0 -2
- package/dist/candid/cmc.certified.idl.js +0 -203
- package/dist/candid/cmc.d.ts +0 -355
- package/dist/candid/cmc.did +0 -275
- package/dist/candid/cmc.idl.d.ts +0 -2
- package/dist/candid/cmc.idl.js +0 -203
- package/dist/cmc.canister.d.ts +0 -63
- package/dist/cmc.errors.d.ts +0 -14
- package/dist/cmc.options.d.ts +0 -6
package/dist/candid/cmc.idl.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated by @icp-sdk/bindgen@0.2.0.
|
|
6
|
-
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
-
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
-
|
|
9
|
-
export const idlFactory = ({ IDL }) => {
|
|
10
|
-
const ExchangeRateCanister = IDL.Variant({
|
|
11
|
-
Set: IDL.Principal,
|
|
12
|
-
Unset: IDL.Null,
|
|
13
|
-
});
|
|
14
|
-
const AccountIdentifier = IDL.Text;
|
|
15
|
-
const CyclesCanisterInitPayload = IDL.Record({
|
|
16
|
-
exchange_rate_canister: IDL.Opt(ExchangeRateCanister),
|
|
17
|
-
cycles_ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
18
|
-
last_purged_notification: IDL.Opt(IDL.Nat64),
|
|
19
|
-
governance_canister_id: IDL.Opt(IDL.Principal),
|
|
20
|
-
minting_account_id: IDL.Opt(AccountIdentifier),
|
|
21
|
-
ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
22
|
-
});
|
|
23
|
-
const SubnetListWithType = IDL.Record({
|
|
24
|
-
subnets: IDL.Vec(IDL.Principal),
|
|
25
|
-
subnet_type: IDL.Text,
|
|
26
|
-
});
|
|
27
|
-
const ChangeSubnetTypeAssignmentArgs = IDL.Variant({
|
|
28
|
-
Add: SubnetListWithType,
|
|
29
|
-
Remove: SubnetListWithType,
|
|
30
|
-
});
|
|
31
|
-
const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });
|
|
32
|
-
const SubnetSelection = IDL.Variant({
|
|
33
|
-
Filter: SubnetFilter,
|
|
34
|
-
Subnet: IDL.Record({ subnet: IDL.Principal }),
|
|
35
|
-
});
|
|
36
|
-
const environment_variable = IDL.Record({
|
|
37
|
-
value: IDL.Text,
|
|
38
|
-
name: IDL.Text,
|
|
39
|
-
});
|
|
40
|
-
const log_visibility = IDL.Variant({
|
|
41
|
-
controllers: IDL.Null,
|
|
42
|
-
public: IDL.Null,
|
|
43
|
-
allowed_viewers: IDL.Vec(IDL.Principal),
|
|
44
|
-
});
|
|
45
|
-
const CanisterSettings = IDL.Record({
|
|
46
|
-
freezing_threshold: IDL.Opt(IDL.Nat),
|
|
47
|
-
wasm_memory_threshold: IDL.Opt(IDL.Nat),
|
|
48
|
-
environment_variables: IDL.Opt(IDL.Vec(environment_variable)),
|
|
49
|
-
controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
50
|
-
reserved_cycles_limit: IDL.Opt(IDL.Nat),
|
|
51
|
-
log_visibility: IDL.Opt(log_visibility),
|
|
52
|
-
log_memory_limit: IDL.Opt(IDL.Nat),
|
|
53
|
-
wasm_memory_limit: IDL.Opt(IDL.Nat),
|
|
54
|
-
memory_allocation: IDL.Opt(IDL.Nat),
|
|
55
|
-
compute_allocation: IDL.Opt(IDL.Nat),
|
|
56
|
-
});
|
|
57
|
-
const CreateCanisterArg = IDL.Record({
|
|
58
|
-
subnet_selection: IDL.Opt(SubnetSelection),
|
|
59
|
-
settings: IDL.Opt(CanisterSettings),
|
|
60
|
-
subnet_type: IDL.Opt(IDL.Text),
|
|
61
|
-
});
|
|
62
|
-
const CreateCanisterError = IDL.Variant({
|
|
63
|
-
Refunded: IDL.Record({
|
|
64
|
-
create_error: IDL.Text,
|
|
65
|
-
refund_amount: IDL.Nat,
|
|
66
|
-
}),
|
|
67
|
-
});
|
|
68
|
-
const CreateCanisterResult = IDL.Variant({
|
|
69
|
-
Ok: IDL.Principal,
|
|
70
|
-
Err: CreateCanisterError,
|
|
71
|
-
});
|
|
72
|
-
const IcpXdrConversionRate = IDL.Record({
|
|
73
|
-
xdr_permyriad_per_icp: IDL.Nat64,
|
|
74
|
-
timestamp_seconds: IDL.Nat64,
|
|
75
|
-
});
|
|
76
|
-
const IcpXdrConversionRateResponse = IDL.Record({
|
|
77
|
-
certificate: IDL.Vec(IDL.Nat8),
|
|
78
|
-
data: IcpXdrConversionRate,
|
|
79
|
-
hash_tree: IDL.Vec(IDL.Nat8),
|
|
80
|
-
});
|
|
81
|
-
const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({
|
|
82
|
-
data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),
|
|
83
|
-
});
|
|
84
|
-
const SubnetTypesToSubnetsResponse = IDL.Record({
|
|
85
|
-
data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),
|
|
86
|
-
});
|
|
87
|
-
const BlockIndex = IDL.Nat64;
|
|
88
|
-
const NotifyCreateCanisterArg = IDL.Record({
|
|
89
|
-
controller: IDL.Principal,
|
|
90
|
-
block_index: BlockIndex,
|
|
91
|
-
subnet_selection: IDL.Opt(SubnetSelection),
|
|
92
|
-
settings: IDL.Opt(CanisterSettings),
|
|
93
|
-
subnet_type: IDL.Opt(IDL.Text),
|
|
94
|
-
});
|
|
95
|
-
const NotifyError = IDL.Variant({
|
|
96
|
-
Refunded: IDL.Record({
|
|
97
|
-
block_index: IDL.Opt(BlockIndex),
|
|
98
|
-
reason: IDL.Text,
|
|
99
|
-
}),
|
|
100
|
-
InvalidTransaction: IDL.Text,
|
|
101
|
-
Other: IDL.Record({
|
|
102
|
-
error_message: IDL.Text,
|
|
103
|
-
error_code: IDL.Nat64,
|
|
104
|
-
}),
|
|
105
|
-
Processing: IDL.Null,
|
|
106
|
-
TransactionTooOld: BlockIndex,
|
|
107
|
-
});
|
|
108
|
-
const NotifyCreateCanisterResult = IDL.Variant({
|
|
109
|
-
Ok: IDL.Principal,
|
|
110
|
-
Err: NotifyError,
|
|
111
|
-
});
|
|
112
|
-
const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
113
|
-
const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
114
|
-
const NotifyMintCyclesArg = IDL.Record({
|
|
115
|
-
block_index: BlockIndex,
|
|
116
|
-
deposit_memo: Memo,
|
|
117
|
-
to_subaccount: Subaccount,
|
|
118
|
-
});
|
|
119
|
-
const NotifyMintCyclesSuccess = IDL.Record({
|
|
120
|
-
balance: IDL.Nat,
|
|
121
|
-
block_index: IDL.Nat,
|
|
122
|
-
minted: IDL.Nat,
|
|
123
|
-
});
|
|
124
|
-
const NotifyMintCyclesResult = IDL.Variant({
|
|
125
|
-
Ok: NotifyMintCyclesSuccess,
|
|
126
|
-
Err: NotifyError,
|
|
127
|
-
});
|
|
128
|
-
const NotifyTopUpArg = IDL.Record({
|
|
129
|
-
block_index: BlockIndex,
|
|
130
|
-
canister_id: IDL.Principal,
|
|
131
|
-
});
|
|
132
|
-
const Cycles = IDL.Nat;
|
|
133
|
-
const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });
|
|
134
|
-
const SetAuthorizedSubnetworkListArgs = IDL.Record({
|
|
135
|
-
who: IDL.Opt(IDL.Principal),
|
|
136
|
-
subnets: IDL.Vec(IDL.Principal),
|
|
137
|
-
});
|
|
138
|
-
const UpdateSubnetTypeArgs = IDL.Variant({
|
|
139
|
-
Add: IDL.Text,
|
|
140
|
-
Remove: IDL.Text,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return IDL.Service({
|
|
144
|
-
change_subnet_type_assignment: IDL.Func(
|
|
145
|
-
[ChangeSubnetTypeAssignmentArgs],
|
|
146
|
-
[],
|
|
147
|
-
[],
|
|
148
|
-
),
|
|
149
|
-
create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),
|
|
150
|
-
get_build_metadata: IDL.Func([], [IDL.Text], ["query"]),
|
|
151
|
-
get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], ["query"]),
|
|
152
|
-
get_icp_xdr_conversion_rate: IDL.Func(
|
|
153
|
-
[],
|
|
154
|
-
[IcpXdrConversionRateResponse],
|
|
155
|
-
["query"],
|
|
156
|
-
),
|
|
157
|
-
get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(
|
|
158
|
-
[],
|
|
159
|
-
[PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],
|
|
160
|
-
["query"],
|
|
161
|
-
),
|
|
162
|
-
get_subnet_types_to_subnets: IDL.Func(
|
|
163
|
-
[],
|
|
164
|
-
[SubnetTypesToSubnetsResponse],
|
|
165
|
-
["query"],
|
|
166
|
-
),
|
|
167
|
-
notify_create_canister: IDL.Func(
|
|
168
|
-
[NotifyCreateCanisterArg],
|
|
169
|
-
[NotifyCreateCanisterResult],
|
|
170
|
-
[],
|
|
171
|
-
),
|
|
172
|
-
notify_mint_cycles: IDL.Func(
|
|
173
|
-
[NotifyMintCyclesArg],
|
|
174
|
-
[NotifyMintCyclesResult],
|
|
175
|
-
[],
|
|
176
|
-
),
|
|
177
|
-
notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
|
|
178
|
-
set_authorized_subnetwork_list: IDL.Func(
|
|
179
|
-
[SetAuthorizedSubnetworkListArgs],
|
|
180
|
-
[],
|
|
181
|
-
[],
|
|
182
|
-
),
|
|
183
|
-
update_subnet_type: IDL.Func([UpdateSubnetTypeArgs], [], []),
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export const init = ({ IDL }) => {
|
|
188
|
-
const ExchangeRateCanister = IDL.Variant({
|
|
189
|
-
Set: IDL.Principal,
|
|
190
|
-
Unset: IDL.Null,
|
|
191
|
-
});
|
|
192
|
-
const AccountIdentifier = IDL.Text;
|
|
193
|
-
const CyclesCanisterInitPayload = IDL.Record({
|
|
194
|
-
exchange_rate_canister: IDL.Opt(ExchangeRateCanister),
|
|
195
|
-
cycles_ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
196
|
-
last_purged_notification: IDL.Opt(IDL.Nat64),
|
|
197
|
-
governance_canister_id: IDL.Opt(IDL.Principal),
|
|
198
|
-
minting_account_id: IDL.Opt(AccountIdentifier),
|
|
199
|
-
ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
return [IDL.Opt(CyclesCanisterInitPayload)];
|
|
203
|
-
};
|
package/dist/cmc.canister.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
-
import type { _SERVICE as CMCCanisterService, Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse } from "./candid/cmc";
|
|
4
|
-
import type { CMCCanisterOptions } from "./cmc.options";
|
|
5
|
-
export declare class CMCCanister extends Canister<CMCCanisterService> {
|
|
6
|
-
static create(options: CMCCanisterOptions): CMCCanister;
|
|
7
|
-
/**
|
|
8
|
-
* Returns conversion rate of ICP to Cycles. It can be called as query or update.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} [params] - The parameters for the call.
|
|
11
|
-
* @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)
|
|
12
|
-
*
|
|
13
|
-
* @returns Promise<BigInt>
|
|
14
|
-
*/
|
|
15
|
-
getIcpToCyclesConversionRate: ({ certified, }?: QueryParams) => Promise<bigint>;
|
|
16
|
-
/**
|
|
17
|
-
* Notifies Cycles Minting Canister of the creation of a new canister.
|
|
18
|
-
* It returns the new canister principal.
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} request
|
|
21
|
-
* @param {Principal} request.controller
|
|
22
|
-
* @param {BlockIndex} request.block_index
|
|
23
|
-
* @returns Promise<Principal>
|
|
24
|
-
* @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError
|
|
25
|
-
*/
|
|
26
|
-
notifyCreateCanister: (request: NotifyCreateCanisterArg) => Promise<Principal>;
|
|
27
|
-
/**
|
|
28
|
-
* Notifies Cycles Minting Canister of new cycles being added to canister.
|
|
29
|
-
* It returns the new Cycles of the canister.
|
|
30
|
-
*
|
|
31
|
-
* @param {Object} request
|
|
32
|
-
* @param {Principal} request.canister_id
|
|
33
|
-
* @param {BlockIndex} request.block_index
|
|
34
|
-
* @returns Promise<Cycles>
|
|
35
|
-
* @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError
|
|
36
|
-
*/
|
|
37
|
-
notifyTopUp: (request: NotifyTopUpArg) => Promise<Cycles>;
|
|
38
|
-
/**
|
|
39
|
-
* This function calls the `get_default_subnets` method of the CMC canister, which returns a list of
|
|
40
|
-
* default subnets as `Principal` objects. It can be called as query or update.
|
|
41
|
-
*
|
|
42
|
-
* @param {Object} [params] - The query parameters for the call.
|
|
43
|
-
* @param {boolean} [params.certified] - Determines whether the response should be certified
|
|
44
|
-
* (default: non-certified if not specified).
|
|
45
|
-
*
|
|
46
|
-
* @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects
|
|
47
|
-
* representing the default subnets.
|
|
48
|
-
*/
|
|
49
|
-
getDefaultSubnets: ({ certified }?: QueryParams) => Promise<Principal[]>;
|
|
50
|
-
/**
|
|
51
|
-
* 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.
|
|
52
|
-
* These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided
|
|
53
|
-
* during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.
|
|
54
|
-
*
|
|
55
|
-
* @param {Object} [params] - The optional query parameters for the call.
|
|
56
|
-
* @param {boolean} [params.certified=false] - Specifies whether the response should be certified.
|
|
57
|
-
* If not provided, the response defaults to non-certified.
|
|
58
|
-
*
|
|
59
|
-
* @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing
|
|
60
|
-
* the mapping of subnet types to subnets.
|
|
61
|
-
*/
|
|
62
|
-
getSubnetTypesToSubnets: ({ certified, }?: QueryParams) => Promise<SubnetTypesToSubnetsResponse>;
|
|
63
|
-
}
|
package/dist/cmc.errors.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NotifyError } from "./candid/cmc";
|
|
2
|
-
export declare class RefundedError extends Error {
|
|
3
|
-
}
|
|
4
|
-
export declare class InvalidaTransactionError extends Error {
|
|
5
|
-
}
|
|
6
|
-
export declare class CMCError extends Error {
|
|
7
|
-
}
|
|
8
|
-
export declare class ProcessingError extends Error {
|
|
9
|
-
}
|
|
10
|
-
export declare class TransactionTooOldError extends Error {
|
|
11
|
-
}
|
|
12
|
-
export declare const throwNotifyError: ({ Err: error, }: {
|
|
13
|
-
Err: NotifyError;
|
|
14
|
-
}) => void;
|
package/dist/cmc.options.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CanisterOptions } from "@dfinity/utils";
|
|
2
|
-
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
-
import type { _SERVICE as CanisterService } from "./candid/cmc";
|
|
4
|
-
export interface CMCCanisterOptions extends Omit<CanisterOptions<CanisterService>, "canisterId"> {
|
|
5
|
-
canisterId: Principal;
|
|
6
|
-
}
|