@quantovainc/qcore 0.1.3
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +131 -0
- package/browser.mjs +9 -0
- package/index.d.ts +174 -0
- package/index.js +9 -0
- package/package.json +76 -0
- package/pkg/package.json +25 -0
- package/pkg/qcore_js.d.ts +56 -0
- package/pkg/qcore_js.js +9 -0
- package/pkg/qcore_js_bg.js +708 -0
- package/pkg/qcore_js_bg.wasm +0 -0
- package/pkg/qcore_js_bg.wasm.d.ts +36 -0
- package/pkg-node/package.json +19 -0
- package/pkg-node/qcore_js.d.ts +56 -0
- package/pkg-node/qcore_js.js +740 -0
- package/pkg-node/qcore_js_bg.wasm +0 -0
- package/shared.js +323 -0
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} address
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function account_body(address) {
|
|
6
|
+
let deferred2_0;
|
|
7
|
+
let deferred2_1;
|
|
8
|
+
try {
|
|
9
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
10
|
+
const len0 = WASM_VECTOR_LEN;
|
|
11
|
+
const ret = wasm.account_body(ptr0, len0);
|
|
12
|
+
deferred2_0 = ret[0];
|
|
13
|
+
deferred2_1 = ret[1];
|
|
14
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
15
|
+
} finally {
|
|
16
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} seed_hex
|
|
22
|
+
* @param {bigint} index
|
|
23
|
+
* @returns {string}
|
|
24
|
+
*/
|
|
25
|
+
export function address(seed_hex, index) {
|
|
26
|
+
let deferred3_0;
|
|
27
|
+
let deferred3_1;
|
|
28
|
+
try {
|
|
29
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
30
|
+
const len0 = WASM_VECTOR_LEN;
|
|
31
|
+
const ret = wasm.address(ptr0, len0, index);
|
|
32
|
+
var ptr2 = ret[0];
|
|
33
|
+
var len2 = ret[1];
|
|
34
|
+
if (ret[3]) {
|
|
35
|
+
ptr2 = 0; len2 = 0;
|
|
36
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
37
|
+
}
|
|
38
|
+
deferred3_0 = ptr2;
|
|
39
|
+
deferred3_1 = len2;
|
|
40
|
+
return getStringFromWasm0(ptr2, len2);
|
|
41
|
+
} finally {
|
|
42
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {bigint} height
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
export function block_by_height_body(height) {
|
|
51
|
+
let deferred1_0;
|
|
52
|
+
let deferred1_1;
|
|
53
|
+
try {
|
|
54
|
+
const ret = wasm.block_by_height_body(height);
|
|
55
|
+
deferred1_0 = ret[0];
|
|
56
|
+
deferred1_1 = ret[1];
|
|
57
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
58
|
+
} finally {
|
|
59
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} contract
|
|
65
|
+
* @param {string} selector_hex
|
|
66
|
+
* @param {bigint} scheme_off
|
|
67
|
+
* @param {bigint} ptr_off
|
|
68
|
+
* @param {string} field_offs_csv
|
|
69
|
+
* @param {string} fields_csv
|
|
70
|
+
* @param {bigint} region_off
|
|
71
|
+
* @param {string} owner_seed_hex
|
|
72
|
+
* @param {bigint} owner_index
|
|
73
|
+
* @param {bigint} nonce
|
|
74
|
+
* @returns {string}
|
|
75
|
+
*/
|
|
76
|
+
export function buildSignedOrderCall(contract, selector_hex, scheme_off, ptr_off, field_offs_csv, fields_csv, region_off, owner_seed_hex, owner_index, nonce) {
|
|
77
|
+
let deferred7_0;
|
|
78
|
+
let deferred7_1;
|
|
79
|
+
try {
|
|
80
|
+
const ptr0 = passStringToWasm0(contract, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
81
|
+
const len0 = WASM_VECTOR_LEN;
|
|
82
|
+
const ptr1 = passStringToWasm0(selector_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
83
|
+
const len1 = WASM_VECTOR_LEN;
|
|
84
|
+
const ptr2 = passStringToWasm0(field_offs_csv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
85
|
+
const len2 = WASM_VECTOR_LEN;
|
|
86
|
+
const ptr3 = passStringToWasm0(fields_csv, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
87
|
+
const len3 = WASM_VECTOR_LEN;
|
|
88
|
+
const ptr4 = passStringToWasm0(owner_seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
89
|
+
const len4 = WASM_VECTOR_LEN;
|
|
90
|
+
const ret = wasm.buildSignedOrderCall(ptr0, len0, ptr1, len1, scheme_off, ptr_off, ptr2, len2, ptr3, len3, region_off, ptr4, len4, owner_index, nonce);
|
|
91
|
+
var ptr6 = ret[0];
|
|
92
|
+
var len6 = ret[1];
|
|
93
|
+
if (ret[3]) {
|
|
94
|
+
ptr6 = 0; len6 = 0;
|
|
95
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
96
|
+
}
|
|
97
|
+
deferred7_0 = ptr6;
|
|
98
|
+
deferred7_1 = len6;
|
|
99
|
+
return getStringFromWasm0(ptr6, len6);
|
|
100
|
+
} finally {
|
|
101
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {string} name
|
|
107
|
+
* @returns {bigint}
|
|
108
|
+
*/
|
|
109
|
+
export function chainIdFromName(name) {
|
|
110
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
112
|
+
const ret = wasm.chainIdFromName(ptr0, len0);
|
|
113
|
+
return BigInt.asUintN(64, ret);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @param {string} deployer
|
|
118
|
+
* @param {bigint} nonce
|
|
119
|
+
* @returns {string | undefined}
|
|
120
|
+
*/
|
|
121
|
+
export function contractAddress(deployer, nonce) {
|
|
122
|
+
const ptr0 = passStringToWasm0(deployer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
123
|
+
const len0 = WASM_VECTOR_LEN;
|
|
124
|
+
const ret = wasm.contractAddress(ptr0, len0, nonce);
|
|
125
|
+
let v2;
|
|
126
|
+
if (ret[0] !== 0) {
|
|
127
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
128
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
129
|
+
}
|
|
130
|
+
return v2;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param {bigint} height
|
|
135
|
+
* @returns {string}
|
|
136
|
+
*/
|
|
137
|
+
export function eventsBody(height) {
|
|
138
|
+
let deferred1_0;
|
|
139
|
+
let deferred1_1;
|
|
140
|
+
try {
|
|
141
|
+
const ret = wasm.eventsBody(height);
|
|
142
|
+
deferred1_0 = ret[0];
|
|
143
|
+
deferred1_1 = ret[1];
|
|
144
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
145
|
+
} finally {
|
|
146
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @returns {bigint}
|
|
152
|
+
*/
|
|
153
|
+
export function localChainId() {
|
|
154
|
+
const ret = wasm.localChainId();
|
|
155
|
+
return BigInt.asUintN(64, ret);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @returns {bigint}
|
|
160
|
+
*/
|
|
161
|
+
export function mainnetChainId() {
|
|
162
|
+
const ret = wasm.mainnetChainId();
|
|
163
|
+
return BigInt.asUintN(64, ret);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {bigint} map_domain_tag
|
|
168
|
+
* @param {string} key_address_hex
|
|
169
|
+
* @returns {string}
|
|
170
|
+
*/
|
|
171
|
+
export function mapSlotKey(map_domain_tag, key_address_hex) {
|
|
172
|
+
let deferred3_0;
|
|
173
|
+
let deferred3_1;
|
|
174
|
+
try {
|
|
175
|
+
const ptr0 = passStringToWasm0(key_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
176
|
+
const len0 = WASM_VECTOR_LEN;
|
|
177
|
+
const ret = wasm.mapSlotKey(map_domain_tag, ptr0, len0);
|
|
178
|
+
var ptr2 = ret[0];
|
|
179
|
+
var len2 = ret[1];
|
|
180
|
+
if (ret[3]) {
|
|
181
|
+
ptr2 = 0; len2 = 0;
|
|
182
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
183
|
+
}
|
|
184
|
+
deferred3_0 = ptr2;
|
|
185
|
+
deferred3_1 = len2;
|
|
186
|
+
return getStringFromWasm0(ptr2, len2);
|
|
187
|
+
} finally {
|
|
188
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @param {string} seed_hex
|
|
194
|
+
* @returns {string}
|
|
195
|
+
*/
|
|
196
|
+
export function mnemonicFromSeed(seed_hex) {
|
|
197
|
+
let deferred3_0;
|
|
198
|
+
let deferred3_1;
|
|
199
|
+
try {
|
|
200
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
|
+
const len0 = WASM_VECTOR_LEN;
|
|
202
|
+
const ret = wasm.mnemonicFromSeed(ptr0, len0);
|
|
203
|
+
var ptr2 = ret[0];
|
|
204
|
+
var len2 = ret[1];
|
|
205
|
+
if (ret[3]) {
|
|
206
|
+
ptr2 = 0; len2 = 0;
|
|
207
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
208
|
+
}
|
|
209
|
+
deferred3_0 = ptr2;
|
|
210
|
+
deferred3_1 = len2;
|
|
211
|
+
return getStringFromWasm0(ptr2, len2);
|
|
212
|
+
} finally {
|
|
213
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @param {string} signer_hex
|
|
219
|
+
* @returns {string}
|
|
220
|
+
*/
|
|
221
|
+
export function nonceSlotKey(signer_hex) {
|
|
222
|
+
let deferred3_0;
|
|
223
|
+
let deferred3_1;
|
|
224
|
+
try {
|
|
225
|
+
const ptr0 = passStringToWasm0(signer_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.nonceSlotKey(ptr0, len0);
|
|
228
|
+
var ptr2 = ret[0];
|
|
229
|
+
var len2 = ret[1];
|
|
230
|
+
if (ret[3]) {
|
|
231
|
+
ptr2 = 0; len2 = 0;
|
|
232
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
233
|
+
}
|
|
234
|
+
deferred3_0 = ptr2;
|
|
235
|
+
deferred3_1 = len2;
|
|
236
|
+
return getStringFromWasm0(ptr2, len2);
|
|
237
|
+
} finally {
|
|
238
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {string} seed_hex
|
|
244
|
+
* @param {bigint} index
|
|
245
|
+
* @returns {string}
|
|
246
|
+
*/
|
|
247
|
+
export function orderSigner(seed_hex, index) {
|
|
248
|
+
let deferred3_0;
|
|
249
|
+
let deferred3_1;
|
|
250
|
+
try {
|
|
251
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
253
|
+
const ret = wasm.orderSigner(ptr0, len0, index);
|
|
254
|
+
var ptr2 = ret[0];
|
|
255
|
+
var len2 = ret[1];
|
|
256
|
+
if (ret[3]) {
|
|
257
|
+
ptr2 = 0; len2 = 0;
|
|
258
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
259
|
+
}
|
|
260
|
+
deferred3_0 = ptr2;
|
|
261
|
+
deferred3_1 = len2;
|
|
262
|
+
return getStringFromWasm0(ptr2, len2);
|
|
263
|
+
} finally {
|
|
264
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @param {string} response
|
|
270
|
+
* @returns {string}
|
|
271
|
+
*/
|
|
272
|
+
export function parseEvents(response) {
|
|
273
|
+
let deferred3_0;
|
|
274
|
+
let deferred3_1;
|
|
275
|
+
try {
|
|
276
|
+
const ptr0 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
const ret = wasm.parseEvents(ptr0, len0);
|
|
279
|
+
var ptr2 = ret[0];
|
|
280
|
+
var len2 = ret[1];
|
|
281
|
+
if (ret[3]) {
|
|
282
|
+
ptr2 = 0; len2 = 0;
|
|
283
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
284
|
+
}
|
|
285
|
+
deferred3_0 = ptr2;
|
|
286
|
+
deferred3_1 = len2;
|
|
287
|
+
return getStringFromWasm0(ptr2, len2);
|
|
288
|
+
} finally {
|
|
289
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* @param {bigint} slot
|
|
295
|
+
* @returns {string}
|
|
296
|
+
*/
|
|
297
|
+
export function scalarSlotKey(slot) {
|
|
298
|
+
let deferred1_0;
|
|
299
|
+
let deferred1_1;
|
|
300
|
+
try {
|
|
301
|
+
const ret = wasm.scalarSlotKey(slot);
|
|
302
|
+
deferred1_0 = ret[0];
|
|
303
|
+
deferred1_1 = ret[1];
|
|
304
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
305
|
+
} finally {
|
|
306
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {string} phrase
|
|
312
|
+
* @returns {string}
|
|
313
|
+
*/
|
|
314
|
+
export function seedFromMnemonic(phrase) {
|
|
315
|
+
let deferred3_0;
|
|
316
|
+
let deferred3_1;
|
|
317
|
+
try {
|
|
318
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
320
|
+
const ret = wasm.seedFromMnemonic(ptr0, len0);
|
|
321
|
+
var ptr2 = ret[0];
|
|
322
|
+
var len2 = ret[1];
|
|
323
|
+
if (ret[3]) {
|
|
324
|
+
ptr2 = 0; len2 = 0;
|
|
325
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
326
|
+
}
|
|
327
|
+
deferred3_0 = ptr2;
|
|
328
|
+
deferred3_1 = len2;
|
|
329
|
+
return getStringFromWasm0(ptr2, len2);
|
|
330
|
+
} finally {
|
|
331
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @param {string} seed_hex
|
|
337
|
+
* @param {bigint} index
|
|
338
|
+
* @param {string} target
|
|
339
|
+
* @param {string} args_hex
|
|
340
|
+
* @param {bigint} nonce
|
|
341
|
+
* @param {bigint} meter_limit
|
|
342
|
+
* @param {string} fee
|
|
343
|
+
* @param {string} value
|
|
344
|
+
* @param {bigint} chain_id
|
|
345
|
+
* @returns {string}
|
|
346
|
+
*/
|
|
347
|
+
export function signPayableCall(seed_hex, index, target, args_hex, nonce, meter_limit, fee, value, chain_id) {
|
|
348
|
+
let deferred7_0;
|
|
349
|
+
let deferred7_1;
|
|
350
|
+
try {
|
|
351
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
352
|
+
const len0 = WASM_VECTOR_LEN;
|
|
353
|
+
const ptr1 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
354
|
+
const len1 = WASM_VECTOR_LEN;
|
|
355
|
+
const ptr2 = passStringToWasm0(args_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
356
|
+
const len2 = WASM_VECTOR_LEN;
|
|
357
|
+
const ptr3 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
358
|
+
const len3 = WASM_VECTOR_LEN;
|
|
359
|
+
const ptr4 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
360
|
+
const len4 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.signPayableCall(ptr0, len0, index, ptr1, len1, ptr2, len2, nonce, meter_limit, ptr3, len3, ptr4, len4, chain_id);
|
|
362
|
+
var ptr6 = ret[0];
|
|
363
|
+
var len6 = ret[1];
|
|
364
|
+
if (ret[3]) {
|
|
365
|
+
ptr6 = 0; len6 = 0;
|
|
366
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
367
|
+
}
|
|
368
|
+
deferred7_0 = ptr6;
|
|
369
|
+
deferred7_1 = len6;
|
|
370
|
+
return getStringFromWasm0(ptr6, len6);
|
|
371
|
+
} finally {
|
|
372
|
+
wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* @param {string} seed_hex
|
|
378
|
+
* @param {bigint} index
|
|
379
|
+
* @param {bigint} nonce
|
|
380
|
+
* @param {string} fee
|
|
381
|
+
* @param {bigint} chain_id
|
|
382
|
+
* @returns {string}
|
|
383
|
+
*/
|
|
384
|
+
export function signRegister(seed_hex, index, nonce, fee, chain_id) {
|
|
385
|
+
let deferred4_0;
|
|
386
|
+
let deferred4_1;
|
|
387
|
+
try {
|
|
388
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
389
|
+
const len0 = WASM_VECTOR_LEN;
|
|
390
|
+
const ptr1 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
391
|
+
const len1 = WASM_VECTOR_LEN;
|
|
392
|
+
const ret = wasm.signRegister(ptr0, len0, index, nonce, ptr1, len1, chain_id);
|
|
393
|
+
var ptr3 = ret[0];
|
|
394
|
+
var len3 = ret[1];
|
|
395
|
+
if (ret[3]) {
|
|
396
|
+
ptr3 = 0; len3 = 0;
|
|
397
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
398
|
+
}
|
|
399
|
+
deferred4_0 = ptr3;
|
|
400
|
+
deferred4_1 = len3;
|
|
401
|
+
return getStringFromWasm0(ptr3, len3);
|
|
402
|
+
} finally {
|
|
403
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* @param {string} seed_hex
|
|
409
|
+
* @param {bigint} index
|
|
410
|
+
* @param {string} target
|
|
411
|
+
* @param {string} args_hex
|
|
412
|
+
* @param {bigint} nonce
|
|
413
|
+
* @param {bigint} meter_limit
|
|
414
|
+
* @param {string} fee
|
|
415
|
+
* @param {bigint} chain_id
|
|
416
|
+
* @returns {string}
|
|
417
|
+
*/
|
|
418
|
+
export function sign_call(seed_hex, index, target, args_hex, nonce, meter_limit, fee, chain_id) {
|
|
419
|
+
let deferred6_0;
|
|
420
|
+
let deferred6_1;
|
|
421
|
+
try {
|
|
422
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
424
|
+
const ptr1 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
425
|
+
const len1 = WASM_VECTOR_LEN;
|
|
426
|
+
const ptr2 = passStringToWasm0(args_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
427
|
+
const len2 = WASM_VECTOR_LEN;
|
|
428
|
+
const ptr3 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
429
|
+
const len3 = WASM_VECTOR_LEN;
|
|
430
|
+
const ret = wasm.sign_call(ptr0, len0, index, ptr1, len1, ptr2, len2, nonce, meter_limit, ptr3, len3, chain_id);
|
|
431
|
+
var ptr5 = ret[0];
|
|
432
|
+
var len5 = ret[1];
|
|
433
|
+
if (ret[3]) {
|
|
434
|
+
ptr5 = 0; len5 = 0;
|
|
435
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
436
|
+
}
|
|
437
|
+
deferred6_0 = ptr5;
|
|
438
|
+
deferred6_1 = len5;
|
|
439
|
+
return getStringFromWasm0(ptr5, len5);
|
|
440
|
+
} finally {
|
|
441
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @param {string} seed_hex
|
|
447
|
+
* @param {bigint} index
|
|
448
|
+
* @param {string} to
|
|
449
|
+
* @param {string} amount
|
|
450
|
+
* @param {bigint} nonce
|
|
451
|
+
* @param {string} fee
|
|
452
|
+
* @param {bigint} chain_id
|
|
453
|
+
* @returns {string}
|
|
454
|
+
*/
|
|
455
|
+
export function sign_transfer(seed_hex, index, to, amount, nonce, fee, chain_id) {
|
|
456
|
+
let deferred6_0;
|
|
457
|
+
let deferred6_1;
|
|
458
|
+
try {
|
|
459
|
+
const ptr0 = passStringToWasm0(seed_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
460
|
+
const len0 = WASM_VECTOR_LEN;
|
|
461
|
+
const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
462
|
+
const len1 = WASM_VECTOR_LEN;
|
|
463
|
+
const ptr2 = passStringToWasm0(amount, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
464
|
+
const len2 = WASM_VECTOR_LEN;
|
|
465
|
+
const ptr3 = passStringToWasm0(fee, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
466
|
+
const len3 = WASM_VECTOR_LEN;
|
|
467
|
+
const ret = wasm.sign_transfer(ptr0, len0, index, ptr1, len1, ptr2, len2, nonce, ptr3, len3, chain_id);
|
|
468
|
+
var ptr5 = ret[0];
|
|
469
|
+
var len5 = ret[1];
|
|
470
|
+
if (ret[3]) {
|
|
471
|
+
ptr5 = 0; len5 = 0;
|
|
472
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
473
|
+
}
|
|
474
|
+
deferred6_0 = ptr5;
|
|
475
|
+
deferred6_1 = len5;
|
|
476
|
+
return getStringFromWasm0(ptr5, len5);
|
|
477
|
+
} finally {
|
|
478
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* @param {string} contract
|
|
484
|
+
* @returns {string}
|
|
485
|
+
*/
|
|
486
|
+
export function storageBody(contract) {
|
|
487
|
+
let deferred2_0;
|
|
488
|
+
let deferred2_1;
|
|
489
|
+
try {
|
|
490
|
+
const ptr0 = passStringToWasm0(contract, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
491
|
+
const len0 = WASM_VECTOR_LEN;
|
|
492
|
+
const ret = wasm.storageBody(ptr0, len0);
|
|
493
|
+
deferred2_0 = ret[0];
|
|
494
|
+
deferred2_1 = ret[1];
|
|
495
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
496
|
+
} finally {
|
|
497
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* @param {string} response
|
|
503
|
+
* @param {string} slot_key_hex
|
|
504
|
+
* @returns {string}
|
|
505
|
+
*/
|
|
506
|
+
export function storageValue(response, slot_key_hex) {
|
|
507
|
+
let deferred4_0;
|
|
508
|
+
let deferred4_1;
|
|
509
|
+
try {
|
|
510
|
+
const ptr0 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
511
|
+
const len0 = WASM_VECTOR_LEN;
|
|
512
|
+
const ptr1 = passStringToWasm0(slot_key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
513
|
+
const len1 = WASM_VECTOR_LEN;
|
|
514
|
+
const ret = wasm.storageValue(ptr0, len0, ptr1, len1);
|
|
515
|
+
var ptr3 = ret[0];
|
|
516
|
+
var len3 = ret[1];
|
|
517
|
+
if (ret[3]) {
|
|
518
|
+
ptr3 = 0; len3 = 0;
|
|
519
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
520
|
+
}
|
|
521
|
+
deferred4_0 = ptr3;
|
|
522
|
+
deferred4_1 = len3;
|
|
523
|
+
return getStringFromWasm0(ptr3, len3);
|
|
524
|
+
} finally {
|
|
525
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* @param {string} tx_hex
|
|
531
|
+
* @returns {string}
|
|
532
|
+
*/
|
|
533
|
+
export function submit_body(tx_hex) {
|
|
534
|
+
let deferred3_0;
|
|
535
|
+
let deferred3_1;
|
|
536
|
+
try {
|
|
537
|
+
const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
538
|
+
const len0 = WASM_VECTOR_LEN;
|
|
539
|
+
const ret = wasm.submit_body(ptr0, len0);
|
|
540
|
+
var ptr2 = ret[0];
|
|
541
|
+
var len2 = ret[1];
|
|
542
|
+
if (ret[3]) {
|
|
543
|
+
ptr2 = 0; len2 = 0;
|
|
544
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
545
|
+
}
|
|
546
|
+
deferred3_0 = ptr2;
|
|
547
|
+
deferred3_1 = len2;
|
|
548
|
+
return getStringFromWasm0(ptr2, len2);
|
|
549
|
+
} finally {
|
|
550
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @returns {bigint}
|
|
556
|
+
*/
|
|
557
|
+
export function testnetChainId() {
|
|
558
|
+
const ret = wasm.testnetChainId();
|
|
559
|
+
return BigInt.asUintN(64, ret);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @param {string} tx_id
|
|
564
|
+
* @returns {string}
|
|
565
|
+
*/
|
|
566
|
+
export function transaction_body(tx_id) {
|
|
567
|
+
let deferred2_0;
|
|
568
|
+
let deferred2_1;
|
|
569
|
+
try {
|
|
570
|
+
const ptr0 = passStringToWasm0(tx_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
571
|
+
const len0 = WASM_VECTOR_LEN;
|
|
572
|
+
const ret = wasm.transaction_body(ptr0, len0);
|
|
573
|
+
deferred2_0 = ret[0];
|
|
574
|
+
deferred2_1 = ret[1];
|
|
575
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
576
|
+
} finally {
|
|
577
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @param {string} address
|
|
583
|
+
* @returns {boolean}
|
|
584
|
+
*/
|
|
585
|
+
export function valid_address(address) {
|
|
586
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
588
|
+
const ret = wasm.valid_address(ptr0, len0);
|
|
589
|
+
return ret !== 0;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* @returns {string}
|
|
594
|
+
*/
|
|
595
|
+
export function vmDeployAddress() {
|
|
596
|
+
let deferred1_0;
|
|
597
|
+
let deferred1_1;
|
|
598
|
+
try {
|
|
599
|
+
const ret = wasm.vmDeployAddress();
|
|
600
|
+
deferred1_0 = ret[0];
|
|
601
|
+
deferred1_1 = ret[1];
|
|
602
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
603
|
+
} finally {
|
|
604
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
|
|
608
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
609
|
+
return ret;
|
|
610
|
+
}
|
|
611
|
+
export function __wbindgen_init_externref_table() {
|
|
612
|
+
const table = wasm.__wbindgen_externrefs;
|
|
613
|
+
const offset = table.grow(4);
|
|
614
|
+
table.set(0, undefined);
|
|
615
|
+
table.set(offset + 0, undefined);
|
|
616
|
+
table.set(offset + 1, null);
|
|
617
|
+
table.set(offset + 2, true);
|
|
618
|
+
table.set(offset + 3, false);
|
|
619
|
+
}
|
|
620
|
+
function getStringFromWasm0(ptr, len) {
|
|
621
|
+
return decodeText(ptr >>> 0, len);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
let cachedUint8ArrayMemory0 = null;
|
|
625
|
+
function getUint8ArrayMemory0() {
|
|
626
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
627
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
628
|
+
}
|
|
629
|
+
return cachedUint8ArrayMemory0;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
633
|
+
if (realloc === undefined) {
|
|
634
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
635
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
636
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
637
|
+
WASM_VECTOR_LEN = buf.length;
|
|
638
|
+
return ptr;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
let len = arg.length;
|
|
642
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
643
|
+
|
|
644
|
+
const mem = getUint8ArrayMemory0();
|
|
645
|
+
|
|
646
|
+
let offset = 0;
|
|
647
|
+
|
|
648
|
+
for (; offset < len; offset++) {
|
|
649
|
+
const code = arg.charCodeAt(offset);
|
|
650
|
+
if (code > 0x7F) break;
|
|
651
|
+
mem[ptr + offset] = code;
|
|
652
|
+
}
|
|
653
|
+
if (offset !== len) {
|
|
654
|
+
if (offset !== 0) {
|
|
655
|
+
arg = arg.slice(offset);
|
|
656
|
+
}
|
|
657
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
658
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
659
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
660
|
+
|
|
661
|
+
offset += ret.written;
|
|
662
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
WASM_VECTOR_LEN = offset;
|
|
666
|
+
return ptr;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function takeFromExternrefTable0(idx) {
|
|
670
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
671
|
+
wasm.__externref_table_dealloc(idx);
|
|
672
|
+
return value;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
676
|
+
cachedTextDecoder.decode();
|
|
677
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
678
|
+
let numBytesDecoded = 0;
|
|
679
|
+
function decodeText(ptr, len) {
|
|
680
|
+
numBytesDecoded += len;
|
|
681
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
682
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
683
|
+
cachedTextDecoder.decode();
|
|
684
|
+
numBytesDecoded = len;
|
|
685
|
+
}
|
|
686
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const cachedTextEncoder = new TextEncoder();
|
|
690
|
+
|
|
691
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
692
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
693
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
694
|
+
view.set(buf);
|
|
695
|
+
return {
|
|
696
|
+
read: arg.length,
|
|
697
|
+
written: buf.length
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
let WASM_VECTOR_LEN = 0;
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
let wasm;
|
|
706
|
+
export function __wbg_set_wasm(val) {
|
|
707
|
+
wasm = val;
|
|
708
|
+
}
|
|
Binary file
|