simulate-tx 0.1.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.
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "simulate-tx",
3
+ "version": "0.1.0",
4
+ "description": "EVM transaction simulator — simulate what a tx will do before sending it",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/kkpsiren/rtxsimulator"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "evm",
12
+ "ethereum",
13
+ "simulate",
14
+ "transaction",
15
+ "revm",
16
+ "wasm",
17
+ "zksync",
18
+ "lens",
19
+ "web3"
20
+ ],
21
+ "files": [
22
+ "simulate_tx_bg.wasm",
23
+ "simulate_tx.js",
24
+ "simulate_tx.d.ts"
25
+ ],
26
+ "main": "simulate_tx.js",
27
+ "types": "simulate_tx.d.ts"
28
+ }
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Simulate an EVM transaction.
6
+ *
7
+ * Accepts a JSON object with: from, to, data, value, chainId, blockNumber?, gasLimit?
8
+ * Returns a JSON object with: success, gasUsed, returnData, revertReason, effects, logs, calls
9
+ */
10
+ export function simulate(rpc_url: string, request_json: string): Promise<any>;
11
+
12
+ /**
13
+ * Simulate an EVM transaction from a JS object (no JSON parsing needed).
14
+ */
15
+ export function simulateFromObject(rpc_url: string, request: any): Promise<any>;
package/simulate_tx.js ADDED
@@ -0,0 +1,689 @@
1
+ /* @ts-self-types="./simulate_tx.d.ts" */
2
+
3
+ /**
4
+ * Simulate an EVM transaction.
5
+ *
6
+ * Accepts a JSON object with: from, to, data, value, chainId, blockNumber?, gasLimit?
7
+ * Returns a JSON object with: success, gasUsed, returnData, revertReason, effects, logs, calls
8
+ * @param {string} rpc_url
9
+ * @param {string} request_json
10
+ * @returns {Promise<any>}
11
+ */
12
+ function simulate(rpc_url, request_json) {
13
+ const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14
+ const len0 = WASM_VECTOR_LEN;
15
+ const ptr1 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
16
+ const len1 = WASM_VECTOR_LEN;
17
+ const ret = wasm.simulate(ptr0, len0, ptr1, len1);
18
+ return ret;
19
+ }
20
+ exports.simulate = simulate;
21
+
22
+ /**
23
+ * Simulate an EVM transaction from a JS object (no JSON parsing needed).
24
+ * @param {string} rpc_url
25
+ * @param {any} request
26
+ * @returns {Promise<any>}
27
+ */
28
+ function simulateFromObject(rpc_url, request) {
29
+ const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.simulateFromObject(ptr0, len0, request);
32
+ return ret;
33
+ }
34
+ exports.simulateFromObject = simulateFromObject;
35
+
36
+ function __wbg_get_imports() {
37
+ const import0 = {
38
+ __proto__: null,
39
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
40
+ const ret = Error(getStringFromWasm0(arg0, arg1));
41
+ return ret;
42
+ },
43
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
44
+ const ret = Number(arg0);
45
+ return ret;
46
+ },
47
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
48
+ const ret = String(arg1);
49
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
50
+ const len1 = WASM_VECTOR_LEN;
51
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
52
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
53
+ },
54
+ __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
55
+ const v = arg1;
56
+ const ret = typeof(v) === 'bigint' ? v : undefined;
57
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
58
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
59
+ },
60
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
61
+ const v = arg0;
62
+ const ret = typeof(v) === 'boolean' ? v : undefined;
63
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
64
+ },
65
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
66
+ const ret = debugString(arg1);
67
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
68
+ const len1 = WASM_VECTOR_LEN;
69
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
70
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
71
+ },
72
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
73
+ const ret = arg0 in arg1;
74
+ return ret;
75
+ },
76
+ __wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
77
+ const ret = typeof(arg0) === 'bigint';
78
+ return ret;
79
+ },
80
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
81
+ const ret = typeof(arg0) === 'function';
82
+ return ret;
83
+ },
84
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
85
+ const val = arg0;
86
+ const ret = typeof(val) === 'object' && val !== null;
87
+ return ret;
88
+ },
89
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
90
+ const ret = arg0 === undefined;
91
+ return ret;
92
+ },
93
+ __wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
94
+ const ret = arg0 === arg1;
95
+ return ret;
96
+ },
97
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
98
+ const ret = arg0 == arg1;
99
+ return ret;
100
+ },
101
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
102
+ const obj = arg1;
103
+ const ret = typeof(obj) === 'number' ? obj : undefined;
104
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
105
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
106
+ },
107
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
108
+ const obj = arg1;
109
+ const ret = typeof(obj) === 'string' ? obj : undefined;
110
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
111
+ var len1 = WASM_VECTOR_LEN;
112
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
113
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
114
+ },
115
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
116
+ throw new Error(getStringFromWasm0(arg0, arg1));
117
+ },
118
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
119
+ arg0._wbg_cb_unref();
120
+ },
121
+ __wbg_abort_5ef96933660780b7: function(arg0) {
122
+ arg0.abort();
123
+ },
124
+ __wbg_abort_6479c2d794ebf2ee: function(arg0, arg1) {
125
+ arg0.abort(arg1);
126
+ },
127
+ __wbg_append_608dfb635ee8998f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
128
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
129
+ }, arguments); },
130
+ __wbg_arrayBuffer_eb8e9ca620af2a19: function() { return handleError(function (arg0) {
131
+ const ret = arg0.arrayBuffer();
132
+ return ret;
133
+ }, arguments); },
134
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
135
+ const ret = arg0.call(arg1, arg2);
136
+ return ret;
137
+ }, arguments); },
138
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
139
+ const ret = arg0.call(arg1);
140
+ return ret;
141
+ }, arguments); },
142
+ __wbg_clearTimeout_6b8d9a38b9263d65: function(arg0) {
143
+ const ret = clearTimeout(arg0);
144
+ return ret;
145
+ },
146
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
147
+ const ret = arg0.done;
148
+ return ret;
149
+ },
150
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
151
+ const ret = Object.entries(arg0);
152
+ return ret;
153
+ },
154
+ __wbg_fetch_5550a88cf343aaa9: function(arg0, arg1) {
155
+ const ret = arg0.fetch(arg1);
156
+ return ret;
157
+ },
158
+ __wbg_fetch_9dad4fe911207b37: function(arg0) {
159
+ const ret = fetch(arg0);
160
+ return ret;
161
+ },
162
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
163
+ const ret = Reflect.get(arg0, arg1);
164
+ return ret;
165
+ }, arguments); },
166
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
167
+ const ret = arg0[arg1 >>> 0];
168
+ return ret;
169
+ },
170
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
171
+ const ret = arg0[arg1];
172
+ return ret;
173
+ },
174
+ __wbg_has_926ef2ff40b308cf: function() { return handleError(function (arg0, arg1) {
175
+ const ret = Reflect.has(arg0, arg1);
176
+ return ret;
177
+ }, arguments); },
178
+ __wbg_headers_eb2234545f9ff993: function(arg0) {
179
+ const ret = arg0.headers;
180
+ return ret;
181
+ },
182
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
183
+ let result;
184
+ try {
185
+ result = arg0 instanceof ArrayBuffer;
186
+ } catch (_) {
187
+ result = false;
188
+ }
189
+ const ret = result;
190
+ return ret;
191
+ },
192
+ __wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
193
+ let result;
194
+ try {
195
+ result = arg0 instanceof Map;
196
+ } catch (_) {
197
+ result = false;
198
+ }
199
+ const ret = result;
200
+ return ret;
201
+ },
202
+ __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
203
+ let result;
204
+ try {
205
+ result = arg0 instanceof Response;
206
+ } catch (_) {
207
+ result = false;
208
+ }
209
+ const ret = result;
210
+ return ret;
211
+ },
212
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
213
+ let result;
214
+ try {
215
+ result = arg0 instanceof Uint8Array;
216
+ } catch (_) {
217
+ result = false;
218
+ }
219
+ const ret = result;
220
+ return ret;
221
+ },
222
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
223
+ const ret = Array.isArray(arg0);
224
+ return ret;
225
+ },
226
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
227
+ const ret = Number.isSafeInteger(arg0);
228
+ return ret;
229
+ },
230
+ __wbg_iterator_d8f549ec8fb061b1: function() {
231
+ const ret = Symbol.iterator;
232
+ return ret;
233
+ },
234
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
235
+ const ret = arg0.length;
236
+ return ret;
237
+ },
238
+ __wbg_length_ea16607d7b61445b: function(arg0) {
239
+ const ret = arg0.length;
240
+ return ret;
241
+ },
242
+ __wbg_new_0837727332ac86ba: function() { return handleError(function () {
243
+ const ret = new Headers();
244
+ return ret;
245
+ }, arguments); },
246
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
247
+ const ret = new Uint8Array(arg0);
248
+ return ret;
249
+ },
250
+ __wbg_new_a70fbab9066b301f: function() {
251
+ const ret = new Array();
252
+ return ret;
253
+ },
254
+ __wbg_new_ab79df5bd7c26067: function() {
255
+ const ret = new Object();
256
+ return ret;
257
+ },
258
+ __wbg_new_c518c60af666645b: function() { return handleError(function () {
259
+ const ret = new AbortController();
260
+ return ret;
261
+ }, arguments); },
262
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
263
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
264
+ return ret;
265
+ },
266
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
267
+ try {
268
+ var state0 = {a: arg0, b: arg1};
269
+ var cb0 = (arg0, arg1) => {
270
+ const a = state0.a;
271
+ state0.a = 0;
272
+ try {
273
+ return wasm_bindgen__convert__closures_____invoke__h7ee010b39397fdaa(a, state0.b, arg0, arg1);
274
+ } finally {
275
+ state0.a = a;
276
+ }
277
+ };
278
+ const ret = new Promise(cb0);
279
+ return ret;
280
+ } finally {
281
+ state0.a = state0.b = 0;
282
+ }
283
+ },
284
+ __wbg_new_with_str_and_init_b4b54d1a819bc724: function() { return handleError(function (arg0, arg1, arg2) {
285
+ const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
286
+ return ret;
287
+ }, arguments); },
288
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
289
+ const ret = arg0.next();
290
+ return ret;
291
+ }, arguments); },
292
+ __wbg_next_e01a967809d1aa68: function(arg0) {
293
+ const ret = arg0.next;
294
+ return ret;
295
+ },
296
+ __wbg_now_55c5352b4b61d145: function(arg0) {
297
+ const ret = arg0.now();
298
+ return ret;
299
+ },
300
+ __wbg_performance_aa4d78060a5b8a2f: function(arg0) {
301
+ const ret = arg0.performance;
302
+ return ret;
303
+ },
304
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
305
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
306
+ },
307
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
308
+ const ret = arg0.queueMicrotask;
309
+ return ret;
310
+ },
311
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
312
+ queueMicrotask(arg0);
313
+ },
314
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
315
+ const ret = Promise.resolve(arg0);
316
+ return ret;
317
+ },
318
+ __wbg_setTimeout_05a790c35d76ff25: function() { return handleError(function (arg0, arg1, arg2) {
319
+ const ret = arg0.setTimeout(arg1, arg2);
320
+ return ret;
321
+ }, arguments); },
322
+ __wbg_setTimeout_f757f00851f76c42: function(arg0, arg1) {
323
+ const ret = setTimeout(arg0, arg1);
324
+ return ret;
325
+ },
326
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
327
+ arg0[arg1 >>> 0] = arg2;
328
+ },
329
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
330
+ arg0[arg1] = arg2;
331
+ },
332
+ __wbg_set_body_a3d856b097dfda04: function(arg0, arg1) {
333
+ arg0.body = arg1;
334
+ },
335
+ __wbg_set_cache_ec7e430c6056ebda: function(arg0, arg1) {
336
+ arg0.cache = __wbindgen_enum_RequestCache[arg1];
337
+ },
338
+ __wbg_set_credentials_ed63183445882c65: function(arg0, arg1) {
339
+ arg0.credentials = __wbindgen_enum_RequestCredentials[arg1];
340
+ },
341
+ __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
342
+ arg0.headers = arg1;
343
+ },
344
+ __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
345
+ arg0.method = getStringFromWasm0(arg1, arg2);
346
+ },
347
+ __wbg_set_mode_5a87f2c809cf37c2: function(arg0, arg1) {
348
+ arg0.mode = __wbindgen_enum_RequestMode[arg1];
349
+ },
350
+ __wbg_set_signal_0cebecb698f25d21: function(arg0, arg1) {
351
+ arg0.signal = arg1;
352
+ },
353
+ __wbg_signal_166e1da31adcac18: function(arg0) {
354
+ const ret = arg0.signal;
355
+ return ret;
356
+ },
357
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
358
+ const ret = typeof global === 'undefined' ? null : global;
359
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
360
+ },
361
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
362
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
363
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
364
+ },
365
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
366
+ const ret = typeof self === 'undefined' ? null : self;
367
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
368
+ },
369
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
370
+ const ret = typeof window === 'undefined' ? null : window;
371
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
372
+ },
373
+ __wbg_status_318629ab93a22955: function(arg0) {
374
+ const ret = arg0.status;
375
+ return ret;
376
+ },
377
+ __wbg_stringify_5ae93966a84901ac: function() { return handleError(function (arg0) {
378
+ const ret = JSON.stringify(arg0);
379
+ return ret;
380
+ }, arguments); },
381
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
382
+ const ret = arg0.then(arg1);
383
+ return ret;
384
+ },
385
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
386
+ const ret = arg0.then(arg1, arg2);
387
+ return ret;
388
+ },
389
+ __wbg_url_7fefc1820fba4e0c: function(arg0, arg1) {
390
+ const ret = arg1.url;
391
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
392
+ const len1 = WASM_VECTOR_LEN;
393
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
394
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
395
+ },
396
+ __wbg_value_21fc78aab0322612: function(arg0) {
397
+ const ret = arg0.value;
398
+ return ret;
399
+ },
400
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
401
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1311, function: Function { arguments: [], shim_idx: 1312, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
402
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hc5902a6d06b923a3, wasm_bindgen__convert__closures_____invoke__h2b964097809672eb);
403
+ return ret;
404
+ },
405
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
406
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1338, function: Function { arguments: [], shim_idx: 1339, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
407
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h71723e99fae8b7d3, wasm_bindgen__convert__closures_____invoke__h4766229986729d7b);
408
+ return ret;
409
+ },
410
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
411
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1359, function: Function { arguments: [Externref], shim_idx: 1360, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
412
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8c3e3aa227f2be42, wasm_bindgen__convert__closures_____invoke__hcb761b76cf6feb9a);
413
+ return ret;
414
+ },
415
+ __wbindgen_cast_0000000000000004: function(arg0) {
416
+ // Cast intrinsic for `F64 -> Externref`.
417
+ const ret = arg0;
418
+ return ret;
419
+ },
420
+ __wbindgen_cast_0000000000000005: function(arg0) {
421
+ // Cast intrinsic for `I64 -> Externref`.
422
+ const ret = arg0;
423
+ return ret;
424
+ },
425
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
426
+ // Cast intrinsic for `Ref(String) -> Externref`.
427
+ const ret = getStringFromWasm0(arg0, arg1);
428
+ return ret;
429
+ },
430
+ __wbindgen_cast_0000000000000007: function(arg0) {
431
+ // Cast intrinsic for `U64 -> Externref`.
432
+ const ret = BigInt.asUintN(64, arg0);
433
+ return ret;
434
+ },
435
+ __wbindgen_init_externref_table: function() {
436
+ const table = wasm.__wbindgen_externrefs;
437
+ const offset = table.grow(4);
438
+ table.set(0, undefined);
439
+ table.set(offset + 0, undefined);
440
+ table.set(offset + 1, null);
441
+ table.set(offset + 2, true);
442
+ table.set(offset + 3, false);
443
+ },
444
+ };
445
+ return {
446
+ __proto__: null,
447
+ "./simulate_tx_bg.js": import0,
448
+ };
449
+ }
450
+
451
+ function wasm_bindgen__convert__closures_____invoke__h2b964097809672eb(arg0, arg1) {
452
+ wasm.wasm_bindgen__convert__closures_____invoke__h2b964097809672eb(arg0, arg1);
453
+ }
454
+
455
+ function wasm_bindgen__convert__closures_____invoke__h4766229986729d7b(arg0, arg1) {
456
+ wasm.wasm_bindgen__convert__closures_____invoke__h4766229986729d7b(arg0, arg1);
457
+ }
458
+
459
+ function wasm_bindgen__convert__closures_____invoke__hcb761b76cf6feb9a(arg0, arg1, arg2) {
460
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hcb761b76cf6feb9a(arg0, arg1, arg2);
461
+ if (ret[1]) {
462
+ throw takeFromExternrefTable0(ret[0]);
463
+ }
464
+ }
465
+
466
+ function wasm_bindgen__convert__closures_____invoke__h7ee010b39397fdaa(arg0, arg1, arg2, arg3) {
467
+ wasm.wasm_bindgen__convert__closures_____invoke__h7ee010b39397fdaa(arg0, arg1, arg2, arg3);
468
+ }
469
+
470
+
471
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
472
+
473
+
474
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
475
+
476
+
477
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
478
+
479
+ function addToExternrefTable0(obj) {
480
+ const idx = wasm.__externref_table_alloc();
481
+ wasm.__wbindgen_externrefs.set(idx, obj);
482
+ return idx;
483
+ }
484
+
485
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
486
+ ? { register: () => {}, unregister: () => {} }
487
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
488
+
489
+ function debugString(val) {
490
+ // primitive types
491
+ const type = typeof val;
492
+ if (type == 'number' || type == 'boolean' || val == null) {
493
+ return `${val}`;
494
+ }
495
+ if (type == 'string') {
496
+ return `"${val}"`;
497
+ }
498
+ if (type == 'symbol') {
499
+ const description = val.description;
500
+ if (description == null) {
501
+ return 'Symbol';
502
+ } else {
503
+ return `Symbol(${description})`;
504
+ }
505
+ }
506
+ if (type == 'function') {
507
+ const name = val.name;
508
+ if (typeof name == 'string' && name.length > 0) {
509
+ return `Function(${name})`;
510
+ } else {
511
+ return 'Function';
512
+ }
513
+ }
514
+ // objects
515
+ if (Array.isArray(val)) {
516
+ const length = val.length;
517
+ let debug = '[';
518
+ if (length > 0) {
519
+ debug += debugString(val[0]);
520
+ }
521
+ for(let i = 1; i < length; i++) {
522
+ debug += ', ' + debugString(val[i]);
523
+ }
524
+ debug += ']';
525
+ return debug;
526
+ }
527
+ // Test for built-in
528
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
529
+ let className;
530
+ if (builtInMatches && builtInMatches.length > 1) {
531
+ className = builtInMatches[1];
532
+ } else {
533
+ // Failed to match the standard '[object ClassName]'
534
+ return toString.call(val);
535
+ }
536
+ if (className == 'Object') {
537
+ // we're a user defined class or Object
538
+ // JSON.stringify avoids problems with cycles, and is generally much
539
+ // easier than looping through ownProperties of `val`.
540
+ try {
541
+ return 'Object(' + JSON.stringify(val) + ')';
542
+ } catch (_) {
543
+ return 'Object';
544
+ }
545
+ }
546
+ // errors
547
+ if (val instanceof Error) {
548
+ return `${val.name}: ${val.message}\n${val.stack}`;
549
+ }
550
+ // TODO we could test for more things here, like `Set`s and `Map`s.
551
+ return className;
552
+ }
553
+
554
+ function getArrayU8FromWasm0(ptr, len) {
555
+ ptr = ptr >>> 0;
556
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
557
+ }
558
+
559
+ let cachedDataViewMemory0 = null;
560
+ function getDataViewMemory0() {
561
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
562
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
563
+ }
564
+ return cachedDataViewMemory0;
565
+ }
566
+
567
+ function getStringFromWasm0(ptr, len) {
568
+ ptr = ptr >>> 0;
569
+ return decodeText(ptr, len);
570
+ }
571
+
572
+ let cachedUint8ArrayMemory0 = null;
573
+ function getUint8ArrayMemory0() {
574
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
575
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
576
+ }
577
+ return cachedUint8ArrayMemory0;
578
+ }
579
+
580
+ function handleError(f, args) {
581
+ try {
582
+ return f.apply(this, args);
583
+ } catch (e) {
584
+ const idx = addToExternrefTable0(e);
585
+ wasm.__wbindgen_exn_store(idx);
586
+ }
587
+ }
588
+
589
+ function isLikeNone(x) {
590
+ return x === undefined || x === null;
591
+ }
592
+
593
+ function makeMutClosure(arg0, arg1, dtor, f) {
594
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
595
+ const real = (...args) => {
596
+
597
+ // First up with a closure we increment the internal reference
598
+ // count. This ensures that the Rust closure environment won't
599
+ // be deallocated while we're invoking it.
600
+ state.cnt++;
601
+ const a = state.a;
602
+ state.a = 0;
603
+ try {
604
+ return f(a, state.b, ...args);
605
+ } finally {
606
+ state.a = a;
607
+ real._wbg_cb_unref();
608
+ }
609
+ };
610
+ real._wbg_cb_unref = () => {
611
+ if (--state.cnt === 0) {
612
+ state.dtor(state.a, state.b);
613
+ state.a = 0;
614
+ CLOSURE_DTORS.unregister(state);
615
+ }
616
+ };
617
+ CLOSURE_DTORS.register(real, state, state);
618
+ return real;
619
+ }
620
+
621
+ function passStringToWasm0(arg, malloc, realloc) {
622
+ if (realloc === undefined) {
623
+ const buf = cachedTextEncoder.encode(arg);
624
+ const ptr = malloc(buf.length, 1) >>> 0;
625
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
626
+ WASM_VECTOR_LEN = buf.length;
627
+ return ptr;
628
+ }
629
+
630
+ let len = arg.length;
631
+ let ptr = malloc(len, 1) >>> 0;
632
+
633
+ const mem = getUint8ArrayMemory0();
634
+
635
+ let offset = 0;
636
+
637
+ for (; offset < len; offset++) {
638
+ const code = arg.charCodeAt(offset);
639
+ if (code > 0x7F) break;
640
+ mem[ptr + offset] = code;
641
+ }
642
+ if (offset !== len) {
643
+ if (offset !== 0) {
644
+ arg = arg.slice(offset);
645
+ }
646
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
647
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
648
+ const ret = cachedTextEncoder.encodeInto(arg, view);
649
+
650
+ offset += ret.written;
651
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
652
+ }
653
+
654
+ WASM_VECTOR_LEN = offset;
655
+ return ptr;
656
+ }
657
+
658
+ function takeFromExternrefTable0(idx) {
659
+ const value = wasm.__wbindgen_externrefs.get(idx);
660
+ wasm.__externref_table_dealloc(idx);
661
+ return value;
662
+ }
663
+
664
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
665
+ cachedTextDecoder.decode();
666
+ function decodeText(ptr, len) {
667
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
668
+ }
669
+
670
+ const cachedTextEncoder = new TextEncoder();
671
+
672
+ if (!('encodeInto' in cachedTextEncoder)) {
673
+ cachedTextEncoder.encodeInto = function (arg, view) {
674
+ const buf = cachedTextEncoder.encode(arg);
675
+ view.set(buf);
676
+ return {
677
+ read: arg.length,
678
+ written: buf.length
679
+ };
680
+ };
681
+ }
682
+
683
+ let WASM_VECTOR_LEN = 0;
684
+
685
+ const wasmPath = `${__dirname}/simulate_tx_bg.wasm`;
686
+ const wasmBytes = require('fs').readFileSync(wasmPath);
687
+ const wasmModule = new WebAssembly.Module(wasmBytes);
688
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
689
+ wasm.__wbindgen_start();
Binary file