@acala-network/chopsticks-executor 0.7.2 → 0.8.0-0

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.
@@ -0,0 +1,85 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {any} code
5
+ * @returns {Promise<any>}
6
+ */
7
+ export function get_runtime_version(code: any): Promise<any>;
8
+ /**
9
+ * @param {any} entries
10
+ * @param {any} trie_version
11
+ * @returns {Promise<any>}
12
+ */
13
+ export function calculate_state_root(entries: any, trie_version: any): Promise<any>;
14
+ /**
15
+ * @param {any} root_trie_hash
16
+ * @param {any} keys
17
+ * @param {any} nodes
18
+ * @returns {Promise<any>}
19
+ */
20
+ export function decode_proof(root_trie_hash: any, keys: any, nodes: any): Promise<any>;
21
+ /**
22
+ * @param {any} nodes
23
+ * @param {any} entries
24
+ * @returns {Promise<any>}
25
+ */
26
+ export function create_proof(nodes: any, entries: any): Promise<any>;
27
+ /**
28
+ * @param {any} task
29
+ * @param {JsCallback} js
30
+ * @param {string | undefined} log_level
31
+ * @returns {Promise<any>}
32
+ */
33
+ export function run_task(task: any, js: JsCallback, log_level?: string): Promise<any>;
34
+
35
+ import { HexString } from '@polkadot/util/types';
36
+ export interface JsCallback {
37
+ getStorage: (key: HexString) => Promise<string | undefined>
38
+ getStateRoot: () => Promise<string>
39
+ getNextKey: (prefix: HexString, key: HexString) => Promise<string | undefined>
40
+ offchainGetStorage: (key: HexString) => Promise<string | undefined>
41
+ offchainTimestamp: () => Promise<number>
42
+ offchainRandomSeed: () => Promise<HexString>
43
+ offchainSubmitTransaction: (tx: HexString) => Promise<boolean>
44
+ }
45
+
46
+
47
+
48
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
49
+
50
+ export interface InitOutput {
51
+ readonly memory: WebAssembly.Memory;
52
+ readonly get_runtime_version: (a: number) => number;
53
+ readonly calculate_state_root: (a: number, b: number) => number;
54
+ readonly decode_proof: (a: number, b: number, c: number) => number;
55
+ readonly create_proof: (a: number, b: number) => number;
56
+ readonly run_task: (a: number, b: number, c: number, d: number) => number;
57
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
58
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
59
+ readonly __wbindgen_export_2: WebAssembly.Table;
60
+ readonly wasm_bindgen__convert__closures__invoke1_mut__h7043b82208c98903: (a: number, b: number, c: number) => void;
61
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
62
+ readonly __wbindgen_exn_store: (a: number) => void;
63
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h14b58699f4ec867c: (a: number, b: number, c: number, d: number) => void;
64
+ }
65
+
66
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
67
+ /**
68
+ * Instantiates the given `module`, which can either be bytes or
69
+ * a precompiled `WebAssembly.Module`.
70
+ *
71
+ * @param {SyncInitInput} module
72
+ *
73
+ * @returns {InitOutput}
74
+ */
75
+ export function initSync(module: SyncInitInput): InitOutput;
76
+
77
+ /**
78
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
79
+ * for everything else, calls `WebAssembly.instantiate` directly.
80
+ *
81
+ * @param {InitInput | Promise<InitInput>} module_or_path
82
+ *
83
+ * @returns {Promise<InitOutput>}
84
+ */
85
+ export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,694 @@
1
+ let wasm;
2
+
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
9
+ let WASM_VECTOR_LEN = 0;
10
+
11
+ let cachedUint8Memory0 = null;
12
+
13
+ function getUint8Memory0() {
14
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
15
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
16
+ }
17
+ return cachedUint8Memory0;
18
+ }
19
+
20
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
21
+
22
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
+ ? function (arg, view) {
24
+ return cachedTextEncoder.encodeInto(arg, view);
25
+ }
26
+ : function (arg, view) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ view.set(buf);
29
+ return {
30
+ read: arg.length,
31
+ written: buf.length
32
+ };
33
+ });
34
+
35
+ function passStringToWasm0(arg, malloc, realloc) {
36
+
37
+ if (realloc === undefined) {
38
+ const buf = cachedTextEncoder.encode(arg);
39
+ const ptr = malloc(buf.length, 1) >>> 0;
40
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
41
+ WASM_VECTOR_LEN = buf.length;
42
+ return ptr;
43
+ }
44
+
45
+ let len = arg.length;
46
+ let ptr = malloc(len, 1) >>> 0;
47
+
48
+ const mem = getUint8Memory0();
49
+
50
+ let offset = 0;
51
+
52
+ for (; offset < len; offset++) {
53
+ const code = arg.charCodeAt(offset);
54
+ if (code > 0x7F) break;
55
+ mem[ptr + offset] = code;
56
+ }
57
+
58
+ if (offset !== len) {
59
+ if (offset !== 0) {
60
+ arg = arg.slice(offset);
61
+ }
62
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
64
+ const ret = encodeString(arg, view);
65
+
66
+ offset += ret.written;
67
+ }
68
+
69
+ WASM_VECTOR_LEN = offset;
70
+ return ptr;
71
+ }
72
+
73
+ function isLikeNone(x) {
74
+ return x === undefined || x === null;
75
+ }
76
+
77
+ let cachedInt32Memory0 = null;
78
+
79
+ function getInt32Memory0() {
80
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
81
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
82
+ }
83
+ return cachedInt32Memory0;
84
+ }
85
+
86
+ let heap_next = heap.length;
87
+
88
+ function dropObject(idx) {
89
+ if (idx < 132) return;
90
+ heap[idx] = heap_next;
91
+ heap_next = idx;
92
+ }
93
+
94
+ function takeObject(idx) {
95
+ const ret = getObject(idx);
96
+ dropObject(idx);
97
+ return ret;
98
+ }
99
+
100
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
101
+
102
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
103
+
104
+ function getStringFromWasm0(ptr, len) {
105
+ ptr = ptr >>> 0;
106
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
107
+ }
108
+
109
+ function addHeapObject(obj) {
110
+ if (heap_next === heap.length) heap.push(heap.length + 1);
111
+ const idx = heap_next;
112
+ heap_next = heap[idx];
113
+
114
+ heap[idx] = obj;
115
+ return idx;
116
+ }
117
+
118
+ let cachedFloat64Memory0 = null;
119
+
120
+ function getFloat64Memory0() {
121
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
122
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
123
+ }
124
+ return cachedFloat64Memory0;
125
+ }
126
+
127
+ let cachedBigInt64Memory0 = null;
128
+
129
+ function getBigInt64Memory0() {
130
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
131
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
132
+ }
133
+ return cachedBigInt64Memory0;
134
+ }
135
+
136
+ function debugString(val) {
137
+ // primitive types
138
+ const type = typeof val;
139
+ if (type == 'number' || type == 'boolean' || val == null) {
140
+ return `${val}`;
141
+ }
142
+ if (type == 'string') {
143
+ return `"${val}"`;
144
+ }
145
+ if (type == 'symbol') {
146
+ const description = val.description;
147
+ if (description == null) {
148
+ return 'Symbol';
149
+ } else {
150
+ return `Symbol(${description})`;
151
+ }
152
+ }
153
+ if (type == 'function') {
154
+ const name = val.name;
155
+ if (typeof name == 'string' && name.length > 0) {
156
+ return `Function(${name})`;
157
+ } else {
158
+ return 'Function';
159
+ }
160
+ }
161
+ // objects
162
+ if (Array.isArray(val)) {
163
+ const length = val.length;
164
+ let debug = '[';
165
+ if (length > 0) {
166
+ debug += debugString(val[0]);
167
+ }
168
+ for(let i = 1; i < length; i++) {
169
+ debug += ', ' + debugString(val[i]);
170
+ }
171
+ debug += ']';
172
+ return debug;
173
+ }
174
+ // Test for built-in
175
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
176
+ let className;
177
+ if (builtInMatches.length > 1) {
178
+ className = builtInMatches[1];
179
+ } else {
180
+ // Failed to match the standard '[object ClassName]'
181
+ return toString.call(val);
182
+ }
183
+ if (className == 'Object') {
184
+ // we're a user defined class or Object
185
+ // JSON.stringify avoids problems with cycles, and is generally much
186
+ // easier than looping through ownProperties of `val`.
187
+ try {
188
+ return 'Object(' + JSON.stringify(val) + ')';
189
+ } catch (_) {
190
+ return 'Object';
191
+ }
192
+ }
193
+ // errors
194
+ if (val instanceof Error) {
195
+ return `${val.name}: ${val.message}\n${val.stack}`;
196
+ }
197
+ // TODO we could test for more things here, like `Set`s and `Map`s.
198
+ return className;
199
+ }
200
+
201
+ function makeMutClosure(arg0, arg1, dtor, f) {
202
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
203
+ const real = (...args) => {
204
+ // First up with a closure we increment the internal reference
205
+ // count. This ensures that the Rust closure environment won't
206
+ // be deallocated while we're invoking it.
207
+ state.cnt++;
208
+ const a = state.a;
209
+ state.a = 0;
210
+ try {
211
+ return f(a, state.b, ...args);
212
+ } finally {
213
+ if (--state.cnt === 0) {
214
+ wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
215
+
216
+ } else {
217
+ state.a = a;
218
+ }
219
+ }
220
+ };
221
+ real.original = state;
222
+
223
+ return real;
224
+ }
225
+ function __wbg_adapter_46(arg0, arg1, arg2) {
226
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__h7043b82208c98903(arg0, arg1, addHeapObject(arg2));
227
+ }
228
+
229
+ /**
230
+ * @param {any} code
231
+ * @returns {Promise<any>}
232
+ */
233
+ export function get_runtime_version(code) {
234
+ const ret = wasm.get_runtime_version(addHeapObject(code));
235
+ return takeObject(ret);
236
+ }
237
+
238
+ /**
239
+ * @param {any} entries
240
+ * @param {any} trie_version
241
+ * @returns {Promise<any>}
242
+ */
243
+ export function calculate_state_root(entries, trie_version) {
244
+ const ret = wasm.calculate_state_root(addHeapObject(entries), addHeapObject(trie_version));
245
+ return takeObject(ret);
246
+ }
247
+
248
+ /**
249
+ * @param {any} root_trie_hash
250
+ * @param {any} keys
251
+ * @param {any} nodes
252
+ * @returns {Promise<any>}
253
+ */
254
+ export function decode_proof(root_trie_hash, keys, nodes) {
255
+ const ret = wasm.decode_proof(addHeapObject(root_trie_hash), addHeapObject(keys), addHeapObject(nodes));
256
+ return takeObject(ret);
257
+ }
258
+
259
+ /**
260
+ * @param {any} nodes
261
+ * @param {any} entries
262
+ * @returns {Promise<any>}
263
+ */
264
+ export function create_proof(nodes, entries) {
265
+ const ret = wasm.create_proof(addHeapObject(nodes), addHeapObject(entries));
266
+ return takeObject(ret);
267
+ }
268
+
269
+ /**
270
+ * @param {any} task
271
+ * @param {JsCallback} js
272
+ * @param {string | undefined} log_level
273
+ * @returns {Promise<any>}
274
+ */
275
+ export function run_task(task, js, log_level) {
276
+ var ptr0 = isLikeNone(log_level) ? 0 : passStringToWasm0(log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
+ var len0 = WASM_VECTOR_LEN;
278
+ const ret = wasm.run_task(addHeapObject(task), addHeapObject(js), ptr0, len0);
279
+ return takeObject(ret);
280
+ }
281
+
282
+ function handleError(f, args) {
283
+ try {
284
+ return f.apply(this, args);
285
+ } catch (e) {
286
+ wasm.__wbindgen_exn_store(addHeapObject(e));
287
+ }
288
+ }
289
+ function __wbg_adapter_106(arg0, arg1, arg2, arg3) {
290
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h14b58699f4ec867c(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
291
+ }
292
+
293
+ async function __wbg_load(module, imports) {
294
+ if (typeof Response === 'function' && module instanceof Response) {
295
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
296
+ try {
297
+ return await WebAssembly.instantiateStreaming(module, imports);
298
+
299
+ } catch (e) {
300
+ if (module.headers.get('Content-Type') != 'application/wasm') {
301
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
302
+
303
+ } else {
304
+ throw e;
305
+ }
306
+ }
307
+ }
308
+
309
+ const bytes = await module.arrayBuffer();
310
+ return await WebAssembly.instantiate(bytes, imports);
311
+
312
+ } else {
313
+ const instance = await WebAssembly.instantiate(module, imports);
314
+
315
+ if (instance instanceof WebAssembly.Instance) {
316
+ return { instance, module };
317
+
318
+ } else {
319
+ return instance;
320
+ }
321
+ }
322
+ }
323
+
324
+ function __wbg_get_imports() {
325
+ const imports = {};
326
+ imports.wbg = {};
327
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
328
+ const obj = getObject(arg1);
329
+ const ret = typeof(obj) === 'string' ? obj : undefined;
330
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
331
+ var len1 = WASM_VECTOR_LEN;
332
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
333
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
334
+ };
335
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
336
+ takeObject(arg0);
337
+ };
338
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
339
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
340
+ return addHeapObject(ret);
341
+ };
342
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
343
+ const ret = getStringFromWasm0(arg0, arg1);
344
+ return addHeapObject(ret);
345
+ };
346
+ imports.wbg.__wbg_call_01734de55d61e11d = function() { return handleError(function (arg0, arg1, arg2) {
347
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
348
+ return addHeapObject(ret);
349
+ }, arguments) };
350
+ imports.wbg.__wbg_isArray_4c24b343cb13cfb1 = function(arg0) {
351
+ const ret = Array.isArray(getObject(arg0));
352
+ return ret;
353
+ };
354
+ imports.wbg.__wbg_length_fff51ee6522a1a18 = function(arg0) {
355
+ const ret = getObject(arg0).length;
356
+ return ret;
357
+ };
358
+ imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) {
359
+ const ret = getObject(arg0)[arg1 >>> 0];
360
+ return addHeapObject(ret);
361
+ };
362
+ imports.wbg.__wbg_next_ddb3312ca1c4e32a = function() { return handleError(function (arg0) {
363
+ const ret = getObject(arg0).next();
364
+ return addHeapObject(ret);
365
+ }, arguments) };
366
+ imports.wbg.__wbg_done_5c1f01fb660d73b5 = function(arg0) {
367
+ const ret = getObject(arg0).done;
368
+ return ret;
369
+ };
370
+ imports.wbg.__wbg_value_1695675138684bd5 = function(arg0) {
371
+ const ret = getObject(arg0).value;
372
+ return addHeapObject(ret);
373
+ };
374
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
375
+ const obj = getObject(arg1);
376
+ const ret = typeof(obj) === 'number' ? obj : undefined;
377
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
378
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
379
+ };
380
+ imports.wbg.__wbg_isSafeInteger_bb8e18dd21c97288 = function(arg0) {
381
+ const ret = Number.isSafeInteger(getObject(arg0));
382
+ return ret;
383
+ };
384
+ imports.wbg.__wbg_new_b51585de1b234aff = function() {
385
+ const ret = new Object();
386
+ return addHeapObject(ret);
387
+ };
388
+ imports.wbg.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
389
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
390
+ };
391
+ imports.wbg.__wbindgen_number_new = function(arg0) {
392
+ const ret = arg0;
393
+ return addHeapObject(ret);
394
+ };
395
+ imports.wbg.__wbg_new_898a68150f225f2e = function() {
396
+ const ret = new Array();
397
+ return addHeapObject(ret);
398
+ };
399
+ imports.wbg.__wbg_set_502d29070ea18557 = function(arg0, arg1, arg2) {
400
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
401
+ };
402
+ imports.wbg.__wbindgen_is_object = function(arg0) {
403
+ const val = getObject(arg0);
404
+ const ret = typeof(val) === 'object' && val !== null;
405
+ return ret;
406
+ };
407
+ imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
408
+ const ret = getObject(arg0)[getObject(arg1)];
409
+ return addHeapObject(ret);
410
+ };
411
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
412
+ const ret = getObject(arg0) === undefined;
413
+ return ret;
414
+ };
415
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
416
+ const ret = getObject(arg0) in getObject(arg1);
417
+ return ret;
418
+ };
419
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
420
+ const v = getObject(arg0);
421
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
422
+ return ret;
423
+ };
424
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
425
+ const obj = takeObject(arg0).original;
426
+ if (obj.cnt-- == 1) {
427
+ obj.a = 0;
428
+ return true;
429
+ }
430
+ const ret = false;
431
+ return ret;
432
+ };
433
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
434
+ const ret = getObject(arg0) == getObject(arg1);
435
+ return ret;
436
+ };
437
+ imports.wbg.__wbg_offchainSubmitTransaction_63ba1665b4baf81d = function(arg0, arg1) {
438
+ const ret = getObject(arg0).offchainSubmitTransaction(takeObject(arg1));
439
+ return addHeapObject(ret);
440
+ };
441
+ imports.wbg.__wbg_offchainRandomSeed_e1ee69c9c37dafb8 = function(arg0) {
442
+ const ret = getObject(arg0).offchainRandomSeed();
443
+ return addHeapObject(ret);
444
+ };
445
+ imports.wbg.__wbg_offchainTimestamp_320e8e4c96c9e04c = function(arg0) {
446
+ const ret = getObject(arg0).offchainTimestamp();
447
+ return addHeapObject(ret);
448
+ };
449
+ imports.wbg.__wbg_offchainGetStorage_953b5cc09e08e83d = function(arg0, arg1) {
450
+ const ret = getObject(arg0).offchainGetStorage(takeObject(arg1));
451
+ return addHeapObject(ret);
452
+ };
453
+ imports.wbg.__wbg_getNextKey_5794bb6bbba2420d = function(arg0, arg1, arg2) {
454
+ const ret = getObject(arg0).getNextKey(takeObject(arg1), takeObject(arg2));
455
+ return addHeapObject(ret);
456
+ };
457
+ imports.wbg.__wbg_getStateRoot_899ea4ca2b02d1f6 = function(arg0) {
458
+ const ret = getObject(arg0).getStateRoot();
459
+ return addHeapObject(ret);
460
+ };
461
+ imports.wbg.__wbg_getStorage_83a32e2f6165ee0b = function(arg0, arg1) {
462
+ const ret = getObject(arg0).getStorage(takeObject(arg1));
463
+ return addHeapObject(ret);
464
+ };
465
+ imports.wbg.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
466
+ const ret = String(getObject(arg1));
467
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ const len1 = WASM_VECTOR_LEN;
469
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
470
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
471
+ };
472
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
473
+ const ret = typeof(getObject(arg0)) === 'bigint';
474
+ return ret;
475
+ };
476
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
477
+ const v = getObject(arg1);
478
+ const ret = typeof(v) === 'bigint' ? v : undefined;
479
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
480
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
481
+ };
482
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
483
+ const ret = BigInt.asUintN(64, arg0);
484
+ return addHeapObject(ret);
485
+ };
486
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
487
+ const ret = getObject(arg0) === getObject(arg1);
488
+ return ret;
489
+ };
490
+ imports.wbg.__wbindgen_is_string = function(arg0) {
491
+ const ret = typeof(getObject(arg0)) === 'string';
492
+ return ret;
493
+ };
494
+ imports.wbg.__wbg_new_43f1b47c28813cbd = function(arg0, arg1) {
495
+ try {
496
+ var state0 = {a: arg0, b: arg1};
497
+ var cb0 = (arg0, arg1) => {
498
+ const a = state0.a;
499
+ state0.a = 0;
500
+ try {
501
+ return __wbg_adapter_106(a, state0.b, arg0, arg1);
502
+ } finally {
503
+ state0.a = a;
504
+ }
505
+ };
506
+ const ret = new Promise(cb0);
507
+ return addHeapObject(ret);
508
+ } finally {
509
+ state0.a = state0.b = 0;
510
+ }
511
+ };
512
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
513
+ const ret = new Error();
514
+ return addHeapObject(ret);
515
+ };
516
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
517
+ const ret = getObject(arg1).stack;
518
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
519
+ const len1 = WASM_VECTOR_LEN;
520
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
521
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
522
+ };
523
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
524
+ let deferred0_0;
525
+ let deferred0_1;
526
+ try {
527
+ deferred0_0 = arg0;
528
+ deferred0_1 = arg1;
529
+ console.error(getStringFromWasm0(arg0, arg1));
530
+ } finally {
531
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
532
+ }
533
+ };
534
+ imports.wbg.__wbg_iterator_97f0c81209c6c35a = function() {
535
+ const ret = Symbol.iterator;
536
+ return addHeapObject(ret);
537
+ };
538
+ imports.wbg.__wbg_get_97b561fb56f034b5 = function() { return handleError(function (arg0, arg1) {
539
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
540
+ return addHeapObject(ret);
541
+ }, arguments) };
542
+ imports.wbg.__wbindgen_is_function = function(arg0) {
543
+ const ret = typeof(getObject(arg0)) === 'function';
544
+ return ret;
545
+ };
546
+ imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
547
+ const ret = getObject(arg0).call(getObject(arg1));
548
+ return addHeapObject(ret);
549
+ }, arguments) };
550
+ imports.wbg.__wbg_next_526fc47e980da008 = function(arg0) {
551
+ const ret = getObject(arg0).next;
552
+ return addHeapObject(ret);
553
+ };
554
+ imports.wbg.__wbg_length_72e2208bbc0efc61 = function(arg0) {
555
+ const ret = getObject(arg0).length;
556
+ return ret;
557
+ };
558
+ imports.wbg.__wbindgen_memory = function() {
559
+ const ret = wasm.memory;
560
+ return addHeapObject(ret);
561
+ };
562
+ imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
563
+ const ret = getObject(arg0).buffer;
564
+ return addHeapObject(ret);
565
+ };
566
+ imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
567
+ const ret = new Uint8Array(getObject(arg0));
568
+ return addHeapObject(ret);
569
+ };
570
+ imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
571
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
572
+ };
573
+ imports.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4 = function(arg0) {
574
+ let result;
575
+ try {
576
+ result = getObject(arg0) instanceof Uint8Array;
577
+ } catch {
578
+ result = false;
579
+ }
580
+ const ret = result;
581
+ return ret;
582
+ };
583
+ imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function(arg0) {
584
+ let result;
585
+ try {
586
+ result = getObject(arg0) instanceof ArrayBuffer;
587
+ } catch {
588
+ result = false;
589
+ }
590
+ const ret = result;
591
+ return ret;
592
+ };
593
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
594
+ const ret = getObject(arg0);
595
+ return addHeapObject(ret);
596
+ };
597
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
598
+ const ret = debugString(getObject(arg1));
599
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
600
+ const len1 = WASM_VECTOR_LEN;
601
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
602
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
603
+ };
604
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
605
+ throw new Error(getStringFromWasm0(arg0, arg1));
606
+ };
607
+ imports.wbg.__wbg_then_b2267541e2a73865 = function(arg0, arg1, arg2) {
608
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
609
+ return addHeapObject(ret);
610
+ };
611
+ imports.wbg.__wbg_resolve_53698b95aaf7fcf8 = function(arg0) {
612
+ const ret = Promise.resolve(getObject(arg0));
613
+ return addHeapObject(ret);
614
+ };
615
+ imports.wbg.__wbg_then_f7e06ee3c11698eb = function(arg0, arg1) {
616
+ const ret = getObject(arg0).then(getObject(arg1));
617
+ return addHeapObject(ret);
618
+ };
619
+ imports.wbg.__wbg_debug_f15cb542ea509609 = function(arg0) {
620
+ console.debug(getObject(arg0));
621
+ };
622
+ imports.wbg.__wbg_error_ef9a0be47931175f = function(arg0) {
623
+ console.error(getObject(arg0));
624
+ };
625
+ imports.wbg.__wbg_info_2874fdd5393f35ce = function(arg0) {
626
+ console.info(getObject(arg0));
627
+ };
628
+ imports.wbg.__wbg_log_4b5638ad60bdc54a = function(arg0) {
629
+ console.log(getObject(arg0));
630
+ };
631
+ imports.wbg.__wbg_warn_58110c4a199df084 = function(arg0) {
632
+ console.warn(getObject(arg0));
633
+ };
634
+ imports.wbg.__wbindgen_closure_wrapper1327 = function(arg0, arg1, arg2) {
635
+ const ret = makeMutClosure(arg0, arg1, 128, __wbg_adapter_46);
636
+ return addHeapObject(ret);
637
+ };
638
+
639
+ return imports;
640
+ }
641
+
642
+ function __wbg_init_memory(imports, maybe_memory) {
643
+
644
+ }
645
+
646
+ function __wbg_finalize_init(instance, module) {
647
+ wasm = instance.exports;
648
+ __wbg_init.__wbindgen_wasm_module = module;
649
+ cachedBigInt64Memory0 = null;
650
+ cachedFloat64Memory0 = null;
651
+ cachedInt32Memory0 = null;
652
+ cachedUint8Memory0 = null;
653
+
654
+
655
+ return wasm;
656
+ }
657
+
658
+ function initSync(module) {
659
+ if (wasm !== undefined) return wasm;
660
+
661
+ const imports = __wbg_get_imports();
662
+
663
+ __wbg_init_memory(imports);
664
+
665
+ if (!(module instanceof WebAssembly.Module)) {
666
+ module = new WebAssembly.Module(module);
667
+ }
668
+
669
+ const instance = new WebAssembly.Instance(module, imports);
670
+
671
+ return __wbg_finalize_init(instance, module);
672
+ }
673
+
674
+ async function __wbg_init(input) {
675
+ if (wasm !== undefined) return wasm;
676
+
677
+ if (typeof input === 'undefined') {
678
+ input = new URL('chopsticks_executor_bg.wasm', import.meta.url);
679
+ }
680
+ const imports = __wbg_get_imports();
681
+
682
+ if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
683
+ input = fetch(input);
684
+ }
685
+
686
+ __wbg_init_memory(imports);
687
+
688
+ const { instance, module } = await __wbg_load(await input, imports);
689
+
690
+ return __wbg_finalize_init(instance, module);
691
+ }
692
+
693
+ export { initSync }
694
+ export default __wbg_init;
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export function get_runtime_version(a: number): number;
5
+ export function calculate_state_root(a: number, b: number): number;
6
+ export function decode_proof(a: number, b: number, c: number): number;
7
+ export function create_proof(a: number, b: number): number;
8
+ export function run_task(a: number, b: number, c: number, d: number): number;
9
+ export function __wbindgen_malloc(a: number, b: number): number;
10
+ export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
11
+ export const __wbindgen_export_2: WebAssembly.Table;
12
+ export function wasm_bindgen__convert__closures__invoke1_mut__h7043b82208c98903(a: number, b: number, c: number): void;
13
+ export function __wbindgen_free(a: number, b: number, c: number): void;
14
+ export function __wbindgen_exn_store(a: number): void;
15
+ export function wasm_bindgen__convert__closures__invoke2_mut__h14b58699f4ec867c(a: number, b: number, c: number, d: number): void;
@@ -40,7 +40,7 @@ export interface JsCallback {
40
40
  offchainGetStorage: (key: HexString) => Promise<string | undefined>
41
41
  offchainTimestamp: () => Promise<number>
42
42
  offchainRandomSeed: () => Promise<HexString>
43
- offchainSubmitTransaction: (tx: HexString) => Promise<bool>
43
+ offchainSubmitTransaction: (tx: HexString) => Promise<boolean>
44
44
  }
45
45
 
46
46
 
@@ -351,6 +351,32 @@ module.exports.__wbg_value_1695675138684bd5 = function(arg0) {
351
351
  return addHeapObject(ret);
352
352
  };
353
353
 
354
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
355
+ const obj = getObject(arg1);
356
+ const ret = typeof(obj) === 'number' ? obj : undefined;
357
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
358
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
359
+ };
360
+
361
+ module.exports.__wbg_isSafeInteger_bb8e18dd21c97288 = function(arg0) {
362
+ const ret = Number.isSafeInteger(getObject(arg0));
363
+ return ret;
364
+ };
365
+
366
+ module.exports.__wbg_new_b51585de1b234aff = function() {
367
+ const ret = new Object();
368
+ return addHeapObject(ret);
369
+ };
370
+
371
+ module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
372
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
373
+ };
374
+
375
+ module.exports.__wbindgen_number_new = function(arg0) {
376
+ const ret = arg0;
377
+ return addHeapObject(ret);
378
+ };
379
+
354
380
  module.exports.__wbg_new_898a68150f225f2e = function() {
355
381
  const ret = new Array();
356
382
  return addHeapObject(ret);
@@ -381,38 +407,12 @@ module.exports.__wbindgen_in = function(arg0, arg1) {
381
407
  return ret;
382
408
  };
383
409
 
384
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
385
- const obj = getObject(arg1);
386
- const ret = typeof(obj) === 'number' ? obj : undefined;
387
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
388
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
389
- };
390
-
391
- module.exports.__wbg_isSafeInteger_bb8e18dd21c97288 = function(arg0) {
392
- const ret = Number.isSafeInteger(getObject(arg0));
393
- return ret;
394
- };
395
-
396
410
  module.exports.__wbindgen_boolean_get = function(arg0) {
397
411
  const v = getObject(arg0);
398
412
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
399
413
  return ret;
400
414
  };
401
415
 
402
- module.exports.__wbg_new_b51585de1b234aff = function() {
403
- const ret = new Object();
404
- return addHeapObject(ret);
405
- };
406
-
407
- module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
408
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
409
- };
410
-
411
- module.exports.__wbindgen_number_new = function(arg0) {
412
- const ret = arg0;
413
- return addHeapObject(ret);
414
- };
415
-
416
416
  module.exports.__wbindgen_cb_drop = function(arg0) {
417
417
  const obj = takeObject(arg0).original;
418
418
  if (obj.cnt-- == 1) {
@@ -428,37 +428,37 @@ module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
428
428
  return ret;
429
429
  };
430
430
 
431
- module.exports.__wbg_offchainSubmitTransaction_208a38d431f09b2d = function(arg0, arg1) {
431
+ module.exports.__wbg_offchainSubmitTransaction_63ba1665b4baf81d = function(arg0, arg1) {
432
432
  const ret = getObject(arg0).offchainSubmitTransaction(takeObject(arg1));
433
433
  return addHeapObject(ret);
434
434
  };
435
435
 
436
- module.exports.__wbg_offchainRandomSeed_a8d71b7ed7289154 = function(arg0) {
436
+ module.exports.__wbg_offchainRandomSeed_e1ee69c9c37dafb8 = function(arg0) {
437
437
  const ret = getObject(arg0).offchainRandomSeed();
438
438
  return addHeapObject(ret);
439
439
  };
440
440
 
441
- module.exports.__wbg_offchainTimestamp_224a9ed18712d356 = function(arg0) {
441
+ module.exports.__wbg_offchainTimestamp_320e8e4c96c9e04c = function(arg0) {
442
442
  const ret = getObject(arg0).offchainTimestamp();
443
443
  return addHeapObject(ret);
444
444
  };
445
445
 
446
- module.exports.__wbg_offchainGetStorage_60e9c2134203c72d = function(arg0, arg1) {
446
+ module.exports.__wbg_offchainGetStorage_953b5cc09e08e83d = function(arg0, arg1) {
447
447
  const ret = getObject(arg0).offchainGetStorage(takeObject(arg1));
448
448
  return addHeapObject(ret);
449
449
  };
450
450
 
451
- module.exports.__wbg_getNextKey_10fb10d9aaf76f47 = function(arg0, arg1, arg2) {
451
+ module.exports.__wbg_getNextKey_5794bb6bbba2420d = function(arg0, arg1, arg2) {
452
452
  const ret = getObject(arg0).getNextKey(takeObject(arg1), takeObject(arg2));
453
453
  return addHeapObject(ret);
454
454
  };
455
455
 
456
- module.exports.__wbg_getStateRoot_57e08f8962f50174 = function(arg0) {
456
+ module.exports.__wbg_getStateRoot_899ea4ca2b02d1f6 = function(arg0) {
457
457
  const ret = getObject(arg0).getStateRoot();
458
458
  return addHeapObject(ret);
459
459
  };
460
460
 
461
- module.exports.__wbg_getStorage_fadab477c3508c50 = function(arg0, arg1) {
461
+ module.exports.__wbg_getStorage_83a32e2f6165ee0b = function(arg0, arg1) {
462
462
  const ret = getObject(arg0).getStorage(takeObject(arg1));
463
463
  return addHeapObject(ret);
464
464
  };
@@ -665,7 +665,7 @@ module.exports.__wbg_warn_58110c4a199df084 = function(arg0) {
665
665
  console.warn(getObject(arg0));
666
666
  };
667
667
 
668
- module.exports.__wbindgen_closure_wrapper1329 = function(arg0, arg1, arg2) {
668
+ module.exports.__wbindgen_closure_wrapper1327 = function(arg0, arg1, arg2) {
669
669
  const ret = makeMutClosure(arg0, arg1, 128, __wbg_adapter_46);
670
670
  return addHeapObject(ret);
671
671
  };
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export function get_runtime_version(a: number): number;
5
+ export function calculate_state_root(a: number, b: number): number;
6
+ export function decode_proof(a: number, b: number, c: number): number;
7
+ export function create_proof(a: number, b: number): number;
8
+ export function run_task(a: number, b: number, c: number, d: number): number;
9
+ export function __wbindgen_malloc(a: number, b: number): number;
10
+ export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
11
+ export const __wbindgen_export_2: WebAssembly.Table;
12
+ export function wasm_bindgen__convert__closures__invoke1_mut__h7043b82208c98903(a: number, b: number, c: number): void;
13
+ export function __wbindgen_free(a: number, b: number, c: number): void;
14
+ export function __wbindgen_exn_store(a: number): void;
15
+ export function wasm_bindgen__convert__closures__invoke2_mut__h14b58699f4ec867c(a: number, b: number, c: number, d: number): void;
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-executor",
3
3
  "description": "Chopsticks executor",
4
- "version": "0.7.2",
4
+ "version": "0.8.0-0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/AcalaNetwork/chopsticks"
9
9
  },
10
+ "scripts": {
11
+ "clean": "rm -rf web node",
12
+ "build": "wasm-pack build --target web --out-dir browser; wasm-pack build --target nodejs --out-dir node"
13
+ },
10
14
  "files": [
11
- "chopsticks_executor_bg.wasm",
12
- "chopsticks_executor.js",
13
- "chopsticks_executor.d.ts"
15
+ "browser/chopsticks_*",
16
+ "node/chopsticks_*"
14
17
  ],
15
- "main": "chopsticks_executor.js",
16
- "types": "chopsticks_executor.d.ts"
18
+ "main": "node/chopsticks_executor.js",
19
+ "types": "browser/chopsticks_executor.d.ts",
20
+ "browser": "browser/chopsticks_executor.js",
21
+ "stableVersion": "0.7.3"
17
22
  }