-
Notifications
You must be signed in to change notification settings - Fork 21
/
ic.did
460 lines (377 loc) · 11.5 KB
/
ic.did
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
type canister_id = principal;
type wasm_module = blob;
type snapshot_id = blob;
type log_visibility = variant {
controllers;
public;
allowed_viewers : vec principal;
};
type canister_settings = record {
controllers : opt vec principal;
compute_allocation : opt nat;
memory_allocation : opt nat;
freezing_threshold : opt nat;
reserved_cycles_limit : opt nat;
log_visibility : opt log_visibility;
wasm_memory_limit : opt nat;
};
type definite_canister_settings = record {
controllers : vec principal;
compute_allocation : nat;
memory_allocation : nat;
freezing_threshold : nat;
reserved_cycles_limit : nat;
log_visibility : log_visibility;
wasm_memory_limit : nat;
};
type change_origin = variant {
from_user : record {
user_id : principal;
};
from_canister : record {
canister_id : principal;
canister_version : opt nat64;
};
};
type change_details = variant {
creation : record {
controllers : vec principal;
};
code_uninstall;
code_deployment : record {
mode : variant { install; reinstall; upgrade };
module_hash : blob;
};
load_snapshot : record {
canister_version : nat64;
snapshot_id : snapshot_id;
taken_at_timestamp : nat64;
};
controllers_change : record {
controllers : vec principal;
};
};
type change = record {
timestamp_nanos : nat64;
canister_version : nat64;
origin : change_origin;
details : change_details;
};
type chunk_hash = record {
hash : blob;
};
type http_header = record {
name : text;
value : text;
};
type http_request_result = record {
status : nat;
headers : vec http_header;
body : blob;
};
type ecdsa_curve = variant {
secp256k1;
};
type schnorr_algorithm = variant {
bip340secp256k1;
ed25519;
};
type satoshi = nat64;
type bitcoin_network = variant {
mainnet;
testnet;
};
type bitcoin_address = text;
type bitcoin_block_hash = blob;
type bitcoin_block_header = blob;
type millisatoshi_per_byte = nat64;
type bitcoin_block_height = nat32;
type outpoint = record {
txid : blob;
vout : nat32;
};
type utxo = record {
outpoint : outpoint;
value : satoshi;
height : nat32;
};
type bitcoin_get_utxos_args = record {
address : bitcoin_address;
network : bitcoin_network;
filter : opt variant {
min_confirmations : nat32;
page : blob;
};
};
type bitcoin_get_utxos_result = record {
utxos : vec utxo;
tip_block_hash : bitcoin_block_hash;
tip_height : bitcoin_block_height;
next_page : opt blob;
};
type bitcoin_get_balance_args = record {
address : bitcoin_address;
network : bitcoin_network;
min_confirmations : opt nat32;
};
type bitcoin_get_balance_result = satoshi;
type bitcoin_get_current_fee_percentiles_args = record {
network : bitcoin_network;
};
type bitcoin_get_current_fee_percentiles_result = vec millisatoshi_per_byte;
type bitcoin_send_transaction_args = record {
transaction : blob;
network : bitcoin_network;
};
type bitcoin_get_block_headers_args = record {
start_height : bitcoin_block_height;
end_height : opt bitcoin_block_height;
network: bitcoin_network;
};
type bitcoin_get_block_headers_result = record {
tip_height : bitcoin_block_height;
block_headers : vec bitcoin_block_header;
};
type node_metrics = record {
node_id : principal;
num_blocks_proposed_total : nat64;
num_block_failures_total : nat64;
};
type create_canister_args = record {
settings : opt canister_settings;
sender_canister_version : opt nat64;
};
type create_canister_result = record {
canister_id : canister_id;
};
type update_settings_args = record {
canister_id : principal;
settings : canister_settings;
sender_canister_version : opt nat64;
};
type upload_chunk_args = record {
canister_id : principal;
chunk : blob;
};
type clear_chunk_store_args = record {
canister_id : canister_id;
};
type stored_chunks_args = record {
canister_id : canister_id;
};
type canister_install_mode = variant {
install;
reinstall;
upgrade : opt record {
skip_pre_upgrade : opt bool;
wasm_memory_persistence : opt variant {
keep;
replace;
};
};
};
type install_code_args = record {
mode : canister_install_mode;
canister_id : canister_id;
wasm_module : wasm_module;
arg : blob;
sender_canister_version : opt nat64;
};
type install_chunked_code_args = record {
mode : canister_install_mode;
target_canister : canister_id;
store_canister : opt canister_id;
chunk_hashes_list : vec chunk_hash;
wasm_module_hash : blob;
arg : blob;
sender_canister_version : opt nat64;
};
type uninstall_code_args = record {
canister_id : canister_id;
sender_canister_version : opt nat64;
};
type start_canister_args = record {
canister_id : canister_id;
};
type stop_canister_args = record {
canister_id : canister_id;
};
type canister_status_args = record {
canister_id : canister_id;
};
type canister_status_result = record {
status : variant { running; stopping; stopped };
settings : definite_canister_settings;
module_hash : opt blob;
memory_size : nat;
cycles : nat;
reserved_cycles : nat;
idle_cycles_burned_per_day : nat;
query_stats: record {
num_calls_total: nat;
num_instructions_total: nat;
request_payload_bytes_total: nat;
response_payload_bytes_total: nat;
};
};
type canister_info_args = record {
canister_id : canister_id;
num_requested_changes : opt nat64;
};
type canister_info_result = record {
total_num_changes : nat64;
recent_changes : vec change;
module_hash : opt blob;
controllers : vec principal;
};
type delete_canister_args = record {
canister_id : canister_id;
};
type deposit_cycles_args = record {
canister_id : canister_id;
};
type http_request_args = record {
url : text;
max_response_bytes : opt nat64;
method : variant { get; head; post };
headers : vec http_header;
body : opt blob;
transform : opt record {
function : func(record { response : http_request_result; context : blob }) -> (http_request_result) query;
context : blob;
};
};
type ecdsa_public_key_args = record {
canister_id : opt canister_id;
derivation_path : vec blob;
key_id : record { curve : ecdsa_curve; name : text };
};
type ecdsa_public_key_result = record {
public_key : blob;
chain_code : blob;
};
type sign_with_ecdsa_args = record {
message_hash : blob;
derivation_path : vec blob;
key_id : record { curve : ecdsa_curve; name : text };
};
type sign_with_ecdsa_result = record {
signature : blob;
};
type schnorr_public_key_args = record {
canister_id : opt canister_id;
derivation_path : vec blob;
key_id : record { algorithm : schnorr_algorithm; name : text };
};
type schnorr_public_key_result = record {
public_key : blob;
chain_code : blob;
};
type sign_with_schnorr_args = record {
message : blob;
derivation_path : vec blob;
key_id : record { algorithm : schnorr_algorithm; name : text };
};
type sign_with_schnorr_result = record {
signature : blob;
};
type node_metrics_history_args = record {
subnet_id : principal;
start_at_timestamp_nanos : nat64;
};
type node_metrics_history_result = vec record {
timestamp_nanos : nat64;
node_metrics : vec node_metrics;
};
type provisional_create_canister_with_cycles_args = record {
amount : opt nat;
settings : opt canister_settings;
specified_id : opt canister_id;
sender_canister_version : opt nat64;
};
type provisional_create_canister_with_cycles_result = record {
canister_id : canister_id;
};
type provisional_top_up_canister_args = record {
canister_id : canister_id;
amount : nat;
};
type raw_rand_result = blob;
type stored_chunks_result = vec chunk_hash;
type upload_chunk_result = chunk_hash;
type snapshot = record {
id : snapshot_id;
taken_at_timestamp : nat64;
total_size : nat64;
};
type take_canister_snapshot_args = record {
canister_id : canister_id;
replace_snapshot : opt snapshot_id;
};
type take_canister_snapshot_result = snapshot;
type load_canister_snapshot_args = record {
canister_id : canister_id;
snapshot_id : snapshot_id;
sender_canister_version : opt nat64;
};
type list_canister_snapshots_args = record {
canister_id : canister_id;
};
type list_canister_snapshots_result = vec snapshot;
type delete_canister_snapshot_args = record {
canister_id : canister_id;
snapshot_id : snapshot_id;
};
type fetch_canister_logs_args = record {
canister_id : canister_id;
};
type canister_log_record = record {
idx: nat64;
timestamp_nanos: nat64;
content: blob;
};
type fetch_canister_logs_result = record {
canister_log_records: vec canister_log_record;
};
service ic : {
create_canister : (create_canister_args) -> (create_canister_result);
update_settings : (update_settings_args) -> ();
upload_chunk : (upload_chunk_args) -> (upload_chunk_result);
clear_chunk_store : (clear_chunk_store_args) -> ();
stored_chunks : (stored_chunks_args) -> (stored_chunks_result);
install_code : (install_code_args) -> ();
install_chunked_code : (install_chunked_code_args) -> ();
uninstall_code : (uninstall_code_args) -> ();
start_canister : (start_canister_args) -> ();
stop_canister : (stop_canister_args) -> ();
canister_status : (canister_status_args) -> (canister_status_result);
canister_info : (canister_info_args) -> (canister_info_result);
delete_canister : (delete_canister_args) -> ();
deposit_cycles : (deposit_cycles_args) -> ();
raw_rand : () -> (raw_rand_result);
http_request : (http_request_args) -> (http_request_result);
// Threshold ECDSA signature
ecdsa_public_key : (ecdsa_public_key_args) -> (ecdsa_public_key_result);
sign_with_ecdsa : (sign_with_ecdsa_args) -> (sign_with_ecdsa_result);
// Threshold Schnorr signature
schnorr_public_key : (schnorr_public_key_args) -> (schnorr_public_key_result);
sign_with_schnorr : (sign_with_schnorr_args) -> (sign_with_schnorr_result);
// bitcoin interface
bitcoin_get_balance : (bitcoin_get_balance_args) -> (bitcoin_get_balance_result);
bitcoin_get_utxos : (bitcoin_get_utxos_args) -> (bitcoin_get_utxos_result);
bitcoin_send_transaction : (bitcoin_send_transaction_args) -> ();
bitcoin_get_current_fee_percentiles : (bitcoin_get_current_fee_percentiles_args) -> (bitcoin_get_current_fee_percentiles_result);
bitcoin_get_block_headers : (bitcoin_get_block_headers_args) -> (bitcoin_get_block_headers_result);
// metrics interface
node_metrics_history : (node_metrics_history_args) -> (node_metrics_history_result);
// provisional interfaces for the pre-ledger world
provisional_create_canister_with_cycles : (provisional_create_canister_with_cycles_args) -> (provisional_create_canister_with_cycles_result);
provisional_top_up_canister : (provisional_top_up_canister_args) -> ();
// Canister snapshots
take_canister_snapshot : (take_canister_snapshot_args) -> (take_canister_snapshot_result);
load_canister_snapshot : (load_canister_snapshot_args) -> ();
list_canister_snapshots : (list_canister_snapshots_args) -> (list_canister_snapshots_result);
delete_canister_snapshot : (delete_canister_snapshot_args) -> ();
// canister logging
fetch_canister_logs : (fetch_canister_logs_args) -> (fetch_canister_logs_result) query;
};