@junobuild/analytics 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/declarations/cmc/cmc.did +122 -0
  4. package/declarations/cmc/cmc.did.d.ts +48 -0
  5. package/declarations/cmc/cmc.factory.did.js +67 -0
  6. package/declarations/cmc/index.d.ts +45 -0
  7. package/declarations/cmc/index.js +37 -0
  8. package/declarations/console/console.did.d.ts +71 -0
  9. package/declarations/console/console.factory.did.js +79 -0
  10. package/declarations/console/console.factory.did.mjs +79 -0
  11. package/declarations/console/index.d.ts +45 -0
  12. package/declarations/console/index.js +37 -0
  13. package/declarations/ic/ic.did +195 -0
  14. package/declarations/ic/ic.did.d.ts +208 -0
  15. package/declarations/ic/ic.factory.did.js +274 -0
  16. package/declarations/mission_control/index.d.ts +45 -0
  17. package/declarations/mission_control/index.js +38 -0
  18. package/declarations/mission_control/mission_control.did.d.ts +101 -0
  19. package/declarations/mission_control/mission_control.factory.did.js +136 -0
  20. package/declarations/observatory/index.d.ts +45 -0
  21. package/declarations/observatory/index.js +38 -0
  22. package/declarations/observatory/observatory.did.d.ts +86 -0
  23. package/declarations/observatory/observatory.factory.did.js +95 -0
  24. package/declarations/observatory/observatory.factory.did.mjs +95 -0
  25. package/declarations/orbiter/index.d.ts +45 -0
  26. package/declarations/orbiter/index.js +37 -0
  27. package/declarations/orbiter/orbiter.did.d.ts +103 -0
  28. package/declarations/orbiter/orbiter.factory.did.js +124 -0
  29. package/declarations/satellite/index.d.ts +45 -0
  30. package/declarations/satellite/index.js +37 -0
  31. package/declarations/satellite/satellite.did.d.ts +201 -0
  32. package/declarations/satellite/satellite.factory.did.js +215 -0
  33. package/declarations/satellite/satellite.factory.did.mjs +215 -0
  34. package/dist/browser/index.js +2 -0
  35. package/dist/browser/index.js.map +7 -0
  36. package/dist/declarations/cmc/cmc.did +122 -0
  37. package/dist/declarations/cmc/cmc.did.d.ts +48 -0
  38. package/dist/declarations/cmc/cmc.factory.did.js +67 -0
  39. package/dist/declarations/cmc/index.d.ts +45 -0
  40. package/dist/declarations/cmc/index.js +37 -0
  41. package/dist/declarations/console/console.did.d.ts +71 -0
  42. package/dist/declarations/console/console.factory.did.js +79 -0
  43. package/dist/declarations/console/console.factory.did.mjs +79 -0
  44. package/dist/declarations/console/index.d.ts +45 -0
  45. package/dist/declarations/console/index.js +37 -0
  46. package/dist/declarations/ic/ic.did +195 -0
  47. package/dist/declarations/ic/ic.did.d.ts +208 -0
  48. package/dist/declarations/ic/ic.factory.did.js +274 -0
  49. package/dist/declarations/mission_control/index.d.ts +45 -0
  50. package/dist/declarations/mission_control/index.js +38 -0
  51. package/dist/declarations/mission_control/mission_control.did.d.ts +101 -0
  52. package/dist/declarations/mission_control/mission_control.factory.did.js +136 -0
  53. package/dist/declarations/observatory/index.d.ts +45 -0
  54. package/dist/declarations/observatory/index.js +38 -0
  55. package/dist/declarations/observatory/observatory.did.d.ts +86 -0
  56. package/dist/declarations/observatory/observatory.factory.did.js +95 -0
  57. package/dist/declarations/observatory/observatory.factory.did.mjs +95 -0
  58. package/dist/declarations/orbiter/index.d.ts +45 -0
  59. package/dist/declarations/orbiter/index.js +37 -0
  60. package/dist/declarations/orbiter/orbiter.did.d.ts +103 -0
  61. package/dist/declarations/orbiter/orbiter.factory.did.js +124 -0
  62. package/dist/declarations/satellite/index.d.ts +45 -0
  63. package/dist/declarations/satellite/index.js +37 -0
  64. package/dist/declarations/satellite/satellite.did.d.ts +201 -0
  65. package/dist/declarations/satellite/satellite.factory.did.js +215 -0
  66. package/dist/declarations/satellite/satellite.factory.did.mjs +215 -0
  67. package/dist/index.js +1 -0
  68. package/dist/node/index.mjs +4 -0
  69. package/dist/node/index.mjs.map +7 -0
  70. package/dist/types/index.d.ts +5 -0
  71. package/dist/types/services/analytics.services.d.ts +10 -0
  72. package/dist/types/services/proxy.services.d.ts +4 -0
  73. package/dist/types/types/env.d.ts +15 -0
  74. package/dist/types/types/post-message.d.ts +11 -0
  75. package/dist/types/types/proxy.d.ts +11 -0
  76. package/dist/types/types/track.d.ts +4 -0
  77. package/dist/types/utils/date.utils.d.ts +1 -0
  78. package/dist/types/utils/json.utils.d.ts +8 -0
  79. package/dist/types/workers/analytics.worker.d.ts +1 -0
  80. package/dist/workers/analytics.worker.js +6 -0
  81. package/dist/workers/analytics.worker.js.map +7 -0
  82. package/package.json +49 -0
@@ -0,0 +1,208 @@
1
+ import type {ActorMethod} from '@dfinity/agent';
2
+ import type {Principal} from '@dfinity/principal';
3
+
4
+ export type bitcoin_address = string;
5
+ export type bitcoin_network = {mainnet: null} | {testnet: null};
6
+ export type block_hash = Uint8Array;
7
+ export type canister_id = Principal;
8
+ export interface canister_settings {
9
+ freezing_threshold: [] | [bigint];
10
+ controllers: [] | [Array<Principal>];
11
+ memory_allocation: [] | [bigint];
12
+ compute_allocation: [] | [bigint];
13
+ }
14
+ export interface change {
15
+ timestamp_nanos: bigint;
16
+ canister_version: bigint;
17
+ origin: change_origin;
18
+ details: change_details;
19
+ }
20
+ export type change_details =
21
+ | {
22
+ creation: {controllers: Array<Principal>};
23
+ }
24
+ | {
25
+ code_deployment: {
26
+ mode: {reinstall: null} | {upgrade: null} | {install: null};
27
+ module_hash: Uint8Array;
28
+ };
29
+ }
30
+ | {controllers_change: {controllers: Array<Principal>}}
31
+ | {code_uninstall: null};
32
+ export type change_origin =
33
+ | {from_user: {user_id: Principal}}
34
+ | {
35
+ from_canister: {
36
+ canister_version: [] | [bigint];
37
+ canister_id: Principal;
38
+ };
39
+ };
40
+ export interface definite_canister_settings {
41
+ freezing_threshold: bigint;
42
+ controllers: Array<Principal>;
43
+ memory_allocation: bigint;
44
+ compute_allocation: bigint;
45
+ }
46
+ export type ecdsa_curve = {secp256k1: null};
47
+ export interface get_balance_request {
48
+ network: bitcoin_network;
49
+ address: bitcoin_address;
50
+ min_confirmations: [] | [number];
51
+ }
52
+ export interface get_current_fee_percentiles_request {
53
+ network: bitcoin_network;
54
+ }
55
+ export interface get_utxos_request {
56
+ network: bitcoin_network;
57
+ filter: [] | [{page: Uint8Array} | {min_confirmations: number}];
58
+ address: bitcoin_address;
59
+ }
60
+ export interface get_utxos_response {
61
+ next_page: [] | [Uint8Array];
62
+ tip_height: number;
63
+ tip_block_hash: block_hash;
64
+ utxos: Array<utxo>;
65
+ }
66
+ export interface http_header {
67
+ value: string;
68
+ name: string;
69
+ }
70
+ export interface http_response {
71
+ status: bigint;
72
+ body: Uint8Array;
73
+ headers: Array<http_header>;
74
+ }
75
+ export type millisatoshi_per_byte = bigint;
76
+ export interface outpoint {
77
+ txid: Uint8Array;
78
+ vout: number;
79
+ }
80
+ export type satoshi = bigint;
81
+ export interface send_transaction_request {
82
+ transaction: Uint8Array;
83
+ network: bitcoin_network;
84
+ }
85
+ export interface utxo {
86
+ height: number;
87
+ value: satoshi;
88
+ outpoint: outpoint;
89
+ }
90
+ export type wasm_module = Uint8Array;
91
+ export interface _SERVICE {
92
+ bitcoin_get_balance: ActorMethod<[get_balance_request], satoshi>;
93
+ bitcoin_get_current_fee_percentiles: ActorMethod<
94
+ [get_current_fee_percentiles_request],
95
+ BigUint64Array
96
+ >;
97
+ bitcoin_get_utxos: ActorMethod<[get_utxos_request], get_utxos_response>;
98
+ bitcoin_send_transaction: ActorMethod<[send_transaction_request], undefined>;
99
+ canister_info: ActorMethod<
100
+ [{canister_id: canister_id; num_requested_changes: [] | [bigint]}],
101
+ {
102
+ controllers: Array<Principal>;
103
+ module_hash: [] | [Uint8Array];
104
+ recent_changes: Array<change>;
105
+ total_num_changes: bigint;
106
+ }
107
+ >;
108
+ canister_status: ActorMethod<
109
+ [{canister_id: canister_id}],
110
+ {
111
+ status: {stopped: null} | {stopping: null} | {running: null};
112
+ memory_size: bigint;
113
+ cycles: bigint;
114
+ settings: definite_canister_settings;
115
+ idle_cycles_burned_per_day: bigint;
116
+ module_hash: [] | [Uint8Array];
117
+ }
118
+ >;
119
+ create_canister: ActorMethod<
120
+ [
121
+ {
122
+ settings: [] | [canister_settings];
123
+ sender_canister_version: [] | [bigint];
124
+ }
125
+ ],
126
+ {canister_id: canister_id}
127
+ >;
128
+ delete_canister: ActorMethod<[{canister_id: canister_id}], undefined>;
129
+ deposit_cycles: ActorMethod<[{canister_id: canister_id}], undefined>;
130
+ ecdsa_public_key: ActorMethod<
131
+ [
132
+ {
133
+ key_id: {name: string; curve: ecdsa_curve};
134
+ canister_id: [] | [canister_id];
135
+ derivation_path: Array<Uint8Array>;
136
+ }
137
+ ],
138
+ {public_key: Uint8Array; chain_code: Uint8Array}
139
+ >;
140
+ http_request: ActorMethod<
141
+ [
142
+ {
143
+ url: string;
144
+ method: {get: null} | {head: null} | {post: null};
145
+ max_response_bytes: [] | [bigint];
146
+ body: [] | [Uint8Array];
147
+ transform: [] | [{function: [Principal, string]; context: Uint8Array}];
148
+ headers: Array<http_header>;
149
+ }
150
+ ],
151
+ http_response
152
+ >;
153
+ install_code: ActorMethod<
154
+ [
155
+ {
156
+ arg: Uint8Array;
157
+ wasm_module: wasm_module;
158
+ mode: {reinstall: null} | {upgrade: null} | {install: null};
159
+ canister_id: canister_id;
160
+ sender_canister_version: [] | [bigint];
161
+ }
162
+ ],
163
+ undefined
164
+ >;
165
+ provisional_create_canister_with_cycles: ActorMethod<
166
+ [
167
+ {
168
+ settings: [] | [canister_settings];
169
+ specified_id: [] | [canister_id];
170
+ amount: [] | [bigint];
171
+ }
172
+ ],
173
+ {canister_id: canister_id}
174
+ >;
175
+ provisional_top_up_canister: ActorMethod<[{canister_id: canister_id; amount: bigint}], undefined>;
176
+ raw_rand: ActorMethod<[], Uint8Array>;
177
+ sign_with_ecdsa: ActorMethod<
178
+ [
179
+ {
180
+ key_id: {name: string; curve: ecdsa_curve};
181
+ derivation_path: Array<Uint8Array>;
182
+ message_hash: Uint8Array;
183
+ }
184
+ ],
185
+ {signature: Uint8Array}
186
+ >;
187
+ start_canister: ActorMethod<[{canister_id: canister_id}], undefined>;
188
+ stop_canister: ActorMethod<[{canister_id: canister_id}], undefined>;
189
+ uninstall_code: ActorMethod<
190
+ [
191
+ {
192
+ canister_id: canister_id;
193
+ sender_canister_version: [] | [bigint];
194
+ }
195
+ ],
196
+ undefined
197
+ >;
198
+ update_settings: ActorMethod<
199
+ [
200
+ {
201
+ canister_id: Principal;
202
+ settings: canister_settings;
203
+ sender_canister_version: [] | [bigint];
204
+ }
205
+ ],
206
+ undefined
207
+ >;
208
+ }
@@ -0,0 +1,274 @@
1
+ // @ts-ignore
2
+ export const idlFactory = ({IDL}) => {
3
+ const bitcoin_network = IDL.Variant({
4
+ mainnet: IDL.Null,
5
+ testnet: IDL.Null
6
+ });
7
+ const bitcoin_address = IDL.Text;
8
+ const get_balance_request = IDL.Record({
9
+ network: bitcoin_network,
10
+ address: bitcoin_address,
11
+ min_confirmations: IDL.Opt(IDL.Nat32)
12
+ });
13
+ const satoshi = IDL.Nat64;
14
+ const get_current_fee_percentiles_request = IDL.Record({
15
+ network: bitcoin_network
16
+ });
17
+ const millisatoshi_per_byte = IDL.Nat64;
18
+ const get_utxos_request = IDL.Record({
19
+ network: bitcoin_network,
20
+ filter: IDL.Opt(
21
+ IDL.Variant({
22
+ page: IDL.Vec(IDL.Nat8),
23
+ min_confirmations: IDL.Nat32
24
+ })
25
+ ),
26
+ address: bitcoin_address
27
+ });
28
+ const block_hash = IDL.Vec(IDL.Nat8);
29
+ const outpoint = IDL.Record({
30
+ txid: IDL.Vec(IDL.Nat8),
31
+ vout: IDL.Nat32
32
+ });
33
+ const utxo = IDL.Record({
34
+ height: IDL.Nat32,
35
+ value: satoshi,
36
+ outpoint: outpoint
37
+ });
38
+ const get_utxos_response = IDL.Record({
39
+ next_page: IDL.Opt(IDL.Vec(IDL.Nat8)),
40
+ tip_height: IDL.Nat32,
41
+ tip_block_hash: block_hash,
42
+ utxos: IDL.Vec(utxo)
43
+ });
44
+ const send_transaction_request = IDL.Record({
45
+ transaction: IDL.Vec(IDL.Nat8),
46
+ network: bitcoin_network
47
+ });
48
+ const canister_id = IDL.Principal;
49
+ const change_origin = IDL.Variant({
50
+ from_user: IDL.Record({user_id: IDL.Principal}),
51
+ from_canister: IDL.Record({
52
+ canister_version: IDL.Opt(IDL.Nat64),
53
+ canister_id: IDL.Principal
54
+ })
55
+ });
56
+ const change_details = IDL.Variant({
57
+ creation: IDL.Record({controllers: IDL.Vec(IDL.Principal)}),
58
+ code_deployment: IDL.Record({
59
+ mode: IDL.Variant({
60
+ reinstall: IDL.Null,
61
+ upgrade: IDL.Null,
62
+ install: IDL.Null
63
+ }),
64
+ module_hash: IDL.Vec(IDL.Nat8)
65
+ }),
66
+ controllers_change: IDL.Record({
67
+ controllers: IDL.Vec(IDL.Principal)
68
+ }),
69
+ code_uninstall: IDL.Null
70
+ });
71
+ const change = IDL.Record({
72
+ timestamp_nanos: IDL.Nat64,
73
+ canister_version: IDL.Nat64,
74
+ origin: change_origin,
75
+ details: change_details
76
+ });
77
+ const definite_canister_settings = IDL.Record({
78
+ freezing_threshold: IDL.Nat,
79
+ controllers: IDL.Vec(IDL.Principal),
80
+ memory_allocation: IDL.Nat,
81
+ compute_allocation: IDL.Nat
82
+ });
83
+ const canister_settings = IDL.Record({
84
+ freezing_threshold: IDL.Opt(IDL.Nat),
85
+ controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
86
+ memory_allocation: IDL.Opt(IDL.Nat),
87
+ compute_allocation: IDL.Opt(IDL.Nat)
88
+ });
89
+ const ecdsa_curve = IDL.Variant({secp256k1: IDL.Null});
90
+ const http_header = IDL.Record({value: IDL.Text, name: IDL.Text});
91
+ const http_response = IDL.Record({
92
+ status: IDL.Nat,
93
+ body: IDL.Vec(IDL.Nat8),
94
+ headers: IDL.Vec(http_header)
95
+ });
96
+ const wasm_module = IDL.Vec(IDL.Nat8);
97
+ return IDL.Service({
98
+ bitcoin_get_balance: IDL.Func([get_balance_request], [satoshi], []),
99
+ bitcoin_get_current_fee_percentiles: IDL.Func(
100
+ [get_current_fee_percentiles_request],
101
+ [IDL.Vec(millisatoshi_per_byte)],
102
+ []
103
+ ),
104
+ bitcoin_get_utxos: IDL.Func([get_utxos_request], [get_utxos_response], []),
105
+ bitcoin_send_transaction: IDL.Func([send_transaction_request], [], []),
106
+ canister_info: IDL.Func(
107
+ [
108
+ IDL.Record({
109
+ canister_id: canister_id,
110
+ num_requested_changes: IDL.Opt(IDL.Nat64)
111
+ })
112
+ ],
113
+ [
114
+ IDL.Record({
115
+ controllers: IDL.Vec(IDL.Principal),
116
+ module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),
117
+ recent_changes: IDL.Vec(change),
118
+ total_num_changes: IDL.Nat64
119
+ })
120
+ ],
121
+ []
122
+ ),
123
+ canister_status: IDL.Func(
124
+ [IDL.Record({canister_id: canister_id})],
125
+ [
126
+ IDL.Record({
127
+ status: IDL.Variant({
128
+ stopped: IDL.Null,
129
+ stopping: IDL.Null,
130
+ running: IDL.Null
131
+ }),
132
+ memory_size: IDL.Nat,
133
+ cycles: IDL.Nat,
134
+ settings: definite_canister_settings,
135
+ idle_cycles_burned_per_day: IDL.Nat,
136
+ module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
137
+ })
138
+ ],
139
+ []
140
+ ),
141
+ create_canister: IDL.Func(
142
+ [
143
+ IDL.Record({
144
+ settings: IDL.Opt(canister_settings),
145
+ sender_canister_version: IDL.Opt(IDL.Nat64)
146
+ })
147
+ ],
148
+ [IDL.Record({canister_id: canister_id})],
149
+ []
150
+ ),
151
+ delete_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
152
+ deposit_cycles: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
153
+ ecdsa_public_key: IDL.Func(
154
+ [
155
+ IDL.Record({
156
+ key_id: IDL.Record({name: IDL.Text, curve: ecdsa_curve}),
157
+ canister_id: IDL.Opt(canister_id),
158
+ derivation_path: IDL.Vec(IDL.Vec(IDL.Nat8))
159
+ })
160
+ ],
161
+ [
162
+ IDL.Record({
163
+ public_key: IDL.Vec(IDL.Nat8),
164
+ chain_code: IDL.Vec(IDL.Nat8)
165
+ })
166
+ ],
167
+ []
168
+ ),
169
+ http_request: IDL.Func(
170
+ [
171
+ IDL.Record({
172
+ url: IDL.Text,
173
+ method: IDL.Variant({
174
+ get: IDL.Null,
175
+ head: IDL.Null,
176
+ post: IDL.Null
177
+ }),
178
+ max_response_bytes: IDL.Opt(IDL.Nat64),
179
+ body: IDL.Opt(IDL.Vec(IDL.Nat8)),
180
+ transform: IDL.Opt(
181
+ IDL.Record({
182
+ function: IDL.Func(
183
+ [
184
+ IDL.Record({
185
+ context: IDL.Vec(IDL.Nat8),
186
+ response: http_response
187
+ })
188
+ ],
189
+ [http_response],
190
+ ['query']
191
+ ),
192
+ context: IDL.Vec(IDL.Nat8)
193
+ })
194
+ ),
195
+ headers: IDL.Vec(http_header)
196
+ })
197
+ ],
198
+ [http_response],
199
+ []
200
+ ),
201
+ install_code: IDL.Func(
202
+ [
203
+ IDL.Record({
204
+ arg: IDL.Vec(IDL.Nat8),
205
+ wasm_module: wasm_module,
206
+ mode: IDL.Variant({
207
+ reinstall: IDL.Null,
208
+ upgrade: IDL.Null,
209
+ install: IDL.Null
210
+ }),
211
+ canister_id: canister_id,
212
+ sender_canister_version: IDL.Opt(IDL.Nat64)
213
+ })
214
+ ],
215
+ [],
216
+ []
217
+ ),
218
+ provisional_create_canister_with_cycles: IDL.Func(
219
+ [
220
+ IDL.Record({
221
+ settings: IDL.Opt(canister_settings),
222
+ specified_id: IDL.Opt(canister_id),
223
+ amount: IDL.Opt(IDL.Nat)
224
+ })
225
+ ],
226
+ [IDL.Record({canister_id: canister_id})],
227
+ []
228
+ ),
229
+ provisional_top_up_canister: IDL.Func(
230
+ [IDL.Record({canister_id: canister_id, amount: IDL.Nat})],
231
+ [],
232
+ []
233
+ ),
234
+ raw_rand: IDL.Func([], [IDL.Vec(IDL.Nat8)], []),
235
+ sign_with_ecdsa: IDL.Func(
236
+ [
237
+ IDL.Record({
238
+ key_id: IDL.Record({name: IDL.Text, curve: ecdsa_curve}),
239
+ derivation_path: IDL.Vec(IDL.Vec(IDL.Nat8)),
240
+ message_hash: IDL.Vec(IDL.Nat8)
241
+ })
242
+ ],
243
+ [IDL.Record({signature: IDL.Vec(IDL.Nat8)})],
244
+ []
245
+ ),
246
+ start_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
247
+ stop_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
248
+ uninstall_code: IDL.Func(
249
+ [
250
+ IDL.Record({
251
+ canister_id: canister_id,
252
+ sender_canister_version: IDL.Opt(IDL.Nat64)
253
+ })
254
+ ],
255
+ [],
256
+ []
257
+ ),
258
+ update_settings: IDL.Func(
259
+ [
260
+ IDL.Record({
261
+ canister_id: IDL.Principal,
262
+ settings: canister_settings,
263
+ sender_canister_version: IDL.Opt(IDL.Nat64)
264
+ })
265
+ ],
266
+ [],
267
+ []
268
+ )
269
+ });
270
+ };
271
+ // @ts-ignore
272
+ export const init = ({IDL}) => {
273
+ return [];
274
+ };
@@ -0,0 +1,45 @@
1
+ import type {ActorConfig, ActorSubclass, Agent, HttpAgentOptions} from '@dfinity/agent';
2
+ import type {IDL} from '@dfinity/candid';
3
+ import type {Principal} from '@dfinity/principal';
4
+
5
+ import {_SERVICE} from './mission_control.did';
6
+
7
+ export declare const idlFactory: IDL.InterfaceFactory;
8
+ export declare const canisterId: string;
9
+
10
+ export declare interface CreateActorOptions {
11
+ /**
12
+ * @see {@link Agent}
13
+ */
14
+ agent?: Agent;
15
+ /**
16
+ * @see {@link HttpAgentOptions}
17
+ */
18
+ agentOptions?: HttpAgentOptions;
19
+ /**
20
+ * @see {@link ActorConfig}
21
+ */
22
+ actorOptions?: ActorConfig;
23
+ }
24
+
25
+ /**
26
+ * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
27
+ * @constructs {@link ActorSubClass}
28
+ * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
29
+ * @param {CreateActorOptions} options - see {@link CreateActorOptions}
30
+ * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
31
+ * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
32
+ * @see {@link HttpAgentOptions}
33
+ * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
34
+ * @see {@link ActorConfig}
35
+ */
36
+ export declare const createActor: (
37
+ canisterId: string | Principal,
38
+ options?: CreateActorOptions
39
+ ) => ActorSubclass<_SERVICE>;
40
+
41
+ /**
42
+ * Intialized Actor using default settings, ready to talk to a canister using its candid interface
43
+ * @constructs {@link ActorSubClass}
44
+ */
45
+ export declare const mission_control: ActorSubclass<_SERVICE>;
@@ -0,0 +1,38 @@
1
+ import {Actor, HttpAgent} from '@dfinity/agent';
2
+
3
+ // Imports and re-exports candid interface
4
+ import {idlFactory} from './mission_control.did.js';
5
+ export {idlFactory} from './mission_control.did.js';
6
+
7
+ /* CANISTER_ID is replaced by webpack based on node environment
8
+ * Note: canister environment variable will be standardized as
9
+ * process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
10
+ * beginning in dfx 0.15.0
11
+ */
12
+ export const canisterId =
13
+ process.env.CANISTER_ID_MISSION_CONTROL || process.env.MISSION_CONTROL_CANISTER_ID;
14
+
15
+ export const createActor = (canisterId, options = {}) => {
16
+ const agent = options.agent || new HttpAgent({...options.agentOptions});
17
+
18
+ if (options.agent && options.agentOptions) {
19
+ console.warn(
20
+ 'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
21
+ );
22
+ }
23
+
24
+ // Fetch root key for certificate validation during development
25
+ if (process.env.DFX_NETWORK !== 'ic') {
26
+ agent.fetchRootKey().catch((err) => {
27
+ console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
28
+ console.error(err);
29
+ });
30
+ }
31
+
32
+ // Creates an actor with using the candid interface and the HttpAgent
33
+ return Actor.createActor(idlFactory, {
34
+ agent,
35
+ canisterId,
36
+ ...options.actorOptions
37
+ });
38
+ };
@@ -0,0 +1,101 @@
1
+ import type {ActorMethod} from '@dfinity/agent';
2
+ import type {Principal} from '@dfinity/principal';
3
+
4
+ export interface CanisterStatusResponse {
5
+ status: CanisterStatusType;
6
+ memory_size: bigint;
7
+ cycles: bigint;
8
+ settings: DefiniteCanisterSettings;
9
+ idle_cycles_burned_per_day: bigint;
10
+ module_hash: [] | [Uint8Array | number[]];
11
+ }
12
+ export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null};
13
+ export interface Controller {
14
+ updated_at: bigint;
15
+ metadata: Array<[string, string]>;
16
+ created_at: bigint;
17
+ scope: ControllerScope;
18
+ expires_at: [] | [bigint];
19
+ }
20
+ export type ControllerScope = {Write: null} | {Admin: null};
21
+ export interface CronJobStatusesConfig {
22
+ enabled: boolean;
23
+ cycles_threshold: [] | [bigint];
24
+ }
25
+ export interface DefiniteCanisterSettings {
26
+ freezing_threshold: bigint;
27
+ controllers: Array<Principal>;
28
+ memory_allocation: bigint;
29
+ compute_allocation: bigint;
30
+ }
31
+ export interface Orbiter {
32
+ updated_at: bigint;
33
+ orbiter_id: Principal;
34
+ metadata: Array<[string, string]>;
35
+ created_at: bigint;
36
+ }
37
+ export type Result = {Ok: SegmentStatus} | {Err: string};
38
+ export interface Satellite {
39
+ updated_at: bigint;
40
+ metadata: Array<[string, string]>;
41
+ created_at: bigint;
42
+ satellite_id: Principal;
43
+ }
44
+ export interface SegmentStatus {
45
+ id: Principal;
46
+ status: CanisterStatusResponse;
47
+ metadata: [] | [Array<[string, string]>];
48
+ status_at: bigint;
49
+ }
50
+ export interface SegmentsStatuses {
51
+ orbiters: [] | [Array<Result>];
52
+ satellites: [] | [Array<Result>];
53
+ mission_control: Result;
54
+ }
55
+ export interface SetController {
56
+ metadata: Array<[string, string]>;
57
+ scope: ControllerScope;
58
+ expires_at: [] | [bigint];
59
+ }
60
+ export interface StatusesArgs {
61
+ mission_control_cycles_threshold: [] | [bigint];
62
+ orbiters: Array<[Principal, CronJobStatusesConfig]>;
63
+ satellites: Array<[Principal, CronJobStatusesConfig]>;
64
+ cycles_threshold: [] | [bigint];
65
+ }
66
+ export interface Tokens {
67
+ e8s: bigint;
68
+ }
69
+ export interface _SERVICE {
70
+ add_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
71
+ add_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
72
+ create_orbiter: ActorMethod<[[] | [string]], Orbiter>;
73
+ create_satellite: ActorMethod<[string], Satellite>;
74
+ del_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
75
+ del_orbiters_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
76
+ del_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
77
+ get_user: ActorMethod<[], Principal>;
78
+ list_mission_control_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
79
+ list_mission_control_statuses: ActorMethod<[], Array<[bigint, Result]>>;
80
+ list_orbiter_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result]>]>;
81
+ list_orbiters: ActorMethod<[], Array<[Principal, Orbiter]>>;
82
+ list_satellite_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result]>]>;
83
+ list_satellites: ActorMethod<[], Array<[Principal, Satellite]>>;
84
+ remove_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
85
+ remove_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
86
+ set_metadata: ActorMethod<[Array<[string, string]>], undefined>;
87
+ set_mission_control_controllers: ActorMethod<[Array<Principal>, SetController], undefined>;
88
+ set_orbiter_metadata: ActorMethod<[Principal, Array<[string, string]>], Orbiter>;
89
+ set_orbiters_controllers: ActorMethod<
90
+ [Array<Principal>, Array<Principal>, SetController],
91
+ undefined
92
+ >;
93
+ set_satellite_metadata: ActorMethod<[Principal, Array<[string, string]>], Satellite>;
94
+ set_satellites_controllers: ActorMethod<
95
+ [Array<Principal>, Array<Principal>, SetController],
96
+ undefined
97
+ >;
98
+ status: ActorMethod<[StatusesArgs], SegmentsStatuses>;
99
+ top_up: ActorMethod<[Principal, Tokens], undefined>;
100
+ version: ActorMethod<[], string>;
101
+ }