-
Notifications
You must be signed in to change notification settings - Fork 0
/
ic.did
executable file
·151 lines (130 loc) · 3.89 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
type canister_id = principal;
type user_id = principal;
type wasm_module = blob;
type owner_id = user_id;
type users = vec principal;
type owners = vec owner_id;
type canister_settings = record {
controllers : opt vec principal;
compute_allocation : opt nat;
memory_allocation : opt nat;
freezing_threshold : opt nat;
};
type definite_canister_settings = record {
controllers : vec principal;
compute_allocation : nat;
memory_allocation : nat;
freezing_threshold : nat;
};
type http_header = record { name: text; value: text };
type http_response = record {
status: nat;
headers: vec http_header;
body: blob;
};
type ecdsa_curve = variant { secp256k1; };
type satoshi = nat64;
type bitcoin_network = variant {
mainnet;
testnet;
};
type bitcoin_address = text;
type block_hash = blob;
type outpoint = record {
txid : blob;
vout : nat32
};
type utxo = record {
outpoint: outpoint;
value: satoshi;
height: nat32;
};
type get_utxos_request = record {
address : bitcoin_address;
network: bitcoin_network;
filter: opt variant {
min_confirmations: nat32;
page: blob;
};
};
type get_current_fee_percentiles_request = record {
network: bitcoin_network;
};
type get_utxos_response = record {
utxos: vec utxo;
tip_block_hash: block_hash;
tip_height: nat32;
next_page: opt blob;
};
type get_balance_request = record {
address : bitcoin_address;
network: bitcoin_network;
min_confirmations: opt nat32;
};
type send_transaction_request = record {
transaction: blob;
network: bitcoin_network;
};
type millisatoshi_per_byte = nat64;
service ic : {
create_canister : (record {
settings : opt canister_settings
}) -> (record {canister_id : canister_id});
update_settings : (record {
canister_id : principal;
settings : canister_settings
}) -> ();
install_code : (record {
mode : variant {install; reinstall; upgrade};
canister_id : canister_id;
wasm_module : wasm_module;
arg : blob;
}) -> ();
uninstall_code : (record {canister_id : canister_id}) -> ();
start_canister : (record {canister_id : canister_id}) -> ();
stop_canister : (record {canister_id : canister_id}) -> ();
canister_status : (record {canister_id : canister_id}) -> (record {
status : variant { running; stopping; stopped };
settings: definite_canister_settings;
module_hash: opt blob;
memory_size: nat;
cycles: nat;
idle_cycles_burned_per_day: nat;
});
delete_canister : (record {canister_id : canister_id}) -> ();
deposit_cycles : (record {canister_id : canister_id}) -> ();
raw_rand : () -> (blob);
http_request : (record {
url : text;
max_response_bytes: opt nat;
method : variant { get; head; post };
headers: vec http_header;
body : opt blob;
transform : opt variant {
function: func (http_response) -> (http_response) query
};
}) -> (http_response);
// Threshold ECDSA signature
ecdsa_public_key : (record {
canister_id : opt canister_id;
derivation_path : vec blob;
key_id : record { curve: ecdsa_curve; name: text };
}) -> (record { public_key : blob; chain_code : blob; });
sign_with_ecdsa : (record {
message_hash : blob;
derivation_path : vec blob;
key_id : record { curve: ecdsa_curve; name: text };
}) -> (record { signature : blob });
// bitcoin interface
bitcoin_get_balance: (get_balance_request) -> (satoshi);
bitcoin_get_utxos: (get_utxos_request) -> (get_utxos_response);
bitcoin_send_transaction: (send_transaction_request) -> ();
bitcoin_get_current_fee_percentiles: (get_current_fee_percentiles_request) -> (vec millisatoshi_per_byte);
// provisional interfaces for the pre-ledger world
provisional_create_canister_with_cycles : (record {
amount: opt nat;
settings : opt canister_settings
}) -> (record {canister_id : canister_id});
provisional_top_up_canister :
(record { canister_id: canister_id; amount: nat }) -> ();
}