-
Notifications
You must be signed in to change notification settings - Fork 43
/
env.ts
267 lines (259 loc) · 8.33 KB
/
env.ts
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
export namespace env {
// #############
// # Registers #
// #############
//@ts-ignore
@inline
export function read_register(register_id: u64, ptr: u64): void {
_read_register(register_id, ptr)
}
//@ts-ignore
@inline
export function register_len(register_id: u64) : u64 {
return _register_len(register_id)
}
// ###############
// # Context API #
// ###############
//@ts-ignore
@inline
export function current_account_id(register_id: u64) : void {
_current_account_id(register_id)
}
//@ts-ignore
@inline
export function signer_account_id(register_id: u64) : void {
_signer_account_id(register_id)
}
//@ts-ignore
@inline
export function signer_account_pk(register_id: u64) : void {
_signer_account_pk(register_id)
}
//@ts-ignore
@inline
export function predecessor_account_id(register_id: u64) : void {
_predecessor_account_id(register_id)
}
//@ts-ignore
@inline
export function input(register_id: u64) : void {
_input(register_id)
}
//@ts-ignore
@inline
export function block_index() : u64 {
return _block_index()
}
//@ts-ignore
@inline
export function block_timestamp() : u64 {
return _block_timestamp()
}
//@ts-ignore
@inline
export function epoch_height() : u64 {
return _epoch_height()
}
//@ts-ignore
@inline
export function storage_usage() : u64 {
return _storage_usage()
}
// #################
// # Economics API #
// #################
//@ts-ignore
@inline
export function account_balance(balance_ptr: u64) : void {
_account_balance(balance_ptr)
}
//@ts-ignore
@inline
export function account_locked_balance(balance_ptr: u64) : void {
_account_locked_balance(balance_ptr)
}
//@ts-ignore
@inline
export function attached_deposit(balance_ptr: u64) : void {
_attached_deposit(balance_ptr)
}
//@ts-ignore
@inline
export function prepaid_gas() : u64 {
return _prepaid_gas()
}
//@ts-ignore
@inline
export function used_gas() : u64 {
return _used_gas()
}
// ############
// # Math API #
// ############
//@ts-ignore
@inline
export function random_seed(register_id: u64): void {
_random_seed(register_id)
}
//@ts-ignore
@inline
export function sha256(value_len: u64, value_ptr: u64, register_id: u64) : void {
_sha256(value_len, value_ptr, register_id)
}
//@ts-ignore
@inline
export function keccak256(value_len: u64, value_ptr: u64, register_id: u64) : void {
_keccak256(value_len, value_ptr, register_id)
}
//@ts-ignore
@inline
export function keccak512(value_len: u64, value_ptr: u64, register_id: u64) : void {
_keccak512(value_len, value_ptr, register_id)
}
// #####################
// # Miscellaneous API #
// #####################
//@ts-ignore
@inline
export function value_return(value_len: u64, value_ptr: u64) : void {
_value_return(value_len, value_ptr)
}
//@ts-ignore
@inline
export function panic() : void {
_panic()
}
//@ts-ignore
@inline
export function panic_utf8(len: u64, ptr: u64) : void {
_panic_utf8(len, ptr)
}
//@ts-ignore
@inline
export function log_utf8(len: u64, ptr: u64) : void {
_log_utf8(len, ptr)
}
//@ts-ignore
@inline
export function log_utf16(len: u64, ptr: u64) : void {
_log_utf16(len, ptr)
}
// ################
// # Promises API #
// ################
//@ts-ignore
@inline
export function promise_create(account_id_len: u64,account_id_ptr: u64,method_name_len: u64,method_name_ptr: u64,arguments_len: u64, arguments_ptr: u64, amount_ptr: u64, gas: u64) : u64 {
return _promise_create(account_id_len,account_id_ptr,method_name_len,method_name_ptr,arguments_len, arguments_ptr, amount_ptr, gas)
}
//@ts-ignore
@inline
export function promise_then( promise_index: u64, account_id_len: u64, account_id_ptr: u64, method_name_len: u64, method_name_ptr: u64, arguments_len: u64, arguments_ptr: u64, amount_ptr: u64, gas: u64) : u64 {
return _promise_then( promise_index, account_id_len, account_id_ptr, method_name_len, method_name_ptr, arguments_len, arguments_ptr, amount_ptr, gas)
}
//@ts-ignore
@inline
export function promise_and(promise_idx_ptr: u64, promise_idx_count: u64) : u64 {
return _promise_and(promise_idx_ptr, promise_idx_count)
}
//@ts-ignore
@inline
export function promise_batch_create(account_id_len: u64, account_id_ptr: u64): u64 {
return _promise_batch_create(account_id_len, account_id_ptr)
}
//@ts-ignore
@inline
export function promise_batch_then(promise_index: u64, account_id_len: u64, account_id_ptr: u64): u64 {
return _promise_batch_then(promise_index, account_id_len, account_id_ptr)
}
// #######################
// # Promise API actions #
// #######################
//@ts-ignore
@inline
export function promise_batch_action_create_account(promise_index: u64): void {
_promise_batch_action_create_account(promise_index)
}
//@ts-ignore
@inline
export function promise_batch_action_deploy_contract(promise_index: u64, code_len: u64, code_ptr: u64): void {
_promise_batch_action_deploy_contract(promise_index, code_len, code_ptr)
}
//@ts-ignore
@inline
export function promise_batch_action_function_call(promise_index: u64, method_name_len: u64, method_name_ptr: u64, arguments_len: u64, arguments_ptr: u64, amount_ptr: u64, gas: u64): void {
_promise_batch_action_function_call(promise_index, method_name_len, method_name_ptr, arguments_len, arguments_ptr, amount_ptr, gas)
}
//@ts-ignore
@inline
export function promise_batch_action_transfer(promise_index: u64, amount_ptr: u64): void {
_promise_batch_action_transfer(promise_index, amount_ptr)
}
//@ts-ignore
@inline
export function promise_batch_action_stake(promise_index: u64, amount_ptr: u64, public_key_len: u64, public_key_ptr: u64): void {
_promise_batch_action_stake(promise_index, amount_ptr, public_key_len, public_key_ptr)
}
//@ts-ignore
@inline
export function promise_batch_action_add_key_with_full_access(promise_index: u64, public_key_len: u64, public_key_ptr: u64, nonce: u64): void {
_promise_batch_action_add_key_with_full_access(promise_index, public_key_len, public_key_ptr, nonce)
}
//@ts-ignore
@inline
export function promise_batch_action_add_key_with_function_call(promise_index: u64, public_key_len: u64, public_key_ptr: u64, nonce: u64, allowance_ptr: u64, receiver_id_len: u64, receiver_id_ptr: u64, method_names_len: u64, method_names_ptr: u64): void {
_promise_batch_action_add_key_with_function_call(promise_index, public_key_len, public_key_ptr, nonce, allowance_ptr, receiver_id_len, receiver_id_ptr, method_names_len, method_names_ptr)
}
//@ts-ignore
@inline
export function promise_batch_action_delete_key(promise_index: u64, public_key_len: u64, public_key_ptr: u64): void {
_promise_batch_action_delete_key(promise_index, public_key_len, public_key_ptr)
}
//@ts-ignore
@inline
export function promise_batch_action_delete_account(promise_index: u64, beneficiary_id_len: u64, beneficiary_id_ptr: u64): void {
_promise_batch_action_delete_account(promise_index, beneficiary_id_len, beneficiary_id_ptr);
}
// #######################
// # Promise API results #
// #######################
//@ts-ignore
@inline
export function promise_results_count() : u64 {
return _promise_results_count()
}
//@ts-ignore
@inline
export function promise_result(result_idx: u64, register_id: u64) : u64 {
return _promise_result(result_idx, register_id);
}
//@ts-ignore
@inline
export function promise_return(promise_id: u64) : void {
_promise_return(promise_id)
}
// ###############
// # Storage API #
// ###############
//@ts-ignore
@inline
export function storage_write(key_len: u64, key_ptr: u64, value_len: u64, value_ptr: u64, register_id: u64) : u64 {
return _storage_write(key_len, key_ptr, value_len, value_ptr, register_id)
}
//@ts-ignore
@inline
export function storage_read(key_len: u64, key_ptr: u64, register_id: u64) : u64 {
return _storage_read(key_len, key_ptr, register_id)
}
//@ts-ignore
@inline
export function storage_remove(key_len: u64, key_ptr: u64, register_id: u64) : u64 {
return _storage_remove(key_len, key_ptr, register_id)
}
//@ts-ignore
@inline
export function storage_has_key(key_len: u64, key_ptr: u64) : u64 {
return _storage_has_key(key_len, key_ptr)
}
}