@lucid-evolution/uplc 0.4.0 → 0.5.1

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.
@@ -1,135 +1,552 @@
1
+ /* @ts-self-types="./uplc_tx.d.ts" */
1
2
 
2
- let imports = {};
3
- imports['__wbindgen_placeholder__'] = module.exports;
4
- let wasm;
5
- const { TextEncoder, TextDecoder } = require(`util`);
6
-
7
- let WASM_VECTOR_LEN = 0;
8
-
9
- let cachedUint8ArrayMemory0 = null;
10
-
11
- function getUint8ArrayMemory0() {
12
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8ArrayMemory0;
16
- }
17
-
18
- let cachedTextEncoder = new TextEncoder('utf-8');
3
+ /**
4
+ * Why the builtin given to [`eval_builtin_raw`] did not return a value: the
5
+ * codes of the result's `error_kind`.
6
+ * @enum {0 | 1 | 2 | 3}
7
+ */
8
+ const BuiltinErrorKind = Object.freeze({
9
+ /**
10
+ * The builtin returned a value.
11
+ */
12
+ Ok: 0, "0": "Ok",
13
+ /**
14
+ * The builtin is not available to Plutus V3 at the protocol version.
15
+ */
16
+ NotAvailable: 1, "1": "NotAvailable",
17
+ /**
18
+ * The builtin did not accept its arguments, which fails the application
19
+ * before it is costed.
20
+ */
21
+ RejectedArguments: 2, "2": "RejectedArguments",
22
+ /**
23
+ * The builtin failed after it was costed.
24
+ */
25
+ Failed: 3, "3": "Failed",
26
+ });
27
+ exports.BuiltinErrorKind = BuiltinErrorKind;
19
28
 
20
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
21
- ? function (arg, view) {
22
- return cachedTextEncoder.encodeInto(arg, view);
23
- }
24
- : function (arg, view) {
25
- const buf = cachedTextEncoder.encode(arg);
26
- view.set(buf);
27
- return {
28
- read: arg.length,
29
- written: buf.length
30
- };
29
+ /**
30
+ * How a value of [`eval_builtin_raw`] is encoded: the codes of its
31
+ * `arg_kinds` and of the result's `result_kind`.
32
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
33
+ */
34
+ const BuiltinValueKind = Object.freeze({
35
+ /**
36
+ * A flat-encoded program whose body is a constant,
37
+ * `(program 1.1.0 (con …))`. A result in this form is always version
38
+ * 1.1.0.
39
+ */
40
+ Flat: 0, "0": "Flat",
41
+ /**
42
+ * A BLS12-381 G1 point, as its 48-byte compressed encoding.
43
+ */
44
+ G1: 1, "1": "G1",
45
+ /**
46
+ * A BLS12-381 G2 point, as its 96-byte compressed encoding.
47
+ */
48
+ G2: 2, "2": "G2",
49
+ /**
50
+ * A list of BLS12-381 G1 points, as their compressed encodings one after
51
+ * the other.
52
+ */
53
+ G1List: 3, "3": "G1List",
54
+ /**
55
+ * A list of BLS12-381 G2 points, as their compressed encodings one after
56
+ * the other.
57
+ */
58
+ G2List: 4, "4": "G2List",
59
+ /**
60
+ * An array of BLS12-381 G1 points, as their compressed encodings one after
61
+ * the other.
62
+ */
63
+ G1Array: 5, "5": "G1Array",
64
+ /**
65
+ * An array of BLS12-381 G2 points, as their compressed encodings one after
66
+ * the other.
67
+ */
68
+ G2Array: 6, "6": "G2Array",
31
69
  });
70
+ exports.BuiltinValueKind = BuiltinValueKind;
32
71
 
33
- function passStringToWasm0(arg, malloc, realloc) {
72
+ /**
73
+ * The outcome of [`eval_builtin_raw`].
74
+ */
75
+ class EvalBuiltinResult {
76
+ static __wrap(ptr) {
77
+ const obj = Object.create(EvalBuiltinResult.prototype);
78
+ obj.__wbg_ptr = ptr;
79
+ Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
34
80
 
35
- if (realloc === undefined) {
36
- const buf = cachedTextEncoder.encode(arg);
37
- const ptr = malloc(buf.length, 1) >>> 0;
38
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
39
- WASM_VECTOR_LEN = buf.length;
81
+ EvalBuiltinResultFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
82
+ return obj;
83
+ }
84
+ __destroy_into_raw() {
85
+ const ptr = this.__wbg_ptr;
86
+ this.__wbg_ptr = 0;
87
+ EvalBuiltinResultFinalization.unregister(this);
40
88
  return ptr;
41
89
  }
90
+ free() {
91
+ const ptr = this.__destroy_into_raw();
92
+ __wbg_call_guard();
93
+ wasm.__wbg_evalbuiltinresult_free(ptr, 0);
42
94
 
43
- let len = arg.length;
44
- let ptr = malloc(len, 1) >>> 0;
45
-
46
- const mem = getUint8ArrayMemory0();
47
-
48
- let offset = 0;
49
-
50
- for (; offset < len; offset++) {
51
- const code = arg.charCodeAt(offset);
52
- if (code > 0x7F) break;
53
- mem[ptr + offset] = code;
54
95
  }
55
-
56
- if (offset !== len) {
57
- if (offset !== 0) {
58
- arg = arg.slice(offset);
96
+ /**
97
+ * The CPU the builtin's cost model charges for this application, under
98
+ * Plutus' default cost model for Plutus V3 at the protocol version; 0
99
+ * when the builtin was not costed (error kinds 1 and 2). It leaves out the
100
+ * machine's own step costs for evaluating the application (the builtin,
101
+ * each force and each apply).
102
+ * @returns {bigint}
103
+ */
104
+ get cpu() {
105
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
106
+ throw new Error('Invalid stale object from previous Wasm instance');
59
107
  }
60
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
61
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
62
- const ret = encodeString(arg, view);
63
-
64
- offset += ret.written;
65
- ptr = realloc(ptr, len, offset, 1) >>> 0;
108
+ let ret;
109
+ __wbg_call_guard();
110
+ ret = wasm.__wbg_get_evalbuiltinresult_cpu(this.__wbg_ptr);
111
+ return BigInt.asUintN(64, ret);
66
112
  }
67
-
68
- WASM_VECTOR_LEN = offset;
69
- return ptr;
70
- }
71
-
72
- function isLikeNone(x) {
73
- return x === undefined || x === null;
74
- }
75
-
76
- let cachedDataViewMemory0 = null;
77
-
78
- function getDataViewMemory0() {
79
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
80
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
113
+ /**
114
+ * Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
115
+ * it did, 1 when it is not available to Plutus V3 at the protocol version,
116
+ * 2 when it did not accept its arguments (so the machine fails before
117
+ * costing it) and 3 when it failed after being costed.
118
+ * @returns {number}
119
+ */
120
+ get error_kind() {
121
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
122
+ throw new Error('Invalid stale object from previous Wasm instance');
123
+ }
124
+ let ret;
125
+ __wbg_call_guard();
126
+ ret = wasm.__wbg_get_evalbuiltinresult_error_kind(this.__wbg_ptr);
127
+ return ret;
128
+ }
129
+ /**
130
+ * The evaluator's description of why the builtin did not return a value;
131
+ * empty when it did.
132
+ * @returns {string}
133
+ */
134
+ get error() {
135
+ let deferred1_0;
136
+ let deferred1_1;
137
+ try {
138
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
139
+ throw new Error('Invalid stale object from previous Wasm instance');
140
+ }
141
+ let ret;
142
+ __wbg_call_guard();
143
+ ret = wasm.__wbg_get_evalbuiltinresult_error(this.__wbg_ptr);
144
+ deferred1_0 = ret[0];
145
+ deferred1_1 = ret[1];
146
+ return getStringFromWasm0(ret[0], ret[1]);
147
+ } finally {
148
+ __wbg_call_guard();
149
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
150
+ }
151
+ }
152
+ /**
153
+ * The memory the builtin's cost model charges for this application; see
154
+ * `cpu`.
155
+ * @returns {bigint}
156
+ */
157
+ get mem() {
158
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
159
+ throw new Error('Invalid stale object from previous Wasm instance');
160
+ }
161
+ let ret;
162
+ __wbg_call_guard();
163
+ ret = wasm.__wbg_get_evalbuiltinresult_mem(this.__wbg_ptr);
164
+ return BigInt.asUintN(64, ret);
165
+ }
166
+ /**
167
+ * Whether the builtin returned a value.
168
+ * @returns {boolean}
169
+ */
170
+ get ok() {
171
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
172
+ throw new Error('Invalid stale object from previous Wasm instance');
173
+ }
174
+ let ret;
175
+ __wbg_call_guard();
176
+ ret = wasm.__wbg_get_evalbuiltinresult_ok(this.__wbg_ptr);
177
+ return ret !== 0;
178
+ }
179
+ /**
180
+ * How `result` encodes the value, a [`BuiltinValueKind`] as for the
181
+ * arguments of [`eval_builtin_raw`]; 0 when there is no value.
182
+ * @returns {number}
183
+ */
184
+ get result_kind() {
185
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
186
+ throw new Error('Invalid stale object from previous Wasm instance');
187
+ }
188
+ let ret;
189
+ __wbg_call_guard();
190
+ ret = wasm.__wbg_get_evalbuiltinresult_result_kind(this.__wbg_ptr);
191
+ return ret;
192
+ }
193
+ /**
194
+ * The value the builtin returned; empty when there is none.
195
+ * @returns {Uint8Array}
196
+ */
197
+ get result() {
198
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
199
+ throw new Error('Invalid stale object from previous Wasm instance');
200
+ }
201
+ let ret;
202
+ __wbg_call_guard();
203
+ ret = wasm.__wbg_get_evalbuiltinresult_result(this.__wbg_ptr);
204
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
205
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
206
+ return v1;
207
+ }
208
+ /**
209
+ * The CPU the builtin's cost model charges for this application, under
210
+ * Plutus' default cost model for Plutus V3 at the protocol version; 0
211
+ * when the builtin was not costed (error kinds 1 and 2). It leaves out the
212
+ * machine's own step costs for evaluating the application (the builtin,
213
+ * each force and each apply).
214
+ * @param {bigint} arg0
215
+ */
216
+ set cpu(arg0) {
217
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
218
+ throw new Error('Invalid stale object from previous Wasm instance');
219
+ }
220
+ __wbg_call_guard();
221
+ wasm.__wbg_set_evalbuiltinresult_cpu(this.__wbg_ptr, arg0);
222
+ }
223
+ /**
224
+ * Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
225
+ * it did, 1 when it is not available to Plutus V3 at the protocol version,
226
+ * 2 when it did not accept its arguments (so the machine fails before
227
+ * costing it) and 3 when it failed after being costed.
228
+ * @param {number} arg0
229
+ */
230
+ set error_kind(arg0) {
231
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
232
+ throw new Error('Invalid stale object from previous Wasm instance');
233
+ }
234
+ __wbg_call_guard();
235
+ wasm.__wbg_set_evalbuiltinresult_error_kind(this.__wbg_ptr, arg0);
236
+ }
237
+ /**
238
+ * The evaluator's description of why the builtin did not return a value;
239
+ * empty when it did.
240
+ * @param {string} arg0
241
+ */
242
+ set error(arg0) {
243
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
244
+ throw new Error('Invalid stale object from previous Wasm instance');
245
+ }
246
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
247
+ const len0 = WASM_VECTOR_LEN;
248
+ __wbg_call_guard();
249
+ wasm.__wbg_set_evalbuiltinresult_error(this.__wbg_ptr, ptr0, len0);
250
+ }
251
+ /**
252
+ * The memory the builtin's cost model charges for this application; see
253
+ * `cpu`.
254
+ * @param {bigint} arg0
255
+ */
256
+ set mem(arg0) {
257
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
258
+ throw new Error('Invalid stale object from previous Wasm instance');
259
+ }
260
+ __wbg_call_guard();
261
+ wasm.__wbg_set_evalbuiltinresult_mem(this.__wbg_ptr, arg0);
262
+ }
263
+ /**
264
+ * Whether the builtin returned a value.
265
+ * @param {boolean} arg0
266
+ */
267
+ set ok(arg0) {
268
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
269
+ throw new Error('Invalid stale object from previous Wasm instance');
270
+ }
271
+ __wbg_call_guard();
272
+ wasm.__wbg_set_evalbuiltinresult_ok(this.__wbg_ptr, arg0);
273
+ }
274
+ /**
275
+ * How `result` encodes the value, a [`BuiltinValueKind`] as for the
276
+ * arguments of [`eval_builtin_raw`]; 0 when there is no value.
277
+ * @param {number} arg0
278
+ */
279
+ set result_kind(arg0) {
280
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
281
+ throw new Error('Invalid stale object from previous Wasm instance');
282
+ }
283
+ __wbg_call_guard();
284
+ wasm.__wbg_set_evalbuiltinresult_result_kind(this.__wbg_ptr, arg0);
285
+ }
286
+ /**
287
+ * The value the builtin returned; empty when there is none.
288
+ * @param {Uint8Array} arg0
289
+ */
290
+ set result(arg0) {
291
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
292
+ throw new Error('Invalid stale object from previous Wasm instance');
293
+ }
294
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ __wbg_call_guard();
297
+ wasm.__wbg_set_evalbuiltinresult_result(this.__wbg_ptr, ptr0, len0);
81
298
  }
82
- return cachedDataViewMemory0;
83
299
  }
300
+ if (Symbol.dispose) EvalBuiltinResult.prototype[Symbol.dispose] = EvalBuiltinResult.prototype.free;
301
+ exports.EvalBuiltinResult = EvalBuiltinResult;
84
302
 
85
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
86
-
87
- cachedTextDecoder.decode();
303
+ /**
304
+ * The outcome of [`eval_program_raw`].
305
+ */
306
+ class EvalProgramResult {
307
+ static __wrap(ptr) {
308
+ const obj = Object.create(EvalProgramResult.prototype);
309
+ obj.__wbg_ptr = ptr;
310
+ Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
88
311
 
89
- function getStringFromWasm0(ptr, len) {
90
- ptr = ptr >>> 0;
91
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
92
- }
312
+ EvalProgramResultFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
313
+ return obj;
314
+ }
315
+ __destroy_into_raw() {
316
+ const ptr = this.__wbg_ptr;
317
+ this.__wbg_ptr = 0;
318
+ EvalProgramResultFinalization.unregister(this);
319
+ return ptr;
320
+ }
321
+ free() {
322
+ const ptr = this.__destroy_into_raw();
323
+ __wbg_call_guard();
324
+ wasm.__wbg_evalprogramresult_free(ptr, 0);
93
325
 
94
- function passArray8ToWasm0(arg, malloc) {
95
- const ptr = malloc(arg.length * 1, 1) >>> 0;
96
- getUint8ArrayMemory0().set(arg, ptr / 1);
97
- WASM_VECTOR_LEN = arg.length;
98
- return ptr;
326
+ }
327
+ /**
328
+ * The CPU the program used. A program that went over budget is charged
329
+ * what it used up to the point where the machine stopped it.
330
+ * @returns {bigint}
331
+ */
332
+ get cpu() {
333
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
334
+ throw new Error('Invalid stale object from previous Wasm instance');
335
+ }
336
+ let ret;
337
+ __wbg_call_guard();
338
+ ret = wasm.__wbg_get_evalprogramresult_cpu(this.__wbg_ptr);
339
+ return BigInt.asUintN(64, ret);
340
+ }
341
+ /**
342
+ * Why the program did not succeed: 0 when it did, 1 when it went over
343
+ * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
344
+ * returned something other than unit.
345
+ * @returns {number}
346
+ */
347
+ get error_kind() {
348
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
349
+ throw new Error('Invalid stale object from previous Wasm instance');
350
+ }
351
+ let ret;
352
+ __wbg_call_guard();
353
+ ret = wasm.__wbg_get_evalprogramresult_error_kind(this.__wbg_ptr);
354
+ return ret;
355
+ }
356
+ /**
357
+ * The messages the program traced, in order.
358
+ * @returns {string[]}
359
+ */
360
+ get logs() {
361
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
362
+ throw new Error('Invalid stale object from previous Wasm instance');
363
+ }
364
+ let ret;
365
+ __wbg_call_guard();
366
+ ret = wasm.__wbg_get_evalprogramresult_logs(this.__wbg_ptr);
367
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
368
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
369
+ return v1;
370
+ }
371
+ /**
372
+ * The memory the program used.
373
+ * @returns {bigint}
374
+ */
375
+ get mem() {
376
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
377
+ throw new Error('Invalid stale object from previous Wasm instance');
378
+ }
379
+ let ret;
380
+ __wbg_call_guard();
381
+ ret = wasm.__wbg_get_evalprogramresult_mem(this.__wbg_ptr);
382
+ return BigInt.asUintN(64, ret);
383
+ }
384
+ /**
385
+ * Whether the program succeeded: it did not fail and, for Plutus V3, it
386
+ * returned unit.
387
+ * @returns {boolean}
388
+ */
389
+ get ok() {
390
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
391
+ throw new Error('Invalid stale object from previous Wasm instance');
392
+ }
393
+ let ret;
394
+ __wbg_call_guard();
395
+ ret = wasm.__wbg_get_evalprogramresult_ok(this.__wbg_ptr);
396
+ return ret !== 0;
397
+ }
398
+ /**
399
+ * The CPU the program used. A program that went over budget is charged
400
+ * what it used up to the point where the machine stopped it.
401
+ * @param {bigint} arg0
402
+ */
403
+ set cpu(arg0) {
404
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
405
+ throw new Error('Invalid stale object from previous Wasm instance');
406
+ }
407
+ __wbg_call_guard();
408
+ wasm.__wbg_set_evalprogramresult_cpu(this.__wbg_ptr, arg0);
409
+ }
410
+ /**
411
+ * Why the program did not succeed: 0 when it did, 1 when it went over
412
+ * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
413
+ * returned something other than unit.
414
+ * @param {number} arg0
415
+ */
416
+ set error_kind(arg0) {
417
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
418
+ throw new Error('Invalid stale object from previous Wasm instance');
419
+ }
420
+ __wbg_call_guard();
421
+ wasm.__wbg_set_evalprogramresult_error_kind(this.__wbg_ptr, arg0);
422
+ }
423
+ /**
424
+ * The messages the program traced, in order.
425
+ * @param {string[]} arg0
426
+ */
427
+ set logs(arg0) {
428
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
429
+ throw new Error('Invalid stale object from previous Wasm instance');
430
+ }
431
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
432
+ const len0 = WASM_VECTOR_LEN;
433
+ __wbg_call_guard();
434
+ wasm.__wbg_set_evalprogramresult_logs(this.__wbg_ptr, ptr0, len0);
435
+ }
436
+ /**
437
+ * The memory the program used.
438
+ * @param {bigint} arg0
439
+ */
440
+ set mem(arg0) {
441
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
442
+ throw new Error('Invalid stale object from previous Wasm instance');
443
+ }
444
+ __wbg_call_guard();
445
+ wasm.__wbg_set_evalprogramresult_mem(this.__wbg_ptr, arg0);
446
+ }
447
+ /**
448
+ * Whether the program succeeded: it did not fail and, for Plutus V3, it
449
+ * returned unit.
450
+ * @param {boolean} arg0
451
+ */
452
+ set ok(arg0) {
453
+ if (this.__wbg_inst !== undefined && this.__wbg_inst !== __wbg_instance_id) {
454
+ throw new Error('Invalid stale object from previous Wasm instance');
455
+ }
456
+ __wbg_call_guard();
457
+ wasm.__wbg_set_evalprogramresult_ok(this.__wbg_ptr, arg0);
458
+ }
99
459
  }
100
-
101
- function addToExternrefTable0(obj) {
102
- const idx = wasm.__externref_table_alloc();
103
- wasm.__wbindgen_export_0.set(idx, obj);
104
- return idx;
460
+ if (Symbol.dispose) EvalProgramResult.prototype[Symbol.dispose] = EvalProgramResult.prototype.free;
461
+ exports.EvalProgramResult = EvalProgramResult;
462
+
463
+ function __wbg_reset_state () {
464
+ __wbg_instance_id++;
465
+ cachedBigUint64ArrayMemory0 = null;
466
+ cachedDataViewMemory0 = null;
467
+ cachedUint8ArrayMemory0 = null;
468
+ if (typeof numBytesDecoded !== 'undefined') numBytesDecoded = 0;
469
+ if (typeof WASM_VECTOR_LEN !== 'undefined') WASM_VECTOR_LEN = 0;
470
+ __wbg_reinit_scheduled = false;
471
+ wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
472
+ wasm = wasmInstance.exports;
473
+ wasm.__wbindgen_start();
105
474
  }
475
+ exports.__wbg_reset_state = __wbg_reset_state;
106
476
 
107
- function passArrayJsValueToWasm0(array, malloc) {
108
- const ptr = malloc(array.length * 4, 4) >>> 0;
109
- for (let i = 0; i < array.length; i++) {
110
- const add = addToExternrefTable0(array[i]);
111
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
477
+ /**
478
+ * @param {Uint8Array} params_bytes
479
+ * @param {Uint8Array} plutus_script_bytes
480
+ * @returns {Uint8Array}
481
+ */
482
+ function apply_params_to_script(params_bytes, plutus_script_bytes) {
483
+ const ptr0 = passArray8ToWasm0(params_bytes, wasm.__wbindgen_malloc);
484
+ const len0 = WASM_VECTOR_LEN;
485
+ const ptr1 = passArray8ToWasm0(plutus_script_bytes, wasm.__wbindgen_malloc);
486
+ const len1 = WASM_VECTOR_LEN;
487
+ let ret;
488
+ __wbg_call_guard();
489
+ ret = wasm.apply_params_to_script(ptr0, len0, ptr1, len1);
490
+ if (ret[3]) {
491
+ throw takeFromExternrefTable0(ret[2]);
112
492
  }
113
- WASM_VECTOR_LEN = array.length;
114
- return ptr;
115
- }
116
-
117
- function takeFromExternrefTable0(idx) {
118
- const value = wasm.__wbindgen_export_0.get(idx);
119
- wasm.__externref_table_dealloc(idx);
120
- return value;
493
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
494
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
495
+ return v3;
121
496
  }
497
+ exports.apply_params_to_script = apply_params_to_script;
122
498
 
123
- function getArrayJsValueFromWasm0(ptr, len) {
124
- ptr = ptr >>> 0;
125
- const mem = getDataViewMemory0();
126
- const result = [];
127
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
128
- result.push(wasm.__wbindgen_export_0.get(mem.getUint32(i, true)));
499
+ /**
500
+ * Evaluates the builtin `tag` applied to `args` as a Plutus V3 script
501
+ * evaluates it at a protocol version, without any program around it: the
502
+ * result, or how it fails, is what the machine gives for the saturated
503
+ * application.
504
+ *
505
+ * - `tag`: the builtin's flat tag (0 for addInteger to 100 for scaleValue).
506
+ * The Miller-loop builtins (68 to 70) are not supported, since their
507
+ * results cannot be returned.
508
+ * - `args`: exactly the builtin's arguments, in order, each encoded as the
509
+ * matching entry of `arg_kinds` says, a [`BuiltinValueKind`]: 0 for a
510
+ * flat-encoded `(program 1.1.0 (con …))`, 1 for a compressed G1 point, 2
511
+ * for a compressed G2 point, 3 for a list of G1 points, 4 for a list of G2
512
+ * points, 5 for an array of G1 points and 6 for an array of G2 points, each
513
+ * list or array as the compressed points one after the other. Flat cannot
514
+ * encode BLS12-381 points, so they cross as their compressed bytes.
515
+ * - `protocol_major_version`: from 9 (Chang, which introduced Plutus V3) to
516
+ * 12 (Dijkstra). It decides which builtins are available and the semantics
517
+ * they have.
518
+ *
519
+ * The result's `cpu` and `mem` are the builtin's charge for the application
520
+ * under Plutus' default Plutus V3 cost model (not the ledger's protocol
521
+ * parameters), excluding the machine's per-step costs.
522
+ *
523
+ * Fails only when the inputs are malformed or unsupported: an unknown or
524
+ * Miller-loop tag, a number of arguments other than the builtin's arity, an
525
+ * argument that does not decode as its kind says or is not a constant, an
526
+ * invalid compressed point, a protocol version out of range, or a result that
527
+ * none of the kinds can encode. A builtin that fails is an
528
+ * [`EvalBuiltinResult`] that is not `ok`.
529
+ * @param {number} tag
530
+ * @param {Uint8Array[]} args
531
+ * @param {Uint8Array} arg_kinds
532
+ * @param {number} protocol_major_version
533
+ * @returns {EvalBuiltinResult}
534
+ */
535
+ function eval_builtin_raw(tag, args, arg_kinds, protocol_major_version) {
536
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
537
+ const len0 = WASM_VECTOR_LEN;
538
+ const ptr1 = passArray8ToWasm0(arg_kinds, wasm.__wbindgen_malloc);
539
+ const len1 = WASM_VECTOR_LEN;
540
+ let ret;
541
+ __wbg_call_guard();
542
+ ret = wasm.eval_builtin_raw(tag, ptr0, len0, ptr1, len1, protocol_major_version);
543
+ if (ret[2]) {
544
+ throw takeFromExternrefTable0(ret[1]);
129
545
  }
130
- wasm.__externref_drop_slice(ptr, len);
131
- return result;
546
+ return EvalBuiltinResult.__wrap(ret[0]);
132
547
  }
548
+ exports.eval_builtin_raw = eval_builtin_raw;
549
+
133
550
  /**
134
551
  * @param {Uint8Array} tx_bytes
135
552
  * @param {Uint8Array[]} utxos_bytes_x
@@ -138,67 +555,32 @@ function getArrayJsValueFromWasm0(ptr, len) {
138
555
  * @param {bigint} initial_budget_n
139
556
  * @param {bigint} initial_budget_d
140
557
  * @param {bigint} slot_config_x
141
- * @param {bigint} slot_config_y
142
- * @param {number} slot_config_z
143
- * @param {number | null} [protocol_major_version]
144
- * @returns {Uint8Array[]}
145
- */
146
- module.exports.eval_phase_two_raw = function(tx_bytes, utxos_bytes_x, utxos_bytes_y, cost_mdls_bytes, initial_budget_n, initial_budget_d, slot_config_x, slot_config_y, slot_config_z, protocol_major_version) {
147
- const ptr0 = passArray8ToWasm0(tx_bytes, wasm.__wbindgen_malloc);
148
- const len0 = WASM_VECTOR_LEN;
149
- const ptr1 = passArrayJsValueToWasm0(utxos_bytes_x, wasm.__wbindgen_malloc);
150
- const len1 = WASM_VECTOR_LEN;
151
- const ptr2 = passArrayJsValueToWasm0(utxos_bytes_y, wasm.__wbindgen_malloc);
152
- const len2 = WASM_VECTOR_LEN;
153
- const ptr3 = passArray8ToWasm0(cost_mdls_bytes, wasm.__wbindgen_malloc);
154
- const len3 = WASM_VECTOR_LEN;
155
- const ret = wasm.eval_phase_two_raw(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, initial_budget_n, initial_budget_d, slot_config_x, slot_config_y, slot_config_z, !isLikeNone(protocol_major_version), isLikeNone(protocol_major_version) ? 0 : protocol_major_version);
156
- if (ret[3]) {
157
- throw takeFromExternrefTable0(ret[2]);
158
- }
159
- var v5 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
160
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
161
- return v5;
162
- };
163
-
164
- function getArrayU8FromWasm0(ptr, len) {
165
- ptr = ptr >>> 0;
166
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
167
- }
168
- /**
169
- * @param {Uint8Array} params_bytes
170
- * @param {Uint8Array} plutus_script_bytes
171
- * @returns {Uint8Array}
558
+ * @param {bigint} slot_config_y
559
+ * @param {number} slot_config_z
560
+ * @param {number | null} [protocol_major_version]
561
+ * @returns {Uint8Array[]}
172
562
  */
173
- module.exports.apply_params_to_script = function(params_bytes, plutus_script_bytes) {
174
- const ptr0 = passArray8ToWasm0(params_bytes, wasm.__wbindgen_malloc);
563
+ function eval_phase_two_raw(tx_bytes, utxos_bytes_x, utxos_bytes_y, cost_mdls_bytes, initial_budget_n, initial_budget_d, slot_config_x, slot_config_y, slot_config_z, protocol_major_version) {
564
+ const ptr0 = passArray8ToWasm0(tx_bytes, wasm.__wbindgen_malloc);
175
565
  const len0 = WASM_VECTOR_LEN;
176
- const ptr1 = passArray8ToWasm0(plutus_script_bytes, wasm.__wbindgen_malloc);
566
+ const ptr1 = passArrayJsValueToWasm0(utxos_bytes_x, wasm.__wbindgen_malloc);
177
567
  const len1 = WASM_VECTOR_LEN;
178
- const ret = wasm.apply_params_to_script(ptr0, len0, ptr1, len1);
568
+ const ptr2 = passArrayJsValueToWasm0(utxos_bytes_y, wasm.__wbindgen_malloc);
569
+ const len2 = WASM_VECTOR_LEN;
570
+ const ptr3 = passArray8ToWasm0(cost_mdls_bytes, wasm.__wbindgen_malloc);
571
+ const len3 = WASM_VECTOR_LEN;
572
+ let ret;
573
+ __wbg_call_guard();
574
+ ret = wasm.eval_phase_two_raw(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, initial_budget_n, initial_budget_d, slot_config_x, slot_config_y, slot_config_z, !isLikeNone(protocol_major_version), isLikeNone(protocol_major_version) ? 0 : protocol_major_version);
179
575
  if (ret[3]) {
180
576
  throw takeFromExternrefTable0(ret[2]);
181
577
  }
182
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
183
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
184
- return v3;
185
- };
186
-
187
- let cachedBigUint64ArrayMemory0 = null;
188
-
189
- function getBigUint64ArrayMemory0() {
190
- if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
191
- cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
192
- }
193
- return cachedBigUint64ArrayMemory0;
578
+ var v5 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
579
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
580
+ return v5;
194
581
  }
582
+ exports.eval_phase_two_raw = eval_phase_two_raw;
195
583
 
196
- function passArray64ToWasm0(arg, malloc) {
197
- const ptr = malloc(arg.length * 8, 8) >>> 0;
198
- getBigUint64ArrayMemory0().set(arg, ptr / 8);
199
- WASM_VECTOR_LEN = arg.length;
200
- return ptr;
201
- }
202
584
  /**
203
585
  * Evaluates a UPLC program applied to Data arguments, outside of any
204
586
  * transaction: the caller builds whatever arguments the program expects,
@@ -230,19 +612,22 @@ function passArray64ToWasm0(arg, malloc) {
230
612
  * @param {boolean} strict_budget
231
613
  * @returns {EvalProgramResult}
232
614
  */
233
- module.exports.eval_program_raw = function(program_flat, args_cbor, language, protocol_major_version, cost_model, budget_cpu, budget_mem, strict_budget) {
615
+ function eval_program_raw(program_flat, args_cbor, language, protocol_major_version, cost_model, budget_cpu, budget_mem, strict_budget) {
234
616
  const ptr0 = passArray8ToWasm0(program_flat, wasm.__wbindgen_malloc);
235
617
  const len0 = WASM_VECTOR_LEN;
236
618
  const ptr1 = passArrayJsValueToWasm0(args_cbor, wasm.__wbindgen_malloc);
237
619
  const len1 = WASM_VECTOR_LEN;
238
620
  const ptr2 = passArray64ToWasm0(cost_model, wasm.__wbindgen_malloc);
239
621
  const len2 = WASM_VECTOR_LEN;
240
- const ret = wasm.eval_program_raw(ptr0, len0, ptr1, len1, language, protocol_major_version, ptr2, len2, budget_cpu, budget_mem, strict_budget);
622
+ let ret;
623
+ __wbg_call_guard();
624
+ ret = wasm.eval_program_raw(ptr0, len0, ptr1, len1, language, protocol_major_version, ptr2, len2, budget_cpu, budget_mem, strict_budget);
241
625
  if (ret[2]) {
242
626
  throw takeFromExternrefTable0(ret[1]);
243
627
  }
244
628
  return EvalProgramResult.__wrap(ret[0]);
245
- };
629
+ }
630
+ exports.eval_program_raw = eval_program_raw;
246
631
 
247
632
  /**
248
633
  * Describes this build of the evaluator as JSON: the uplc crate it was built
@@ -252,201 +637,235 @@ module.exports.eval_program_raw = function(program_flat, args_cbor, language, pr
252
637
  * programs; `selfTest` says whether this one gives the expected results.
253
638
  * @returns {string}
254
639
  */
255
- module.exports.uplc_build_info = function() {
640
+ function uplc_build_info() {
256
641
  let deferred1_0;
257
642
  let deferred1_1;
258
643
  try {
259
- const ret = wasm.uplc_build_info();
644
+ let ret;
645
+ __wbg_call_guard();
646
+ ret = wasm.uplc_build_info();
260
647
  deferred1_0 = ret[0];
261
648
  deferred1_1 = ret[1];
262
649
  return getStringFromWasm0(ret[0], ret[1]);
263
650
  } finally {
651
+ __wbg_call_guard();
264
652
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
265
653
  }
266
- };
654
+ }
655
+ exports.uplc_build_info = uplc_build_info;
656
+ function __wbg_get_imports() {
657
+ const import0 = {
658
+ __proto__: null,
659
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
660
+ const obj = arg1;
661
+ const ret = typeof(obj) === 'string' ? obj : undefined;
662
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
663
+ var len1 = WASM_VECTOR_LEN;
664
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
665
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
666
+ },
667
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
668
+ throw new Error(getStringFromWasm0(arg0, arg1));
669
+ },
670
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
671
+ const ret = arg0.length;
672
+ return ret;
673
+ },
674
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
675
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
676
+ return ret;
677
+ },
678
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
679
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
680
+ },
681
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
682
+ // Cast intrinsic for `Ref(String) -> Externref`.
683
+ const ret = getStringFromWasm0(arg0, arg1);
684
+ return ret;
685
+ },
686
+ __wbindgen_init_externref_table: function() {
687
+ const table = wasm.__wbindgen_externrefs;
688
+ const offset = table.grow(4);
689
+ table.set(0, undefined);
690
+ table.set(offset + 0, undefined);
691
+ table.set(offset + 1, null);
692
+ table.set(offset + 2, true);
693
+ table.set(offset + 3, false);
694
+ },
695
+ };
696
+ return {
697
+ __proto__: null,
698
+ "./uplc_tx_bg.js": import0,
699
+ };
700
+ }
701
+
702
+ function __wbg_call_guard() {
703
+ if (__wbg_reinit_scheduled) {
704
+ __wbg_reset_state();
705
+ return;
706
+ }
707
+ }
708
+
267
709
 
710
+ let __wbg_instance_id = 0;
711
+ const EvalBuiltinResultFinalization = (typeof FinalizationRegistry === 'undefined')
712
+ ? { register: () => {}, unregister: () => {} }
713
+ : new FinalizationRegistry(({ ptr, instance }) => {
714
+ if (instance === __wbg_instance_id) wasm.__wbg_evalbuiltinresult_free(ptr, 1);
715
+ });
268
716
  const EvalProgramResultFinalization = (typeof FinalizationRegistry === 'undefined')
269
717
  ? { register: () => {}, unregister: () => {} }
270
- : new FinalizationRegistry(ptr => wasm.__wbg_evalprogramresult_free(ptr >>> 0, 1));
271
- /**
272
- * The outcome of [`eval_program_raw`].
273
- */
274
- class EvalProgramResult {
718
+ : new FinalizationRegistry(({ ptr, instance }) => {
719
+ if (instance === __wbg_instance_id) wasm.__wbg_evalprogramresult_free(ptr, 1);
720
+ });
275
721
 
276
- static __wrap(ptr) {
277
- ptr = ptr >>> 0;
278
- const obj = Object.create(EvalProgramResult.prototype);
279
- obj.__wbg_ptr = ptr;
280
- EvalProgramResultFinalization.register(obj, obj.__wbg_ptr, obj);
281
- return obj;
282
- }
722
+ function addToExternrefTable0(obj) {
723
+ const idx = wasm.__externref_table_alloc();
724
+ wasm.__wbindgen_externrefs.set(idx, obj);
725
+ return idx;
726
+ }
283
727
 
284
- __destroy_into_raw() {
285
- const ptr = this.__wbg_ptr;
286
- this.__wbg_ptr = 0;
287
- EvalProgramResultFinalization.unregister(this);
288
- return ptr;
728
+ function getArrayJsValueFromWasm0(ptr, len) {
729
+ ptr = ptr >>> 0;
730
+ const mem = getDataViewMemory0();
731
+ const result = [];
732
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
733
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
289
734
  }
735
+ wasm.__externref_drop_slice(ptr, len);
736
+ return result;
737
+ }
290
738
 
291
- free() {
292
- const ptr = this.__destroy_into_raw();
293
- wasm.__wbg_evalprogramresult_free(ptr, 0);
294
- }
295
- /**
296
- * Whether the program succeeded: it did not fail and, for Plutus V3, it
297
- * returned unit.
298
- * @returns {boolean}
299
- */
300
- get ok() {
301
- const ret = wasm.__wbg_get_evalprogramresult_ok(this.__wbg_ptr);
302
- return ret !== 0;
303
- }
304
- /**
305
- * Whether the program succeeded: it did not fail and, for Plutus V3, it
306
- * returned unit.
307
- * @param {boolean} arg0
308
- */
309
- set ok(arg0) {
310
- wasm.__wbg_set_evalprogramresult_ok(this.__wbg_ptr, arg0);
311
- }
312
- /**
313
- * The CPU the program used. A program that went over budget is charged
314
- * what it used up to the point where the machine stopped it.
315
- * @returns {bigint}
316
- */
317
- get cpu() {
318
- const ret = wasm.__wbg_get_evalprogramresult_cpu(this.__wbg_ptr);
319
- return BigInt.asUintN(64, ret);
320
- }
321
- /**
322
- * The CPU the program used. A program that went over budget is charged
323
- * what it used up to the point where the machine stopped it.
324
- * @param {bigint} arg0
325
- */
326
- set cpu(arg0) {
327
- wasm.__wbg_set_evalprogramresult_cpu(this.__wbg_ptr, arg0);
739
+ function getArrayU8FromWasm0(ptr, len) {
740
+ ptr = ptr >>> 0;
741
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
742
+ }
743
+
744
+ let cachedBigUint64ArrayMemory0 = null;
745
+ function getBigUint64ArrayMemory0() {
746
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
747
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
328
748
  }
329
- /**
330
- * The memory the program used.
331
- * @returns {bigint}
332
- */
333
- get mem() {
334
- const ret = wasm.__wbg_get_evalprogramresult_mem(this.__wbg_ptr);
335
- return BigInt.asUintN(64, ret);
749
+ return cachedBigUint64ArrayMemory0;
750
+ }
751
+
752
+ let cachedDataViewMemory0 = null;
753
+ function getDataViewMemory0() {
754
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
755
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
336
756
  }
337
- /**
338
- * The memory the program used.
339
- * @param {bigint} arg0
340
- */
341
- set mem(arg0) {
342
- wasm.__wbg_set_evalprogramresult_mem(this.__wbg_ptr, arg0);
757
+ return cachedDataViewMemory0;
758
+ }
759
+
760
+ function getStringFromWasm0(ptr, len) {
761
+ return decodeText(ptr >>> 0, len);
762
+ }
763
+
764
+ let cachedUint8ArrayMemory0 = null;
765
+ function getUint8ArrayMemory0() {
766
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
767
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
343
768
  }
344
- /**
345
- * Why the program did not succeed: 0 when it did, 1 when it went over
346
- * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
347
- * returned something other than unit.
348
- * @returns {number}
349
- */
350
- get error_kind() {
351
- const ret = wasm.__wbg_get_evalprogramresult_error_kind(this.__wbg_ptr);
352
- return ret;
769
+ return cachedUint8ArrayMemory0;
770
+ }
771
+
772
+ function isLikeNone(x) {
773
+ return x === undefined || x === null;
774
+ }
775
+
776
+ function passArray64ToWasm0(arg, malloc) {
777
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
778
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
779
+ WASM_VECTOR_LEN = arg.length;
780
+ return ptr;
781
+ }
782
+
783
+ function passArray8ToWasm0(arg, malloc) {
784
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
785
+ getUint8ArrayMemory0().set(arg, ptr / 1);
786
+ WASM_VECTOR_LEN = arg.length;
787
+ return ptr;
788
+ }
789
+
790
+ function passArrayJsValueToWasm0(array, malloc) {
791
+ const ptr = malloc(array.length * 4, 4) >>> 0;
792
+ for (let i = 0; i < array.length; i++) {
793
+ const add = addToExternrefTable0(array[i]);
794
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
353
795
  }
354
- /**
355
- * Why the program did not succeed: 0 when it did, 1 when it went over
356
- * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
357
- * returned something other than unit.
358
- * @param {number} arg0
359
- */
360
- set error_kind(arg0) {
361
- wasm.__wbg_set_evalprogramresult_error_kind(this.__wbg_ptr, arg0);
796
+ WASM_VECTOR_LEN = array.length;
797
+ return ptr;
798
+ }
799
+
800
+ function passStringToWasm0(arg, malloc, realloc) {
801
+ if (realloc === undefined) {
802
+ const buf = cachedTextEncoder.encode(arg);
803
+ const ptr = malloc(buf.length, 1) >>> 0;
804
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
805
+ WASM_VECTOR_LEN = buf.length;
806
+ return ptr;
362
807
  }
363
- /**
364
- * The messages the program traced, in order.
365
- * @returns {string[]}
366
- */
367
- get logs() {
368
- const ret = wasm.__wbg_get_evalprogramresult_logs(this.__wbg_ptr);
369
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
370
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
371
- return v1;
808
+
809
+ let len = arg.length;
810
+ let ptr = malloc(len, 1) >>> 0;
811
+
812
+ const mem = getUint8ArrayMemory0();
813
+
814
+ let offset = 0;
815
+
816
+ for (; offset < len; offset++) {
817
+ const code = arg.charCodeAt(offset);
818
+ if (code > 0x7F) break;
819
+ mem[ptr + offset] = code;
372
820
  }
373
- /**
374
- * The messages the program traced, in order.
375
- * @param {string[]} arg0
376
- */
377
- set logs(arg0) {
378
- const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
379
- const len0 = WASM_VECTOR_LEN;
380
- wasm.__wbg_set_evalprogramresult_logs(this.__wbg_ptr, ptr0, len0);
821
+ if (offset !== len) {
822
+ if (offset !== 0) {
823
+ arg = arg.slice(offset);
824
+ }
825
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
826
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
827
+ const ret = cachedTextEncoder.encodeInto(arg, view);
828
+
829
+ offset += ret.written;
830
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
381
831
  }
832
+
833
+ WASM_VECTOR_LEN = offset;
834
+ return ptr;
382
835
  }
383
- module.exports.EvalProgramResult = EvalProgramResult;
384
-
385
- module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
386
- const ret = arg0.buffer;
387
- return ret;
388
- };
389
-
390
- module.exports.__wbg_length_a446193dc22c12f8 = function(arg0) {
391
- const ret = arg0.length;
392
- return ret;
393
- };
394
-
395
- module.exports.__wbg_new_a12002a7f91c75be = function(arg0) {
396
- const ret = new Uint8Array(arg0);
397
- return ret;
398
- };
399
-
400
- module.exports.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
401
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
402
- return ret;
403
- };
404
-
405
- module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
406
- arg0.set(arg1, arg2 >>> 0);
407
- };
408
-
409
- module.exports.__wbindgen_init_externref_table = function() {
410
- const table = wasm.__wbindgen_export_0;
411
- const offset = table.grow(4);
412
- table.set(0, undefined);
413
- table.set(offset + 0, undefined);
414
- table.set(offset + 1, null);
415
- table.set(offset + 2, true);
416
- table.set(offset + 3, false);
417
- ;
418
- };
419
-
420
- module.exports.__wbindgen_memory = function() {
421
- const ret = wasm.memory;
422
- return ret;
423
- };
424
-
425
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
426
- const obj = arg1;
427
- const ret = typeof(obj) === 'string' ? obj : undefined;
428
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
- var len1 = WASM_VECTOR_LEN;
430
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
431
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
432
- };
433
-
434
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
435
- const ret = getStringFromWasm0(arg0, arg1);
436
- return ret;
437
- };
438
-
439
- module.exports.__wbindgen_throw = function(arg0, arg1) {
440
- throw new Error(getStringFromWasm0(arg0, arg1));
441
- };
442
-
443
- const path = require('path').join(__dirname, 'uplc_tx_bg.wasm');
444
- const bytes = require('fs').readFileSync(path);
445
-
446
- const wasmModule = new WebAssembly.Module(bytes);
447
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
448
- wasm = wasmInstance.exports;
449
- module.exports.__wasm = wasm;
450
836
 
451
- wasm.__wbindgen_start();
837
+ let __wbg_reinit_scheduled = false;
838
+
839
+ function takeFromExternrefTable0(idx) {
840
+ const value = wasm.__wbindgen_externrefs.get(idx);
841
+ wasm.__externref_table_dealloc(idx);
842
+ return value;
843
+ }
844
+
845
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
846
+ cachedTextDecoder.decode();
847
+ function decodeText(ptr, len) {
848
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
849
+ }
452
850
 
851
+ const cachedTextEncoder = new TextEncoder();
852
+
853
+ if (!('encodeInto' in cachedTextEncoder)) {
854
+ cachedTextEncoder.encodeInto = function (arg, view) {
855
+ const buf = cachedTextEncoder.encode(arg);
856
+ view.set(buf);
857
+ return {
858
+ read: arg.length,
859
+ written: buf.length
860
+ };
861
+ };
862
+ }
863
+
864
+ let WASM_VECTOR_LEN = 0;
865
+
866
+ const wasmPath = `${__dirname}/uplc_tx_bg.wasm`;
867
+ const wasmBytes = require('fs').readFileSync(wasmPath);
868
+ const wasmModule = new WebAssembly.Module(wasmBytes);
869
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
870
+ let wasm = wasmInstance.exports;
871
+ wasm.__wbindgen_start();