@haneullabs/move-bytecode-template 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.
@@ -0,0 +1,676 @@
1
+ let wasm;
2
+
3
+ let WASM_VECTOR_LEN = 0;
4
+
5
+ let cachedUint8ArrayMemory0 = null;
6
+
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
+ }
11
+ return cachedUint8ArrayMemory0;
12
+ }
13
+
14
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
+
16
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
17
+ ? function (arg, view) {
18
+ return cachedTextEncoder.encodeInto(arg, view);
19
+ }
20
+ : function (arg, view) {
21
+ const buf = cachedTextEncoder.encode(arg);
22
+ view.set(buf);
23
+ return {
24
+ read: arg.length,
25
+ written: buf.length
26
+ };
27
+ });
28
+
29
+ function passStringToWasm0(arg, malloc, realloc) {
30
+
31
+ if (realloc === undefined) {
32
+ const buf = cachedTextEncoder.encode(arg);
33
+ const ptr = malloc(buf.length, 1) >>> 0;
34
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
+ WASM_VECTOR_LEN = buf.length;
36
+ return ptr;
37
+ }
38
+
39
+ let len = arg.length;
40
+ let ptr = malloc(len, 1) >>> 0;
41
+
42
+ const mem = getUint8ArrayMemory0();
43
+
44
+ let offset = 0;
45
+
46
+ for (; offset < len; offset++) {
47
+ const code = arg.charCodeAt(offset);
48
+ if (code > 0x7F) break;
49
+ mem[ptr + offset] = code;
50
+ }
51
+
52
+ if (offset !== len) {
53
+ if (offset !== 0) {
54
+ arg = arg.slice(offset);
55
+ }
56
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
+ const ret = encodeString(arg, view);
59
+
60
+ offset += ret.written;
61
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
62
+ }
63
+
64
+ WASM_VECTOR_LEN = offset;
65
+ return ptr;
66
+ }
67
+
68
+ let cachedDataViewMemory0 = null;
69
+
70
+ function getDataViewMemory0() {
71
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
+ }
74
+ return cachedDataViewMemory0;
75
+ }
76
+
77
+ function addToExternrefTable0(obj) {
78
+ const idx = wasm.__externref_table_alloc();
79
+ wasm.__wbindgen_export_4.set(idx, obj);
80
+ return idx;
81
+ }
82
+
83
+ function handleError(f, args) {
84
+ try {
85
+ return f.apply(this, args);
86
+ } catch (e) {
87
+ const idx = addToExternrefTable0(e);
88
+ wasm.__wbindgen_exn_store(idx);
89
+ }
90
+ }
91
+
92
+ function isLikeNone(x) {
93
+ return x === undefined || x === null;
94
+ }
95
+
96
+ function debugString(val) {
97
+ // primitive types
98
+ const type = typeof val;
99
+ if (type == 'number' || type == 'boolean' || val == null) {
100
+ return `${val}`;
101
+ }
102
+ if (type == 'string') {
103
+ return `"${val}"`;
104
+ }
105
+ if (type == 'symbol') {
106
+ const description = val.description;
107
+ if (description == null) {
108
+ return 'Symbol';
109
+ } else {
110
+ return `Symbol(${description})`;
111
+ }
112
+ }
113
+ if (type == 'function') {
114
+ const name = val.name;
115
+ if (typeof name == 'string' && name.length > 0) {
116
+ return `Function(${name})`;
117
+ } else {
118
+ return 'Function';
119
+ }
120
+ }
121
+ // objects
122
+ if (Array.isArray(val)) {
123
+ const length = val.length;
124
+ let debug = '[';
125
+ if (length > 0) {
126
+ debug += debugString(val[0]);
127
+ }
128
+ for(let i = 1; i < length; i++) {
129
+ debug += ', ' + debugString(val[i]);
130
+ }
131
+ debug += ']';
132
+ return debug;
133
+ }
134
+ // Test for built-in
135
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
136
+ let className;
137
+ if (builtInMatches && builtInMatches.length > 1) {
138
+ className = builtInMatches[1];
139
+ } else {
140
+ // Failed to match the standard '[object ClassName]'
141
+ return toString.call(val);
142
+ }
143
+ if (className == 'Object') {
144
+ // we're a user defined class or Object
145
+ // JSON.stringify avoids problems with cycles, and is generally much
146
+ // easier than looping through ownProperties of `val`.
147
+ try {
148
+ return 'Object(' + JSON.stringify(val) + ')';
149
+ } catch (_) {
150
+ return 'Object';
151
+ }
152
+ }
153
+ // errors
154
+ if (val instanceof Error) {
155
+ return `${val.name}: ${val.message}\n${val.stack}`;
156
+ }
157
+ // TODO we could test for more things here, like `Set`s and `Map`s.
158
+ return className;
159
+ }
160
+
161
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
162
+
163
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
164
+
165
+ function getStringFromWasm0(ptr, len) {
166
+ ptr = ptr >>> 0;
167
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
168
+ }
169
+ /**
170
+ * Get the version of the crate (useful for testing the package).
171
+ * @returns {string}
172
+ */
173
+ export function version() {
174
+ let deferred1_0;
175
+ let deferred1_1;
176
+ try {
177
+ const ret = wasm.version();
178
+ deferred1_0 = ret[0];
179
+ deferred1_1 = ret[1];
180
+ return getStringFromWasm0(ret[0], ret[1]);
181
+ } finally {
182
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
183
+ }
184
+ }
185
+
186
+ function passArray8ToWasm0(arg, malloc) {
187
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
188
+ getUint8ArrayMemory0().set(arg, ptr / 1);
189
+ WASM_VECTOR_LEN = arg.length;
190
+ return ptr;
191
+ }
192
+
193
+ function takeFromExternrefTable0(idx) {
194
+ const value = wasm.__wbindgen_export_4.get(idx);
195
+ wasm.__externref_table_dealloc(idx);
196
+ return value;
197
+ }
198
+ /**
199
+ * Deserialize the `Uint8Array`` bytecode into a JSON object.
200
+ * The JSON object contains the ABI (Application Binary Interface) of the module.
201
+ *
202
+ * ```javascript
203
+ * import * as template from '@haneullabs/move-binary-template';
204
+ *
205
+ * const json = template.deserialize( binary );
206
+ * console.log( json, json.identifiers );
207
+ * ```
208
+ * @param {Uint8Array} binary
209
+ * @returns {any}
210
+ */
211
+ export function deserialize(binary) {
212
+ const ptr0 = passArray8ToWasm0(binary, wasm.__wbindgen_malloc);
213
+ const len0 = WASM_VECTOR_LEN;
214
+ const ret = wasm.deserialize(ptr0, len0);
215
+ if (ret[2]) {
216
+ throw takeFromExternrefTable0(ret[1]);
217
+ }
218
+ return takeFromExternrefTable0(ret[0]);
219
+ }
220
+
221
+ function getArrayU8FromWasm0(ptr, len) {
222
+ ptr = ptr >>> 0;
223
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
224
+ }
225
+ /**
226
+ * Update the identifiers in the module bytecode, given a map of old -> new identifiers.
227
+ * Returns the updated bytecode.
228
+ *
229
+ * ```javascript
230
+ * import * as template from '@haneullabs/move-binary-template';
231
+ *
232
+ * const updated = template.update_identifiers( binary, {
233
+ * 'TEMPLATE': 'NEW_VALUE',
234
+ * 'template': 'new_value',
235
+ * 'Name': 'NewName'
236
+ * });
237
+ * ```
238
+ * @param {Uint8Array} binary
239
+ * @param {any} map
240
+ * @returns {Uint8Array}
241
+ */
242
+ export function update_identifiers(binary, map) {
243
+ const ptr0 = passArray8ToWasm0(binary, wasm.__wbindgen_malloc);
244
+ const len0 = WASM_VECTOR_LEN;
245
+ const ret = wasm.update_identifiers(ptr0, len0, map);
246
+ if (ret[3]) {
247
+ throw takeFromExternrefTable0(ret[2]);
248
+ }
249
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
250
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
251
+ return v2;
252
+ }
253
+
254
+ /**
255
+ * Updates a constant in the constant pool. Because constants don't have names,
256
+ * the only way to identify them is by their type and value.
257
+ *
258
+ * The value of a constant is BCS-encoded and the type is a string representation
259
+ * of the `SignatureToken` enum. String identifier for `SignatureToken` is a
260
+ * capitalized version of the type: U8, Address, Vector(Bool), Vector(U8), etc.
261
+ *
262
+ * ```javascript
263
+ * import * as template from '@haneullabs/move-binary-template';
264
+ * import { bcs } from '@haneullabs/bcs';
265
+ *
266
+ * let binary = template.update_constants(
267
+ * binary, // Uint8Array
268
+ * bcs.u64().serialize(0).toBytes(), // new value
269
+ * bcs.u64().serialize(100000).toBytes(), // old value
270
+ * 'U64' // type
271
+ * );
272
+ * ```
273
+ * @param {Uint8Array} binary
274
+ * @param {Uint8Array} new_value
275
+ * @param {Uint8Array} expected_value
276
+ * @param {string} expected_type
277
+ * @returns {Uint8Array}
278
+ */
279
+ export function update_constants(binary, new_value, expected_value, expected_type) {
280
+ const ptr0 = passArray8ToWasm0(binary, wasm.__wbindgen_malloc);
281
+ const len0 = WASM_VECTOR_LEN;
282
+ const ptr1 = passArray8ToWasm0(new_value, wasm.__wbindgen_malloc);
283
+ const len1 = WASM_VECTOR_LEN;
284
+ const ptr2 = passArray8ToWasm0(expected_value, wasm.__wbindgen_malloc);
285
+ const len2 = WASM_VECTOR_LEN;
286
+ const ptr3 = passStringToWasm0(expected_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
287
+ const len3 = WASM_VECTOR_LEN;
288
+ const ret = wasm.update_constants(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
289
+ if (ret[3]) {
290
+ throw takeFromExternrefTable0(ret[2]);
291
+ }
292
+ var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
293
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
294
+ return v5;
295
+ }
296
+
297
+ /**
298
+ * Convenience method to analyze the constant pool; returns all constants in order
299
+ * with their type and BCS value.
300
+ *
301
+ * ```javascript
302
+ * import * as template from '@haneullabs/move-binary-template';
303
+ *
304
+ * let consts = template.get_constants(binary);
305
+ * ```
306
+ * @param {Uint8Array} binary
307
+ * @returns {any}
308
+ */
309
+ export function get_constants(binary) {
310
+ const ptr0 = passArray8ToWasm0(binary, wasm.__wbindgen_malloc);
311
+ const len0 = WASM_VECTOR_LEN;
312
+ const ret = wasm.get_constants(ptr0, len0);
313
+ if (ret[2]) {
314
+ throw takeFromExternrefTable0(ret[1]);
315
+ }
316
+ return takeFromExternrefTable0(ret[0]);
317
+ }
318
+
319
+ /**
320
+ * Serialize the JSON module into a `Uint8Array` (bytecode).
321
+ * @param {any} json_module
322
+ * @returns {Uint8Array}
323
+ */
324
+ export function serialize(json_module) {
325
+ const ret = wasm.serialize(json_module);
326
+ if (ret[3]) {
327
+ throw takeFromExternrefTable0(ret[2]);
328
+ }
329
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
330
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
331
+ return v1;
332
+ }
333
+
334
+ const ConstantFinalization = (typeof FinalizationRegistry === 'undefined')
335
+ ? { register: () => {}, unregister: () => {} }
336
+ : new FinalizationRegistry(ptr => wasm.__wbg_constant_free(ptr >>> 0, 1));
337
+ /**
338
+ * A transformed constant from the constant pool.
339
+ */
340
+ export class Constant {
341
+
342
+ __destroy_into_raw() {
343
+ const ptr = this.__wbg_ptr;
344
+ this.__wbg_ptr = 0;
345
+ ConstantFinalization.unregister(this);
346
+ return ptr;
347
+ }
348
+
349
+ free() {
350
+ const ptr = this.__destroy_into_raw();
351
+ wasm.__wbg_constant_free(ptr, 0);
352
+ }
353
+ }
354
+
355
+ async function __wbg_load(module, imports) {
356
+ if (typeof Response === 'function' && module instanceof Response) {
357
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
358
+ try {
359
+ return await WebAssembly.instantiateStreaming(module, imports);
360
+
361
+ } catch (e) {
362
+ if (module.headers.get('Content-Type') != 'application/wasm') {
363
+ 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);
364
+
365
+ } else {
366
+ throw e;
367
+ }
368
+ }
369
+ }
370
+
371
+ const bytes = await module.arrayBuffer();
372
+ return await WebAssembly.instantiate(bytes, imports);
373
+
374
+ } else {
375
+ const instance = await WebAssembly.instantiate(module, imports);
376
+
377
+ if (instance instanceof WebAssembly.Instance) {
378
+ return { instance, module };
379
+
380
+ } else {
381
+ return instance;
382
+ }
383
+ }
384
+ }
385
+
386
+ function __wbg_get_imports() {
387
+ const imports = {};
388
+ imports.wbg = {};
389
+ imports.wbg.__wbg_String_eecc4a11987127d6 = function(arg0, arg1) {
390
+ const ret = String(arg1);
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
+ imports.wbg.__wbg_buffer_a215fd0f9dbb5414 = function(arg0) {
397
+ const ret = arg0.buffer;
398
+ return ret;
399
+ };
400
+ imports.wbg.__wbg_call_aa20ca83b389253c = function() { return handleError(function (arg0, arg1) {
401
+ const ret = arg0.call(arg1);
402
+ return ret;
403
+ }, arguments) };
404
+ imports.wbg.__wbg_done_b00ac79b7cf688ec = function(arg0) {
405
+ const ret = arg0.done;
406
+ return ret;
407
+ };
408
+ imports.wbg.__wbg_entries_2aaa882d15c26fd0 = function(arg0) {
409
+ const ret = Object.entries(arg0);
410
+ return ret;
411
+ };
412
+ imports.wbg.__wbg_get_142c69a0a38ca3a9 = function(arg0, arg1) {
413
+ const ret = arg0[arg1 >>> 0];
414
+ return ret;
415
+ };
416
+ imports.wbg.__wbg_get_9528546d1b415178 = function() { return handleError(function (arg0, arg1) {
417
+ const ret = Reflect.get(arg0, arg1);
418
+ return ret;
419
+ }, arguments) };
420
+ imports.wbg.__wbg_getwithrefkey_6550b2c093d2eb18 = function(arg0, arg1) {
421
+ const ret = arg0[arg1];
422
+ return ret;
423
+ };
424
+ imports.wbg.__wbg_instanceof_ArrayBuffer_b19b33ccadb20395 = function(arg0) {
425
+ let result;
426
+ try {
427
+ result = arg0 instanceof ArrayBuffer;
428
+ } catch (_) {
429
+ result = false;
430
+ }
431
+ const ret = result;
432
+ return ret;
433
+ };
434
+ imports.wbg.__wbg_instanceof_Uint8Array_ee46a70987a1d66b = function(arg0) {
435
+ let result;
436
+ try {
437
+ result = arg0 instanceof Uint8Array;
438
+ } catch (_) {
439
+ result = false;
440
+ }
441
+ const ret = result;
442
+ return ret;
443
+ };
444
+ imports.wbg.__wbg_isArray_643b5b2b3afb0871 = function(arg0) {
445
+ const ret = Array.isArray(arg0);
446
+ return ret;
447
+ };
448
+ imports.wbg.__wbg_isSafeInteger_1c660d27c689f62a = function(arg0) {
449
+ const ret = Number.isSafeInteger(arg0);
450
+ return ret;
451
+ };
452
+ imports.wbg.__wbg_iterator_c397425a538e3b86 = function() {
453
+ const ret = Symbol.iterator;
454
+ return ret;
455
+ };
456
+ imports.wbg.__wbg_length_1799fd5bf657c257 = function(arg0) {
457
+ const ret = arg0.length;
458
+ return ret;
459
+ };
460
+ imports.wbg.__wbg_length_621925723fc28f40 = function(arg0) {
461
+ const ret = arg0.length;
462
+ return ret;
463
+ };
464
+ imports.wbg.__wbg_new_9163745409122fa8 = function() {
465
+ const ret = new Array();
466
+ return ret;
467
+ };
468
+ imports.wbg.__wbg_new_b6f51e9f591d0d1d = function(arg0) {
469
+ const ret = new Uint8Array(arg0);
470
+ return ret;
471
+ };
472
+ imports.wbg.__wbg_new_d684b6b3189ca362 = function() {
473
+ const ret = new Object();
474
+ return ret;
475
+ };
476
+ imports.wbg.__wbg_next_6a72514087dd23f8 = function(arg0) {
477
+ const ret = arg0.next;
478
+ return ret;
479
+ };
480
+ imports.wbg.__wbg_next_96ab50690a8f6cca = function() { return handleError(function (arg0) {
481
+ const ret = arg0.next();
482
+ return ret;
483
+ }, arguments) };
484
+ imports.wbg.__wbg_set_3807d5f0bfc24aa7 = function(arg0, arg1, arg2) {
485
+ arg0[arg1] = arg2;
486
+ };
487
+ imports.wbg.__wbg_set_61aa9ab41a0fb137 = function(arg0, arg1, arg2) {
488
+ arg0[arg1 >>> 0] = arg2;
489
+ };
490
+ imports.wbg.__wbg_set_911a2f3ee8dd23b5 = function(arg0, arg1, arg2) {
491
+ arg0.set(arg1, arg2 >>> 0);
492
+ };
493
+ imports.wbg.__wbg_value_5af0abb3b2b9f90b = function(arg0) {
494
+ const ret = arg0.value;
495
+ return ret;
496
+ };
497
+ imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
498
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
499
+ return ret;
500
+ };
501
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
502
+ const ret = BigInt.asUintN(64, arg0);
503
+ return ret;
504
+ };
505
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
506
+ const v = arg1;
507
+ const ret = typeof(v) === 'bigint' ? v : undefined;
508
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
509
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
510
+ };
511
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
512
+ const v = arg0;
513
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
514
+ return ret;
515
+ };
516
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
517
+ const ret = debugString(arg1);
518
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
519
+ const len1 = WASM_VECTOR_LEN;
520
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
521
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
522
+ };
523
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
524
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
525
+ return ret;
526
+ };
527
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
528
+ const ret = arg0 in arg1;
529
+ return ret;
530
+ };
531
+ imports.wbg.__wbindgen_init_externref_table = function() {
532
+ const table = wasm.__wbindgen_export_4;
533
+ const offset = table.grow(4);
534
+ table.set(0, undefined);
535
+ table.set(offset + 0, undefined);
536
+ table.set(offset + 1, null);
537
+ table.set(offset + 2, true);
538
+ table.set(offset + 3, false);
539
+ ;
540
+ };
541
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
542
+ const ret = typeof(arg0) === 'bigint';
543
+ return ret;
544
+ };
545
+ imports.wbg.__wbindgen_is_function = function(arg0) {
546
+ const ret = typeof(arg0) === 'function';
547
+ return ret;
548
+ };
549
+ imports.wbg.__wbindgen_is_object = function(arg0) {
550
+ const val = arg0;
551
+ const ret = typeof(val) === 'object' && val !== null;
552
+ return ret;
553
+ };
554
+ imports.wbg.__wbindgen_is_string = function(arg0) {
555
+ const ret = typeof(arg0) === 'string';
556
+ return ret;
557
+ };
558
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
559
+ const ret = arg0 === undefined;
560
+ return ret;
561
+ };
562
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
563
+ const ret = arg0 === arg1;
564
+ return ret;
565
+ };
566
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
567
+ const ret = arg0 == arg1;
568
+ return ret;
569
+ };
570
+ imports.wbg.__wbindgen_memory = function() {
571
+ const ret = wasm.memory;
572
+ return ret;
573
+ };
574
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
575
+ const obj = arg1;
576
+ const ret = typeof(obj) === 'number' ? obj : undefined;
577
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
578
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
579
+ };
580
+ imports.wbg.__wbindgen_number_new = function(arg0) {
581
+ const ret = arg0;
582
+ return ret;
583
+ };
584
+ imports.wbg.__wbindgen_shr = function(arg0, arg1) {
585
+ const ret = arg0 >> arg1;
586
+ return ret;
587
+ };
588
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
589
+ const obj = arg1;
590
+ const ret = typeof(obj) === 'string' ? obj : undefined;
591
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
592
+ var len1 = WASM_VECTOR_LEN;
593
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
594
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
595
+ };
596
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
597
+ const ret = getStringFromWasm0(arg0, arg1);
598
+ return ret;
599
+ };
600
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
601
+ throw new Error(getStringFromWasm0(arg0, arg1));
602
+ };
603
+
604
+ return imports;
605
+ }
606
+
607
+ function __wbg_init_memory(imports, memory) {
608
+
609
+ }
610
+
611
+ function __wbg_finalize_init(instance, module) {
612
+ wasm = instance.exports;
613
+ __wbg_init.__wbindgen_wasm_module = module;
614
+ cachedDataViewMemory0 = null;
615
+ cachedUint8ArrayMemory0 = null;
616
+
617
+
618
+ wasm.__wbindgen_start();
619
+ return wasm;
620
+ }
621
+
622
+ function initSync(module) {
623
+ if (wasm !== undefined) return wasm;
624
+
625
+
626
+ if (typeof module !== 'undefined') {
627
+ if (Object.getPrototypeOf(module) === Object.prototype) {
628
+ ({module} = module)
629
+ } else {
630
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
631
+ }
632
+ }
633
+
634
+ const imports = __wbg_get_imports();
635
+
636
+ __wbg_init_memory(imports);
637
+
638
+ if (!(module instanceof WebAssembly.Module)) {
639
+ module = new WebAssembly.Module(module);
640
+ }
641
+
642
+ const instance = new WebAssembly.Instance(module, imports);
643
+
644
+ return __wbg_finalize_init(instance, module);
645
+ }
646
+
647
+ async function __wbg_init(module_or_path) {
648
+ if (wasm !== undefined) return wasm;
649
+
650
+
651
+ if (typeof module_or_path !== 'undefined') {
652
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
653
+ ({module_or_path} = module_or_path)
654
+ } else {
655
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
656
+ }
657
+ }
658
+
659
+ if (typeof module_or_path === 'undefined') {
660
+ module_or_path = new URL('move_bytecode_template_bg.wasm', import.meta.url);
661
+ }
662
+ const imports = __wbg_get_imports();
663
+
664
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
665
+ module_or_path = fetch(module_or_path);
666
+ }
667
+
668
+ __wbg_init_memory(imports);
669
+
670
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
671
+
672
+ return __wbg_finalize_init(instance, module);
673
+ }
674
+
675
+ export { initSync };
676
+ export default __wbg_init;
@@ -0,0 +1,18 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const version: () => [number, number];
5
+ export const deserialize: (a: number, b: number) => [number, number, number];
6
+ export const update_identifiers: (a: number, b: number, c: any) => [number, number, number, number];
7
+ export const update_constants: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
8
+ export const __wbg_constant_free: (a: number, b: number) => void;
9
+ export const get_constants: (a: number, b: number) => [number, number, number];
10
+ export const serialize: (a: any) => [number, number, number, number];
11
+ export const __wbindgen_malloc: (a: number, b: number) => number;
12
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
13
+ export const __wbindgen_exn_store: (a: number) => void;
14
+ export const __externref_table_alloc: () => number;
15
+ export const __wbindgen_export_4: WebAssembly.Table;
16
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
17
+ export const __externref_table_dealloc: (a: number) => void;
18
+ export const __wbindgen_start: () => void;