@dfinity/cmc 6.0.6 → 7.0.0-next-2025-10-20
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 +1 -1
- package/dist/candid/cmc.certified.idl.d.ts +1 -1
- package/dist/candid/cmc.certified.idl.js +113 -107
- package/dist/candid/cmc.d.ts +11 -3
- package/dist/candid/cmc.idl.d.ts +1 -1
- package/dist/candid/cmc.idl.js +113 -107
- package/dist/{types/cmc.canister.d.ts → cmc.canister.d.ts} +2 -2
- package/dist/{types/cmc.errors.d.ts → cmc.errors.d.ts} +1 -1
- package/dist/{types/cmc.options.d.ts → cmc.options.d.ts} +2 -2
- package/dist/{types/index.d.ts → index.d.ts} +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +22 -11
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/index.cjs.js.map +0 -7
- package/dist/esm/chunk-DKQBKL44.js +0 -2
- package/dist/esm/chunk-DKQBKL44.js.map +0 -7
- package/dist/esm/chunk-G7V22BZT.js +0 -2
- package/dist/esm/chunk-G7V22BZT.js.map +0 -7
- package/dist/esm/cmc.canister.js +0 -2
- package/dist/esm/cmc.canister.js.map +0 -7
- package/dist/esm/cmc.errors.js +0 -2
- package/dist/esm/cmc.errors.js.map +0 -7
- package/dist/esm/cmc.mock.js +0 -2
- package/dist/esm/cmc.mock.js.map +0 -7
- package/dist/esm/cmc.options.js +0 -1
- package/dist/esm/cmc.options.js.map +0 -7
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -7
- package/dist/index.cjs.js +0 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm i @dfinity/cmc
|
|
|
21
21
|
The bundle needs peer dependencies, be sure that following resources are available in your project as well.
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm i @
|
|
24
|
+
npm i @icp-sdk/core @dfinity/utils
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IDL } from "@
|
|
1
|
+
import type { IDL } from "@icp-sdk/core/candid";
|
|
2
2
|
export const idlFactory: IDL.InterfaceFactory;
|
|
@@ -1,163 +1,169 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
|
|
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
|
+
|
|
2
9
|
export const idlFactory = ({ IDL }) => {
|
|
3
10
|
const ExchangeRateCanister = IDL.Variant({
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
Set: IDL.Principal,
|
|
12
|
+
Unset: IDL.Null,
|
|
6
13
|
});
|
|
7
14
|
const AccountIdentifier = IDL.Text;
|
|
8
15
|
const CyclesCanisterInitPayload = IDL.Record({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
const SubnetFilter = 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 SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });
|
|
17
24
|
const SubnetSelection = IDL.Variant({
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
Filter: SubnetFilter,
|
|
26
|
+
Subnet: IDL.Record({ subnet: IDL.Principal }),
|
|
20
27
|
});
|
|
21
28
|
const log_visibility = IDL.Variant({
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
controllers: IDL.Null,
|
|
30
|
+
public: IDL.Null,
|
|
24
31
|
});
|
|
25
32
|
const CanisterSettings = IDL.Record({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
freezing_threshold: IDL.Opt(IDL.Nat),
|
|
34
|
+
wasm_memory_threshold: IDL.Opt(IDL.Nat),
|
|
35
|
+
controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
36
|
+
reserved_cycles_limit: IDL.Opt(IDL.Nat),
|
|
37
|
+
log_visibility: IDL.Opt(log_visibility),
|
|
38
|
+
wasm_memory_limit: IDL.Opt(IDL.Nat),
|
|
39
|
+
memory_allocation: IDL.Opt(IDL.Nat),
|
|
40
|
+
compute_allocation: IDL.Opt(IDL.Nat),
|
|
34
41
|
});
|
|
35
42
|
const CreateCanisterArg = IDL.Record({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
subnet_selection: IDL.Opt(SubnetSelection),
|
|
44
|
+
settings: IDL.Opt(CanisterSettings),
|
|
45
|
+
subnet_type: IDL.Opt(IDL.Text),
|
|
39
46
|
});
|
|
40
47
|
const CreateCanisterError = IDL.Variant({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
Refunded: IDL.Record({
|
|
49
|
+
create_error: IDL.Text,
|
|
50
|
+
refund_amount: IDL.Nat,
|
|
44
51
|
}),
|
|
45
52
|
});
|
|
46
53
|
const CreateCanisterResult = IDL.Variant({
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
Ok: IDL.Principal,
|
|
55
|
+
Err: CreateCanisterError,
|
|
49
56
|
});
|
|
50
57
|
const IcpXdrConversionRate = IDL.Record({
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
xdr_permyriad_per_icp: IDL.Nat64,
|
|
59
|
+
timestamp_seconds: IDL.Nat64,
|
|
53
60
|
});
|
|
54
61
|
const IcpXdrConversionRateResponse = IDL.Record({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
certificate: IDL.Vec(IDL.Nat8),
|
|
63
|
+
data: IcpXdrConversionRate,
|
|
64
|
+
hash_tree: IDL.Vec(IDL.Nat8),
|
|
58
65
|
});
|
|
59
66
|
const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({
|
|
60
|
-
|
|
67
|
+
data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),
|
|
61
68
|
});
|
|
62
69
|
const SubnetTypesToSubnetsResponse = IDL.Record({
|
|
63
|
-
|
|
70
|
+
data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),
|
|
64
71
|
});
|
|
65
72
|
const BlockIndex = IDL.Nat64;
|
|
66
73
|
const NotifyCreateCanisterArg = IDL.Record({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
controller: IDL.Principal,
|
|
75
|
+
block_index: BlockIndex,
|
|
76
|
+
subnet_selection: IDL.Opt(SubnetSelection),
|
|
77
|
+
settings: IDL.Opt(CanisterSettings),
|
|
78
|
+
subnet_type: IDL.Opt(IDL.Text),
|
|
72
79
|
});
|
|
73
80
|
const NotifyError = IDL.Variant({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
Refunded: IDL.Record({
|
|
82
|
+
block_index: IDL.Opt(BlockIndex),
|
|
83
|
+
reason: IDL.Text,
|
|
77
84
|
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
InvalidTransaction: IDL.Text,
|
|
86
|
+
Other: IDL.Record({
|
|
87
|
+
error_message: IDL.Text,
|
|
88
|
+
error_code: IDL.Nat64,
|
|
82
89
|
}),
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
Processing: IDL.Null,
|
|
91
|
+
TransactionTooOld: BlockIndex,
|
|
85
92
|
});
|
|
86
93
|
const NotifyCreateCanisterResult = IDL.Variant({
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
Ok: IDL.Principal,
|
|
95
|
+
Err: NotifyError,
|
|
89
96
|
});
|
|
90
97
|
const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
91
98
|
const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
92
99
|
const NotifyMintCyclesArg = IDL.Record({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
block_index: BlockIndex,
|
|
101
|
+
deposit_memo: Memo,
|
|
102
|
+
to_subaccount: Subaccount,
|
|
96
103
|
});
|
|
97
104
|
const NotifyMintCyclesSuccess = IDL.Record({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
balance: IDL.Nat,
|
|
106
|
+
block_index: IDL.Nat,
|
|
107
|
+
minted: IDL.Nat,
|
|
101
108
|
});
|
|
102
109
|
const NotifyMintCyclesResult = IDL.Variant({
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
Ok: NotifyMintCyclesSuccess,
|
|
111
|
+
Err: NotifyError,
|
|
105
112
|
});
|
|
106
113
|
const NotifyTopUpArg = IDL.Record({
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
block_index: BlockIndex,
|
|
115
|
+
canister_id: IDL.Principal,
|
|
109
116
|
});
|
|
110
117
|
const Cycles = IDL.Nat;
|
|
111
|
-
const NotifyTopUpResult = IDL.Variant({
|
|
118
|
+
const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });
|
|
119
|
+
|
|
112
120
|
return IDL.Service({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[NotifyMintCyclesResult],
|
|
143
|
-
[],
|
|
144
|
-
),
|
|
145
|
-
'notify_top_up' : IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
|
|
121
|
+
create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),
|
|
122
|
+
get_build_metadata: IDL.Func([], [IDL.Text], []),
|
|
123
|
+
get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),
|
|
124
|
+
get_icp_xdr_conversion_rate: IDL.Func(
|
|
125
|
+
[],
|
|
126
|
+
[IcpXdrConversionRateResponse],
|
|
127
|
+
[],
|
|
128
|
+
),
|
|
129
|
+
get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(
|
|
130
|
+
[],
|
|
131
|
+
[PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],
|
|
132
|
+
[],
|
|
133
|
+
),
|
|
134
|
+
get_subnet_types_to_subnets: IDL.Func(
|
|
135
|
+
[],
|
|
136
|
+
[SubnetTypesToSubnetsResponse],
|
|
137
|
+
[],
|
|
138
|
+
),
|
|
139
|
+
notify_create_canister: IDL.Func(
|
|
140
|
+
[NotifyCreateCanisterArg],
|
|
141
|
+
[NotifyCreateCanisterResult],
|
|
142
|
+
[],
|
|
143
|
+
),
|
|
144
|
+
notify_mint_cycles: IDL.Func(
|
|
145
|
+
[NotifyMintCyclesArg],
|
|
146
|
+
[NotifyMintCyclesResult],
|
|
147
|
+
[],
|
|
148
|
+
),
|
|
149
|
+
notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
|
|
146
150
|
});
|
|
147
151
|
};
|
|
152
|
+
|
|
148
153
|
export const init = ({ IDL }) => {
|
|
149
154
|
const ExchangeRateCanister = IDL.Variant({
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
Set: IDL.Principal,
|
|
156
|
+
Unset: IDL.Null,
|
|
152
157
|
});
|
|
153
158
|
const AccountIdentifier = IDL.Text;
|
|
154
159
|
const CyclesCanisterInitPayload = IDL.Record({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
160
|
+
exchange_rate_canister: IDL.Opt(ExchangeRateCanister),
|
|
161
|
+
cycles_ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
162
|
+
last_purged_notification: IDL.Opt(IDL.Nat64),
|
|
163
|
+
governance_canister_id: IDL.Opt(IDL.Principal),
|
|
164
|
+
minting_account_id: IDL.Opt(AccountIdentifier),
|
|
165
|
+
ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
166
|
+
});
|
|
167
|
+
|
|
162
168
|
return [IDL.Opt(CyclesCanisterInitPayload)];
|
|
163
169
|
};
|
package/dist/candid/cmc.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
|
|
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
|
+
import type { ActorMethod } from "@icp-sdk/core/agent";
|
|
10
|
+
import type { IDL } from "@icp-sdk/core/candid";
|
|
11
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
4
12
|
|
|
5
13
|
export type AccountIdentifier = string;
|
|
6
14
|
export type BlockIndex = bigint;
|
package/dist/candid/cmc.idl.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { IDL } from "@
|
|
1
|
+
import type { IDL } from "@icp-sdk/core/candid";
|
|
2
2
|
export const idlFactory: IDL.InterfaceFactory;
|
package/dist/candid/cmc.idl.js
CHANGED
|
@@ -1,163 +1,169 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.
|
|
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
|
+
|
|
2
9
|
export const idlFactory = ({ IDL }) => {
|
|
3
10
|
const ExchangeRateCanister = IDL.Variant({
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
Set: IDL.Principal,
|
|
12
|
+
Unset: IDL.Null,
|
|
6
13
|
});
|
|
7
14
|
const AccountIdentifier = IDL.Text;
|
|
8
15
|
const CyclesCanisterInitPayload = IDL.Record({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
const SubnetFilter = 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 SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });
|
|
17
24
|
const SubnetSelection = IDL.Variant({
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
Filter: SubnetFilter,
|
|
26
|
+
Subnet: IDL.Record({ subnet: IDL.Principal }),
|
|
20
27
|
});
|
|
21
28
|
const log_visibility = IDL.Variant({
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
controllers: IDL.Null,
|
|
30
|
+
public: IDL.Null,
|
|
24
31
|
});
|
|
25
32
|
const CanisterSettings = IDL.Record({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
freezing_threshold: IDL.Opt(IDL.Nat),
|
|
34
|
+
wasm_memory_threshold: IDL.Opt(IDL.Nat),
|
|
35
|
+
controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
36
|
+
reserved_cycles_limit: IDL.Opt(IDL.Nat),
|
|
37
|
+
log_visibility: IDL.Opt(log_visibility),
|
|
38
|
+
wasm_memory_limit: IDL.Opt(IDL.Nat),
|
|
39
|
+
memory_allocation: IDL.Opt(IDL.Nat),
|
|
40
|
+
compute_allocation: IDL.Opt(IDL.Nat),
|
|
34
41
|
});
|
|
35
42
|
const CreateCanisterArg = IDL.Record({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
subnet_selection: IDL.Opt(SubnetSelection),
|
|
44
|
+
settings: IDL.Opt(CanisterSettings),
|
|
45
|
+
subnet_type: IDL.Opt(IDL.Text),
|
|
39
46
|
});
|
|
40
47
|
const CreateCanisterError = IDL.Variant({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
Refunded: IDL.Record({
|
|
49
|
+
create_error: IDL.Text,
|
|
50
|
+
refund_amount: IDL.Nat,
|
|
44
51
|
}),
|
|
45
52
|
});
|
|
46
53
|
const CreateCanisterResult = IDL.Variant({
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
Ok: IDL.Principal,
|
|
55
|
+
Err: CreateCanisterError,
|
|
49
56
|
});
|
|
50
57
|
const IcpXdrConversionRate = IDL.Record({
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
xdr_permyriad_per_icp: IDL.Nat64,
|
|
59
|
+
timestamp_seconds: IDL.Nat64,
|
|
53
60
|
});
|
|
54
61
|
const IcpXdrConversionRateResponse = IDL.Record({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
certificate: IDL.Vec(IDL.Nat8),
|
|
63
|
+
data: IcpXdrConversionRate,
|
|
64
|
+
hash_tree: IDL.Vec(IDL.Nat8),
|
|
58
65
|
});
|
|
59
66
|
const PrincipalsAuthorizedToCreateCanistersToSubnetsResponse = IDL.Record({
|
|
60
|
-
|
|
67
|
+
data: IDL.Vec(IDL.Tuple(IDL.Principal, IDL.Vec(IDL.Principal))),
|
|
61
68
|
});
|
|
62
69
|
const SubnetTypesToSubnetsResponse = IDL.Record({
|
|
63
|
-
|
|
70
|
+
data: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Principal))),
|
|
64
71
|
});
|
|
65
72
|
const BlockIndex = IDL.Nat64;
|
|
66
73
|
const NotifyCreateCanisterArg = IDL.Record({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
controller: IDL.Principal,
|
|
75
|
+
block_index: BlockIndex,
|
|
76
|
+
subnet_selection: IDL.Opt(SubnetSelection),
|
|
77
|
+
settings: IDL.Opt(CanisterSettings),
|
|
78
|
+
subnet_type: IDL.Opt(IDL.Text),
|
|
72
79
|
});
|
|
73
80
|
const NotifyError = IDL.Variant({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
Refunded: IDL.Record({
|
|
82
|
+
block_index: IDL.Opt(BlockIndex),
|
|
83
|
+
reason: IDL.Text,
|
|
77
84
|
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
InvalidTransaction: IDL.Text,
|
|
86
|
+
Other: IDL.Record({
|
|
87
|
+
error_message: IDL.Text,
|
|
88
|
+
error_code: IDL.Nat64,
|
|
82
89
|
}),
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
Processing: IDL.Null,
|
|
91
|
+
TransactionTooOld: BlockIndex,
|
|
85
92
|
});
|
|
86
93
|
const NotifyCreateCanisterResult = IDL.Variant({
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
Ok: IDL.Principal,
|
|
95
|
+
Err: NotifyError,
|
|
89
96
|
});
|
|
90
97
|
const Memo = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
91
98
|
const Subaccount = IDL.Opt(IDL.Vec(IDL.Nat8));
|
|
92
99
|
const NotifyMintCyclesArg = IDL.Record({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
block_index: BlockIndex,
|
|
101
|
+
deposit_memo: Memo,
|
|
102
|
+
to_subaccount: Subaccount,
|
|
96
103
|
});
|
|
97
104
|
const NotifyMintCyclesSuccess = IDL.Record({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
balance: IDL.Nat,
|
|
106
|
+
block_index: IDL.Nat,
|
|
107
|
+
minted: IDL.Nat,
|
|
101
108
|
});
|
|
102
109
|
const NotifyMintCyclesResult = IDL.Variant({
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
Ok: NotifyMintCyclesSuccess,
|
|
111
|
+
Err: NotifyError,
|
|
105
112
|
});
|
|
106
113
|
const NotifyTopUpArg = IDL.Record({
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
block_index: BlockIndex,
|
|
115
|
+
canister_id: IDL.Principal,
|
|
109
116
|
});
|
|
110
117
|
const Cycles = IDL.Nat;
|
|
111
|
-
const NotifyTopUpResult = IDL.Variant({
|
|
118
|
+
const NotifyTopUpResult = IDL.Variant({ Ok: Cycles, Err: NotifyError });
|
|
119
|
+
|
|
112
120
|
return IDL.Service({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[NotifyMintCyclesResult],
|
|
143
|
-
[],
|
|
144
|
-
),
|
|
145
|
-
'notify_top_up' : IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
|
|
121
|
+
create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),
|
|
122
|
+
get_build_metadata: IDL.Func([], [IDL.Text], ["query"]),
|
|
123
|
+
get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], ["query"]),
|
|
124
|
+
get_icp_xdr_conversion_rate: IDL.Func(
|
|
125
|
+
[],
|
|
126
|
+
[IcpXdrConversionRateResponse],
|
|
127
|
+
["query"],
|
|
128
|
+
),
|
|
129
|
+
get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(
|
|
130
|
+
[],
|
|
131
|
+
[PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],
|
|
132
|
+
["query"],
|
|
133
|
+
),
|
|
134
|
+
get_subnet_types_to_subnets: IDL.Func(
|
|
135
|
+
[],
|
|
136
|
+
[SubnetTypesToSubnetsResponse],
|
|
137
|
+
["query"],
|
|
138
|
+
),
|
|
139
|
+
notify_create_canister: IDL.Func(
|
|
140
|
+
[NotifyCreateCanisterArg],
|
|
141
|
+
[NotifyCreateCanisterResult],
|
|
142
|
+
[],
|
|
143
|
+
),
|
|
144
|
+
notify_mint_cycles: IDL.Func(
|
|
145
|
+
[NotifyMintCyclesArg],
|
|
146
|
+
[NotifyMintCyclesResult],
|
|
147
|
+
[],
|
|
148
|
+
),
|
|
149
|
+
notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),
|
|
146
150
|
});
|
|
147
151
|
};
|
|
152
|
+
|
|
148
153
|
export const init = ({ IDL }) => {
|
|
149
154
|
const ExchangeRateCanister = IDL.Variant({
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
Set: IDL.Principal,
|
|
156
|
+
Unset: IDL.Null,
|
|
152
157
|
});
|
|
153
158
|
const AccountIdentifier = IDL.Text;
|
|
154
159
|
const CyclesCanisterInitPayload = IDL.Record({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
160
|
+
exchange_rate_canister: IDL.Opt(ExchangeRateCanister),
|
|
161
|
+
cycles_ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
162
|
+
last_purged_notification: IDL.Opt(IDL.Nat64),
|
|
163
|
+
governance_canister_id: IDL.Opt(IDL.Principal),
|
|
164
|
+
minting_account_id: IDL.Opt(AccountIdentifier),
|
|
165
|
+
ledger_canister_id: IDL.Opt(IDL.Principal),
|
|
166
|
+
});
|
|
167
|
+
|
|
162
168
|
return [IDL.Opt(CyclesCanisterInitPayload)];
|
|
163
169
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Principal } from "@dfinity/principal";
|
|
2
1
|
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
3
|
-
import type {
|
|
2
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Principal } from "@dfinity/principal";
|
|
2
1
|
import type { CanisterOptions } from "@dfinity/utils";
|
|
3
|
-
import type {
|
|
2
|
+
import type { Principal } from "@icp-sdk/core/principal";
|
|
3
|
+
import type { _SERVICE as CanisterService } from "./candid/cmc";
|
|
4
4
|
export interface CMCCanisterOptions extends Omit<CanisterOptions<CanisterService>, "canisterId"> {
|
|
5
5
|
canisterId: Principal;
|
|
6
6
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse, } from "
|
|
1
|
+
export type { Cycles, NotifyCreateCanisterArg, NotifyTopUpArg, SubnetTypesToSubnetsResponse, } from "./candid/cmc";
|
|
2
2
|
export { CMCCanister } from "./cmc.canister";
|
|
3
3
|
export * from "./cmc.errors";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{Canister as q,createServices as $}from"@dfinity/utils";var A=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),s=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(o),settings:t.Opt(s),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)}),f=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),O=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(s),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),m=t.Variant({Ok:t.Principal,Err:i}),N=t.Opt(t.Vec(t.Nat8)),g=t.Opt(t.Vec(t.Nat8)),b=t.Record({block_index:r,deposit_memo:N,to_subaccount:g}),x=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),R=t.Variant({Ok:x,Err:i}),T=t.Record({block_index:r,canister_id:t.Principal}),P=t.Nat,h=t.Variant({Ok:P,Err:i});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([],[f],[]),get_subnet_types_to_subnets:t.Func([],[O],[]),notify_create_canister:t.Func([C],[m],[]),notify_mint_cycles:t.Func([b],[R],[]),notify_top_up:t.Func([T],[h],[])})};var U=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),s=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(o),settings:t.Opt(s),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)}),f=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),O=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(s),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),m=t.Variant({Ok:t.Principal,Err:i}),N=t.Opt(t.Vec(t.Nat8)),g=t.Opt(t.Vec(t.Nat8)),b=t.Record({block_index:r,deposit_memo:N,to_subaccount:g}),x=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),R=t.Variant({Ok:x,Err:i}),T=t.Record({block_index:r,canister_id:t.Principal}),P=t.Nat,h=t.Variant({Ok:P,Err:i});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([],[f],["query"]),get_subnet_types_to_subnets:t.Func([],[O],["query"]),notify_create_canister:t.Func([C],[m],[]),notify_mint_cycles:t.Func([b],[R],[]),notify_top_up:t.Func([T],[h],[])})};import{assertNever as M,jsonReplacer as z}from"@dfinity/utils";var S=class extends Error{},V=class extends Error{},v=class extends Error{},E=class extends Error{},F=class extends Error{},k=({Err:t})=>{if("Refunded"in t)throw new S(t.Refunded.reason);if("InvalidTransaction"in t)throw new V(t.InvalidTransaction);if("Processing"in t)throw new E;if("TransactionTooOld"in t)throw new F;if("Other"in t)throw new v(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);M(t,`Unsupported error type ${JSON.stringify(t,z)}`)};var w=class t extends q{static create(n){let{service:e,certifiedService:a,canisterId:c}=$({options:n,idlFactory:U,certifiedIdlFactory:A});return new t(c,e,a)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&k(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&k(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{w as CMCCanister,v as CMCError,V as InvalidaTransactionError,E as ProcessingError,S as RefundedError,F as TransactionTooOldError,k as throwNotifyError};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cmc.canister.ts", "../src/candid/cmc.certified.idl.js", "../src/candid/cmc.idl.js", "../src/cmc.errors.ts"],
|
|
4
|
+
"sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const 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\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const 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\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCQpD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAKA,EAAI,UACT,MAAOA,EAAI,IACb,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAAwBA,EAAI,IAAIC,CAAoB,EACpD,0BAA2BD,EAAI,IAAIA,EAAI,SAAS,EAChD,yBAA0BA,EAAI,IAAIA,EAAI,KAAK,EAC3C,uBAAwBA,EAAI,IAAIA,EAAI,SAAS,EAC7C,mBAAoBA,EAAI,IAAIE,CAAiB,EAC7C,mBAAoBF,EAAI,IAAIA,EAAI,SAAS,CAC3C,CAAC,EACKI,EAAeJ,EAAI,OAAO,CAAE,YAAaA,EAAI,IAAIA,EAAI,IAAI,CAAE,CAAC,EAC5DK,EAAkBL,EAAI,QAAQ,CAClC,OAAQI,EACR,OAAQJ,EAAI,OAAO,CAAE,OAAQA,EAAI,SAAU,CAAC,CAC9C,CAAC,EACKM,EAAiBN,EAAI,QAAQ,CACjC,YAAaA,EAAI,KACjB,OAAQA,EAAI,IACd,CAAC,EACKO,EAAmBP,EAAI,OAAO,CAClC,mBAAoBA,EAAI,IAAIA,EAAI,GAAG,EACnC,sBAAuBA,EAAI,IAAIA,EAAI,GAAG,EACtC,YAAaA,EAAI,IAAIA,EAAI,IAAIA,EAAI,SAAS,CAAC,EAC3C,sBAAuBA,EAAI,IAAIA,EAAI,GAAG,EACtC,eAAgBA,EAAI,IAAIM,CAAc,EACtC,kBAAmBN,EAAI,IAAIA,EAAI,GAAG,EAClC,kBAAmBA,EAAI,IAAIA,EAAI,GAAG,EAClC,mBAAoBA,EAAI,IAAIA,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4BAA4B,EAI/B,OAAOC,EAAK,qBACd,EAYO,qBAAuB,MAC5BC,GACuB,CACvB,IAAMC,EAAW,MAAM,KAAK,QAAQ,uBAAuBD,CAAO,EAIlE,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,qDAAqD,KAAK,UACxDA,CACF,CAAC,EACH,CACF,EAYO,YAAc,MAAOD,GAA6C,CACvE,IAAMC,EAAW,MAAM,KAAK,QAAQ,cAAcD,CAAO,EAIzD,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,4CAA4C,KAAK,UAAUA,CAAQ,CAAC,EACtE,CACF,EAaO,kBAAoB,CAAC,CAAE,UAAAH,CAAU,EAAiB,CAAC,IAErD,CACH,GAAM,CAAE,oBAAAK,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
|
|
6
|
+
"names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "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", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
|
|
7
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
import{Canister as q,createServices as $}from"@dfinity/utils";var A=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),s=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(o),settings:t.Opt(s),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)}),f=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),O=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(s),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),m=t.Variant({Ok:t.Principal,Err:i}),N=t.Opt(t.Vec(t.Nat8)),g=t.Opt(t.Vec(t.Nat8)),b=t.Record({block_index:r,deposit_memo:N,to_subaccount:g}),x=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),R=t.Variant({Ok:x,Err:i}),T=t.Record({block_index:r,canister_id:t.Principal}),P=t.Nat,h=t.Variant({Ok:P,Err:i});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([],[f],[]),get_subnet_types_to_subnets:t.Func([],[O],[]),notify_create_canister:t.Func([C],[m],[]),notify_mint_cycles:t.Func([b],[R],[]),notify_top_up:t.Func([T],[h],[])})};var U=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,a=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),o=t.Variant({Filter:c,Subnet:t.Record({subnet:t.Principal})}),p=t.Variant({controllers:t.Null,public:t.Null}),s=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(o),settings:t.Opt(s),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)}),f=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),O=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),r=t.Nat64,C=t.Record({controller:t.Principal,block_index:r,subnet_selection:t.Opt(o),settings:t.Opt(s),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),m=t.Variant({Ok:t.Principal,Err:i}),N=t.Opt(t.Vec(t.Nat8)),g=t.Opt(t.Vec(t.Nat8)),b=t.Record({block_index:r,deposit_memo:N,to_subaccount:g}),x=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),R=t.Variant({Ok:x,Err:i}),T=t.Record({block_index:r,canister_id:t.Principal}),P=t.Nat,h=t.Variant({Ok:P,Err:i});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([],[f],["query"]),get_subnet_types_to_subnets:t.Func([],[O],["query"]),notify_create_canister:t.Func([C],[m],[]),notify_mint_cycles:t.Func([b],[R],[]),notify_top_up:t.Func([T],[h],[])})};import{assertNever as M,jsonReplacer as z}from"@dfinity/utils";var S=class extends Error{},V=class extends Error{},v=class extends Error{},E=class extends Error{},F=class extends Error{},k=({Err:t})=>{if("Refunded"in t)throw new S(t.Refunded.reason);if("InvalidTransaction"in t)throw new V(t.InvalidTransaction);if("Processing"in t)throw new E;if("TransactionTooOld"in t)throw new F;if("Other"in t)throw new v(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);M(t,`Unsupported error type ${JSON.stringify(t,z)}`)};var w=class t extends q{static create(n){let{service:e,certifiedService:a,canisterId:c}=$({options:n,idlFactory:U,certifiedIdlFactory:A});return new t(c,e,a)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&k(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&k(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{w as CMCCanister,v as CMCError,V as InvalidaTransactionError,E as ProcessingError,S as RefundedError,F as TransactionTooOldError,k as throwNotifyError};
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cmc.canister.ts", "../src/candid/cmc.certified.idl.js", "../src/candid/cmc.idl.js", "../src/cmc.errors.ts"],
|
|
4
|
+
"sourcesContent": ["import { Canister, createServices, type QueryParams } from \"@dfinity/utils\";\nimport type { Principal } from \"@icp-sdk/core/principal\";\nimport type {\n _SERVICE as CMCCanisterService,\n Cycles,\n NotifyCreateCanisterArg,\n NotifyTopUpArg,\n SubnetTypesToSubnetsResponse,\n} from \"./candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"./candid/cmc.certified.idl\";\nimport { idlFactory } from \"./candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const 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\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], []),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], []),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "/* eslint-disable */\n\n// @ts-nocheck\n\n// This file was automatically generated by @icp-sdk/bindgen@0.2.0-patch-typed-arrays.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nexport const idlFactory = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n const SubnetFilter = IDL.Record({ subnet_type: IDL.Opt(IDL.Text) });\n const SubnetSelection = IDL.Variant({\n Filter: SubnetFilter,\n Subnet: IDL.Record({ subnet: IDL.Principal }),\n });\n const 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\n return IDL.Service({\n create_canister: IDL.Func([CreateCanisterArg], [CreateCanisterResult], []),\n get_build_metadata: IDL.Func([], [IDL.Text], [\"query\"]),\n get_default_subnets: IDL.Func([], [IDL.Vec(IDL.Principal)], [\"query\"]),\n get_icp_xdr_conversion_rate: IDL.Func(\n [],\n [IcpXdrConversionRateResponse],\n [\"query\"],\n ),\n get_principals_authorized_to_create_canisters_to_subnets: IDL.Func(\n [],\n [PrincipalsAuthorizedToCreateCanistersToSubnetsResponse],\n [\"query\"],\n ),\n get_subnet_types_to_subnets: IDL.Func(\n [],\n [SubnetTypesToSubnetsResponse],\n [\"query\"],\n ),\n notify_create_canister: IDL.Func(\n [NotifyCreateCanisterArg],\n [NotifyCreateCanisterResult],\n [],\n ),\n notify_mint_cycles: IDL.Func(\n [NotifyMintCyclesArg],\n [NotifyMintCyclesResult],\n [],\n ),\n notify_top_up: IDL.Func([NotifyTopUpArg], [NotifyTopUpResult], []),\n });\n};\n\nexport const init = ({ IDL }) => {\n const ExchangeRateCanister = IDL.Variant({\n Set: IDL.Principal,\n Unset: IDL.Null,\n });\n const AccountIdentifier = IDL.Text;\n const CyclesCanisterInitPayload = IDL.Record({\n exchange_rate_canister: IDL.Opt(ExchangeRateCanister),\n cycles_ledger_canister_id: IDL.Opt(IDL.Principal),\n last_purged_notification: IDL.Opt(IDL.Nat64),\n governance_canister_id: IDL.Opt(IDL.Principal),\n minting_account_id: IDL.Opt(AccountIdentifier),\n ledger_canister_id: IDL.Opt(IDL.Principal),\n });\n\n return [IDL.Opt(CyclesCanisterInitPayload)];\n};\n", "import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"./candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
|
|
5
|
+
"mappings": ";;AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAwC,iBCQpD,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAuBD,EAAI,QAAQ,CACvC,IAAKA,EAAI,UACT,MAAOA,EAAI,IACb,CAAC,EACKE,EAAoBF,EAAI,KACxBG,EAA4BH,EAAI,OAAO,CAC3C,uBAAwBA,EAAI,IAAIC,CAAoB,EACpD,0BAA2BD,EAAI,IAAIA,EAAI,SAAS,EAChD,yBAA0BA,EAAI,IAAIA,EAAI,KAAK,EAC3C,uBAAwBA,EAAI,IAAIA,EAAI,SAAS,EAC7C,mBAAoBA,EAAI,IAAIE,CAAiB,EAC7C,mBAAoBF,EAAI,IAAIA,EAAI,SAAS,CAC3C,CAAC,EACKI,EAAeJ,EAAI,OAAO,CAAE,YAAaA,EAAI,IAAIA,EAAI,IAAI,CAAE,CAAC,EAC5DK,EAAkBL,EAAI,QAAQ,CAClC,OAAQI,EACR,OAAQJ,EAAI,OAAO,CAAE,OAAQA,EAAI,SAAU,CAAC,CAC9C,CAAC,EACKM,EAAiBN,EAAI,QAAQ,CACjC,YAAaA,EAAI,KACjB,OAAQA,EAAI,IACd,CAAC,EACKO,EAAmBP,EAAI,OAAO,CAClC,mBAAoBA,EAAI,IAAIA,EAAI,GAAG,EACnC,sBAAuBA,EAAI,IAAIA,EAAI,GAAG,EACtC,YAAaA,EA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AAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIP,EAAYK,EAAYF,EAASC,CAAgB,CAC9D,CAUO,6BAA+B,MAAO,CAC3C,UAAAI,CACF,EAAiB,CAAC,IAAuB,CACvC,GAAM,CAAE,KAAAC,CAAK,EAAI,MAAM,KAAK,OAAO,CACjC,UAAAD,CACF,CAAC,EAAE,4BAA4B,EAI/B,OAAOC,EAAK,qBACd,EAYO,qBAAuB,MAC5BC,GACuB,CACvB,IAAMC,EAAW,MAAM,KAAK,QAAQ,uBAAuBD,CAAO,EAIlE,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,qDAAqD,KAAK,UACxDA,CACF,CAAC,EACH,CACF,EAYO,YAAc,MAAOD,GAA6C,CACvE,IAAMC,EAAW,MAAM,KAAK,QAAQ,cAAcD,CAAO,EAIzD,GAHI,QAASC,GACXC,EAAiBD,CAAQ,EAEvB,OAAQA,EACV,OAAOA,EAAS,GAGlB,MAAM,IAAI,MACR,4CAA4C,KAAK,UAAUA,CAAQ,CAAC,EACtE,CACF,EAaO,kBAAoB,CAAC,CAAE,UAAAH,CAAU,EAAiB,CAAC,IAErD,CACH,GAAM,CAAE,oBAAAK,CAAoB,EAAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
|
|
6
|
+
"names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "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", "assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "Canister", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfinity/cmc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-next-2025-10-20",
|
|
4
4
|
"description": "A library for interfacing with the cycle minting canister.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.mjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.mjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
9
22
|
"files": [
|
|
10
23
|
"dist",
|
|
11
24
|
"README.md",
|
|
@@ -13,8 +26,8 @@
|
|
|
13
26
|
],
|
|
14
27
|
"scripts": {
|
|
15
28
|
"rmdir": "node ../../scripts/rmdir.mjs",
|
|
16
|
-
"ts-declaration": "tsc --emitDeclarationOnly --outDir dist
|
|
17
|
-
"build": "npm run rmdir && mkdir -p dist && cp -R candid dist && node esbuild.mjs && npm run ts-declaration",
|
|
29
|
+
"ts-declaration": "tsc --emitDeclarationOnly --outDir dist",
|
|
30
|
+
"build": "npm run rmdir && mkdir -p dist && cp -R src/candid dist && node esbuild.mjs && npm run ts-declaration",
|
|
18
31
|
"prepack": "npm run build",
|
|
19
32
|
"test": "vitest"
|
|
20
33
|
},
|
|
@@ -36,9 +49,7 @@
|
|
|
36
49
|
],
|
|
37
50
|
"homepage": "https://github.com/dfinity/ic-js#readme",
|
|
38
51
|
"peerDependencies": {
|
|
39
|
-
"@dfinity/
|
|
40
|
-
"@
|
|
41
|
-
"@dfinity/principal": "^3",
|
|
42
|
-
"@dfinity/utils": "^3"
|
|
52
|
+
"@dfinity/utils": "*",
|
|
53
|
+
"@icp-sdk/core": "*"
|
|
43
54
|
}
|
|
44
|
-
}
|
|
55
|
+
}
|
package/dist/cjs/index.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var J=(t,n)=>{for(var e in n)M(t,e,{get:n[e],enumerable:!0})},B=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Q(n))!X.call(t,r)&&r!==e&&M(t,r,{get:()=>n[r],enumerable:!(o=$(n,r))||o.enumerable});return t};var j=t=>B(M({},"__esModule",{value:!0}),t);var G={};J(G,{CMCCanister:()=>O,CMCError:()=>_,InvalidaTransactionError:()=>l,ProcessingError:()=>d,RefundedError:()=>p,TransactionTooOldError:()=>u,throwNotifyError:()=>f});module.exports=j(G);var C=require("@dfinity/utils");var z=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,o=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),r=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:r,Subnet:t.Record({subnet:t.Principal})}),m=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(m),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),N=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),g=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),b=t.Variant({Ok:t.Principal,Err:g}),x=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),R=t.Record({certificate:t.Vec(t.Nat8),data:x,hash_tree:t.Vec(t.Nat8)}),T=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),P=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),i=t.Nat64,h=t.Record({controller:t.Principal,block_index:i,subnet_selection:t.Opt(s),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(i),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:i}),S=t.Variant({Ok:t.Principal,Err:c}),V=t.Opt(t.Vec(t.Nat8)),v=t.Opt(t.Vec(t.Nat8)),E=t.Record({block_index:i,deposit_memo:V,to_subaccount:v}),F=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:F,Err:c}),k=t.Record({block_index:i,canister_id:t.Principal}),A=t.Nat,U=t.Variant({Ok:A,Err:c});return t.Service({create_canister:t.Func([N],[b],[]),get_build_metadata:t.Func([],[t.Text],[]),get_default_subnets:t.Func([],[t.Vec(t.Principal)],[]),get_icp_xdr_conversion_rate:t.Func([],[R],[]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[T],[]),get_subnet_types_to_subnets:t.Func([],[P],[]),notify_create_canister:t.Func([h],[S],[]),notify_mint_cycles:t.Func([E],[w],[]),notify_top_up:t.Func([k],[U],[])})};var q=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,o=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),r=t.Record({subnet_type:t.Opt(t.Text)}),s=t.Variant({Filter:r,Subnet:t.Record({subnet:t.Principal})}),m=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(m),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),N=t.Record({subnet_selection:t.Opt(s),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),g=t.Variant({Refunded:t.Record({create_error:t.Text,refund_amount:t.Nat})}),b=t.Variant({Ok:t.Principal,Err:g}),x=t.Record({xdr_permyriad_per_icp:t.Nat64,timestamp_seconds:t.Nat64}),R=t.Record({certificate:t.Vec(t.Nat8),data:x,hash_tree:t.Vec(t.Nat8)}),T=t.Record({data:t.Vec(t.Tuple(t.Principal,t.Vec(t.Principal)))}),P=t.Record({data:t.Vec(t.Tuple(t.Text,t.Vec(t.Principal)))}),i=t.Nat64,h=t.Record({controller:t.Principal,block_index:i,subnet_selection:t.Opt(s),settings:t.Opt(a),subnet_type:t.Opt(t.Text)}),c=t.Variant({Refunded:t.Record({block_index:t.Opt(i),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:i}),S=t.Variant({Ok:t.Principal,Err:c}),V=t.Opt(t.Vec(t.Nat8)),v=t.Opt(t.Vec(t.Nat8)),E=t.Record({block_index:i,deposit_memo:V,to_subaccount:v}),F=t.Record({balance:t.Nat,block_index:t.Nat,minted:t.Nat}),w=t.Variant({Ok:F,Err:c}),k=t.Record({block_index:i,canister_id:t.Principal}),A=t.Nat,U=t.Variant({Ok:A,Err:c});return t.Service({create_canister:t.Func([N],[b],[]),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([],[R],["query"]),get_principals_authorized_to_create_canisters_to_subnets:t.Func([],[T],["query"]),get_subnet_types_to_subnets:t.Func([],[P],["query"]),notify_create_canister:t.Func([h],[S],[]),notify_mint_cycles:t.Func([E],[w],[]),notify_top_up:t.Func([k],[U],[])})};var y=require("@dfinity/utils"),p=class extends Error{},l=class extends Error{},_=class extends Error{},d=class extends Error{},u=class extends Error{},f=({Err:t})=>{if("Refunded"in t)throw new p(t.Refunded.reason);if("InvalidTransaction"in t)throw new l(t.InvalidTransaction);if("Processing"in t)throw new d;if("TransactionTooOld"in t)throw new u;if("Other"in t)throw new _(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);(0,y.assertNever)(t,`Unsupported error type ${JSON.stringify(t,y.jsonReplacer)}`)};var O=class t extends C.Canister{static create(n){let{service:e,certifiedService:o,canisterId:r}=(0,C.createServices)({options:n,idlFactory:q,certifiedIdlFactory:z});return new t(r,e,o)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&f(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&f(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};0&&(module.exports={CMCCanister,CMCError,InvalidaTransactionError,ProcessingError,RefundedError,TransactionTooOldError,throwNotifyError});
|
|
2
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 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. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* 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 { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"../candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
|
|
5
|
-
"mappings": "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,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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_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", "import_utils", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error", "CMCCanister", "_CMCCanister", "options", "service", "certifiedService", "canisterId", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as V}from"./chunk-G7V22BZT.js";import{Canister as k,createServices as E}from"@dfinity/utils";var h=({IDL:t})=>{let n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),a=t.Variant({Filter:c,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(a),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(a),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),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:i}),T=t.Record({block_index:r,canister_id:t.Principal}),x=t.Nat,S=t.Variant({Ok:x,Err:i});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 n=t.Variant({Set:t.Principal,Unset:t.Null}),e=t.Text,s=t.Record({exchange_rate_canister:t.Opt(n),cycles_ledger_canister_id:t.Opt(t.Principal),last_purged_notification:t.Opt(t.Nat64),governance_canister_id:t.Opt(t.Principal),minting_account_id:t.Opt(e),ledger_canister_id:t.Opt(t.Principal)}),c=t.Record({subnet_type:t.Opt(t.Text)}),a=t.Variant({Filter:c,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(a),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(a),settings:t.Opt(o),subnet_type:t.Opt(t.Text)}),i=t.Variant({Refunded:t.Record({block_index:t.Opt(r),reason:t.Text}),InvalidTransaction:t.Text,Other:t.Record({error_message:t.Text,error_code:t.Nat64}),Processing:t.Null,TransactionTooOld:r}),N=t.Variant({Ok:t.Principal,Err:i}),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:i}),T=t.Record({block_index:r,canister_id:t.Principal}),x=t.Nat,S=t.Variant({Ok:x,Err:i});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{static create(n){let{service:e,certifiedService:s,canisterId:c}=E({options:n,idlFactory:v,certifiedIdlFactory:h});return new t(c,e,s)}getIcpToCyclesConversionRate=async({certified:n}={})=>{let{data:e}=await this.caller({certified:n}).get_icp_xdr_conversion_rate();return e.xdr_permyriad_per_icp};notifyCreateCanister=async n=>{let e=await this.service.notify_create_canister(n);if("Err"in e&&V(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyCreateCanister ${JSON.stringify(e)}`)};notifyTopUp=async n=>{let e=await this.service.notify_top_up(n);if("Err"in e&&V(e),"Ok"in e)return e.Ok;throw new Error(`Unsupported response type in notifyTopUp ${JSON.stringify(e)}`)};getDefaultSubnets=({certified:n}={})=>{let{get_default_subnets:e}=this.caller({certified:n});return e()};getSubnetTypesToSubnets=({certified:n}={})=>{let{get_subnet_types_to_subnets:e}=this.caller({certified:n});return e()}};export{F as a};
|
|
2
|
-
//# sourceMappingURL=chunk-DKQBKL44.js.map
|
|
@@ -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 SubnetTypesToSubnetsResponse,\n} from \"../candid/cmc\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/cmc.certified.idl\";\nimport { idlFactory } from \"../candid/cmc.idl\";\nimport { throwNotifyError } from \"./cmc.errors\";\nimport type { CMCCanisterOptions } from \"./cmc.options\";\n\nexport class CMCCanister extends Canister<CMCCanisterService> {\n static create(options: CMCCanisterOptions): CMCCanister {\n const { service, certifiedService, canisterId } =\n createServices<CMCCanisterService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new CMCCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Returns conversion rate of ICP to Cycles. It can be called as query or update.\n *\n * @param {Object} [params] - The parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified (default: non-certified)\n *\n * @returns Promise<BigInt>\n */\n public getIcpToCyclesConversionRate = async ({\n certified,\n }: QueryParams = {}): Promise<bigint> => {\n const { data } = await this.caller({\n certified,\n }).get_icp_xdr_conversion_rate();\n\n // TODO: validate the certificate in the response - https://dfinity.atlassian.net/browse/GIX-150\n // Example: https://github.com/dfinity/response-verification/tree/main/examples/certification/certified-counter\n return data.xdr_permyriad_per_icp;\n };\n\n /**\n * Notifies Cycles Minting Canister of the creation of a new canister.\n * It returns the new canister principal.\n *\n * @param {Object} request\n * @param {Principal} request.controller\n * @param {BlockIndex} request.block_index\n * @returns Promise<Principal>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyCreateCanister = async (\n request: NotifyCreateCanisterArg,\n ): Promise<Principal> => {\n const response = await this.service.notify_create_canister(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyCreateCanister ${JSON.stringify(\n response,\n )}`,\n );\n };\n\n /**\n * Notifies Cycles Minting Canister of new cycles being added to canister.\n * It returns the new Cycles of the canister.\n *\n * @param {Object} request\n * @param {Principal} request.canister_id\n * @param {BlockIndex} request.block_index\n * @returns Promise<Cycles>\n * @throws RefundedError, InvalidaTransactionError, ProcessingError, TransactionTooOldError, CMCError\n */\n public notifyTopUp = async (request: NotifyTopUpArg): Promise<Cycles> => {\n const response = await this.service.notify_top_up(request);\n if (\"Err\" in response) {\n throwNotifyError(response);\n }\n if (\"Ok\" in response) {\n return response.Ok;\n }\n // Edge case\n throw new Error(\n `Unsupported response type in notifyTopUp ${JSON.stringify(response)}`,\n );\n };\n\n /**\n * This function calls the `get_default_subnets` method of the CMC canister, which returns a list of\n * default subnets as `Principal` objects. It can be called as query or update.\n *\n * @param {Object} [params] - The query parameters for the call.\n * @param {boolean} [params.certified] - Determines whether the response should be certified\n * (default: non-certified if not specified).\n *\n * @returns {Promise<Principal[]>} - A promise that resolves to an array of `Principal` objects\n * representing the default subnets.\n */\n public getDefaultSubnets = ({ certified }: QueryParams = {}): Promise<\n Principal[]\n > => {\n const { get_default_subnets } = this.caller({ certified });\n return get_default_subnets();\n };\n\n /**\n * This function calls the `get_subnet_types_to_subnets` method of the CMC canister, which returns a list of subnets where canisters can be created.\n * These subnets are excluded from the random subnet selection process used by the CMC when no explicit subnet ID is provided\n * during canister creation and therefore, not provided in the results of the similar function `get_default_subnets`.\n *\n * @param {Object} [params] - The optional query parameters for the call.\n * @param {boolean} [params.certified=false] - Specifies whether the response should be certified.\n * If not provided, the response defaults to non-certified.\n *\n * @returns {Promise<SubnetTypesToSubnetsResponse>} - A promise that resolves to an object representing\n * the mapping of subnet types to subnets.\n */\n public getSubnetTypesToSubnets = ({\n certified,\n }: QueryParams = {}): Promise<SubnetTypesToSubnetsResponse> => {\n const { get_subnet_types_to_subnets } = this.caller({ certified });\n return get_subnet_types_to_subnets();\n };\n}\n", "/* 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,EAAI,OAAO,CAClC,mBAAuBA,EAAI,IAAIA,EAAI,GAAG,EACtC,sBAA0BA,EAAI,IAAIA,EAAI,GAAG,EACzC,YAAgBA,EAAI,IAAIA,EAAI,IAAIA,EAAI,SAAS,CAAC,EAC9C,sBAA0BA,EAAI,IAAIA,EAAI,GAAG,EACzC,eAAmBA,EAAI,IAAIM,CAAc,EACzC,kBAAsBN,EAAI,IAAIA,EAAI,GAAG,EACrC,kBAAsBA,EAAI,IAAIA,EAAI,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AAI,KAAK,OAAO,CAAE,UAAAL,CAAU,CAAC,EACzD,OAAOK,EAAoB,CAC7B,EAcO,wBAA0B,CAAC,CAChC,UAAAL,CACF,EAAiB,CAAC,IAA6C,CAC7D,GAAM,CAAE,4BAAAM,CAA4B,EAAI,KAAK,OAAO,CAAE,UAAAN,CAAU,CAAC,EACjE,OAAOM,EAA4B,CACrC,CACF",
|
|
6
|
-
"names": ["Canister", "createServices", "idlFactory", "IDL", "ExchangeRateCanister", "AccountIdentifier", "CyclesCanisterInitPayload", "SubnetFilter", "SubnetSelection", "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", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory", "certified", "data", "request", "response", "throwNotifyError", "get_default_subnets", "get_subnet_types_to_subnets"]
|
|
7
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{assertNever as r,jsonReplacer as d}from"@dfinity/utils";var e=class extends Error{},n=class extends Error{},s=class extends Error{},o=class extends Error{},i=class extends Error{},p=({Err:t})=>{if("Refunded"in t)throw new e(t.Refunded.reason);if("InvalidTransaction"in t)throw new n(t.InvalidTransaction);if("Processing"in t)throw new o;if("TransactionTooOld"in t)throw new i;if("Other"in t)throw new s(`Error in CMC with code ${t.Other.error_code}: ${t.Other.error_message}`);r(t,`Unsupported error type ${JSON.stringify(t,d)}`)};export{e as a,n as b,s as c,o as d,i as e,p as f};
|
|
2
|
-
//# sourceMappingURL=chunk-G7V22BZT.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cmc.errors.ts"],
|
|
4
|
-
"sourcesContent": ["import { assertNever, jsonReplacer } from \"@dfinity/utils\";\nimport type { NotifyError } from \"../candid/cmc\";\n\nexport class RefundedError extends Error {}\nexport class InvalidaTransactionError extends Error {}\nexport class CMCError extends Error {}\nexport class ProcessingError extends Error {}\nexport class TransactionTooOldError extends Error {}\n\n// Throws one of the errors above\nexport const throwNotifyError = ({\n Err: error,\n}: {\n Err: NotifyError;\n}): void => {\n if (\"Refunded\" in error) {\n throw new RefundedError(error.Refunded.reason);\n }\n if (\"InvalidTransaction\" in error) {\n throw new InvalidaTransactionError(error.InvalidTransaction);\n }\n if (\"Processing\" in error) {\n throw new ProcessingError();\n }\n if (\"TransactionTooOld\" in error) {\n throw new TransactionTooOldError();\n }\n if (\"Other\" in error) {\n throw new CMCError(\n `Error in CMC with code ${error.Other.error_code}: ${error.Other.error_message}`,\n );\n }\n\n assertNever(\n error,\n `Unsupported error type ${JSON.stringify(error, jsonReplacer)}`,\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,gBAAAC,MAAoB,iBAGnC,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,GAAI,aAAcA,EAChB,MAAM,IAAIN,EAAcM,EAAM,SAAS,MAAM,EAE/C,GAAI,uBAAwBA,EAC1B,MAAM,IAAIL,EAAyBK,EAAM,kBAAkB,EAE7D,GAAI,eAAgBA,EAClB,MAAM,IAAIH,EAEZ,GAAI,sBAAuBG,EACzB,MAAM,IAAIF,EAEZ,GAAI,UAAWE,EACb,MAAM,IAAIJ,EACR,0BAA0BI,EAAM,MAAM,UAAU,KAAKA,EAAM,MAAM,aAAa,EAChF,EAGFR,EACEQ,EACA,0BAA0B,KAAK,UAAUA,EAAOP,CAAY,CAAC,EAC/D,CACF",
|
|
6
|
-
"names": ["assertNever", "jsonReplacer", "RefundedError", "InvalidaTransactionError", "CMCError", "ProcessingError", "TransactionTooOldError", "throwNotifyError", "error"]
|
|
7
|
-
}
|
package/dist/esm/cmc.canister.js
DELETED
package/dist/esm/cmc.errors.js
DELETED
package/dist/esm/cmc.mock.js
DELETED
package/dist/esm/cmc.mock.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cmc.mock.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Identity } from \"@dfinity/agent\";\nimport { Principal } from \"@dfinity/principal\";\n\nexport const mockPrincipalText =\n \"xlmdg-vkosz-ceopx-7wtgu-g3xmd-koiyc-awqaq-7modz-zf6r6-364rh-oqe\";\n\nexport const mockPrincipal = Principal.fromText(mockPrincipalText);\n\nexport const mockIdentity = {\n getPrincipal: () => mockPrincipal,\n} as unknown as Identity;\n"],
|
|
5
|
-
"mappings": "AACA,OAAS,aAAAA,MAAiB,qBAEnB,IAAMC,EACX,kEAEWC,EAAgBF,EAAU,SAASC,CAAiB,EAEpDE,EAAe,CAC1B,aAAc,IAAMD,CACtB",
|
|
6
|
-
"names": ["Principal", "mockPrincipalText", "mockPrincipal", "mockIdentity"]
|
|
7
|
-
}
|
package/dist/esm/cmc.options.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=cmc.options.js.map
|
package/dist/esm/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DKQBKL44.js";import{a as o,b as r,c as t,d as p,e as s,f as n}from"./chunk-G7V22BZT.js";export{e as CMCCanister,t as CMCError,r as InvalidaTransactionError,p as ProcessingError,o as RefundedError,s as TransactionTooOldError,n as throwNotifyError};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
package/dist/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./cjs/index.cjs.js');
|