@lucid-evolution/uplc 0.3.0 → 0.5.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.
@@ -2,11 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
8
-
9
- cachedTextDecoder.decode();
7
+ let WASM_VECTOR_LEN = 0;
10
8
 
11
9
  let cachedUint8ArrayMemory0 = null;
12
10
 
@@ -17,20 +15,64 @@ function getUint8ArrayMemory0() {
17
15
  return cachedUint8ArrayMemory0;
18
16
  }
19
17
 
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
18
+ let cachedTextEncoder = new TextEncoder('utf-8');
19
+
20
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
21
+ ? function (arg, view) {
22
+ return cachedTextEncoder.encodeInto(arg, view);
23
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
+ };
31
+ });
24
32
 
25
- let WASM_VECTOR_LEN = 0;
33
+ function passStringToWasm0(arg, malloc, realloc) {
26
34
 
27
- function passArray8ToWasm0(arg, malloc) {
28
- const ptr = malloc(arg.length * 1, 1) >>> 0;
29
- getUint8ArrayMemory0().set(arg, ptr / 1);
30
- WASM_VECTOR_LEN = arg.length;
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;
40
+ return ptr;
41
+ }
42
+
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
+ }
55
+
56
+ if (offset !== len) {
57
+ if (offset !== 0) {
58
+ arg = arg.slice(offset);
59
+ }
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;
66
+ }
67
+
68
+ WASM_VECTOR_LEN = offset;
31
69
  return ptr;
32
70
  }
33
71
 
72
+ function isLikeNone(x) {
73
+ return x === undefined || x === null;
74
+ }
75
+
34
76
  let cachedDataViewMemory0 = null;
35
77
 
36
78
  function getDataViewMemory0() {
@@ -40,6 +82,22 @@ function getDataViewMemory0() {
40
82
  return cachedDataViewMemory0;
41
83
  }
42
84
 
85
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
86
+
87
+ cachedTextDecoder.decode();
88
+
89
+ function getStringFromWasm0(ptr, len) {
90
+ ptr = ptr >>> 0;
91
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
92
+ }
93
+
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;
99
+ }
100
+
43
101
  function addToExternrefTable0(obj) {
44
102
  const idx = wasm.__externref_table_alloc();
45
103
  wasm.__wbindgen_export_0.set(idx, obj);
@@ -56,10 +114,6 @@ function passArrayJsValueToWasm0(array, malloc) {
56
114
  return ptr;
57
115
  }
58
116
 
59
- function isLikeNone(x) {
60
- return x === undefined || x === null;
61
- }
62
-
63
117
  function takeFromExternrefTable0(idx) {
64
118
  const value = wasm.__wbindgen_export_0.get(idx);
65
119
  wasm.__externref_table_dealloc(idx);
@@ -130,6 +184,487 @@ module.exports.apply_params_to_script = function(params_bytes, plutus_script_byt
130
184
  return v3;
131
185
  };
132
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;
194
+ }
195
+
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
+ /**
203
+ * Evaluates a UPLC program applied to Data arguments, outside of any
204
+ * transaction: the caller builds whatever arguments the program expects,
205
+ * including its script context.
206
+ *
207
+ * - `program_flat`: the program, flat-encoded without a CBOR wrapper.
208
+ * - `args_cbor`: the arguments, each one CBOR-encoded Data, applied in order.
209
+ * - `language`: the Plutus version to evaluate as, 1, 2 or 3.
210
+ * - `protocol_major_version`: the protocol version whose semantics to use,
211
+ * from 5 (Alonzo) to 12 (Dijkstra).
212
+ * - `cost_model`: the cost model parameters, every one the evaluator knows
213
+ * for this Plutus version (350 for Plutus V3), in the ledger's order.
214
+ * - `budget_cpu`, `budget_mem`: the budget.
215
+ * - `strict_budget`: charge every step as the machine takes it, and stop the
216
+ * program as soon as it goes over budget, instead of charging steps and
217
+ * checking the budget every 200 steps as the ledger does. Only the cost of a
218
+ * program that fails differs: the ledger does not charge the steps it took
219
+ * since the budget was last checked.
220
+ *
221
+ * Fails only when the inputs are malformed or unsupported. A program that fails
222
+ * is an [`EvalProgramResult`] that is not `ok`.
223
+ * @param {Uint8Array} program_flat
224
+ * @param {Uint8Array[]} args_cbor
225
+ * @param {number} language
226
+ * @param {number} protocol_major_version
227
+ * @param {BigInt64Array} cost_model
228
+ * @param {bigint} budget_cpu
229
+ * @param {bigint} budget_mem
230
+ * @param {boolean} strict_budget
231
+ * @returns {EvalProgramResult}
232
+ */
233
+ module.exports.eval_program_raw = function(program_flat, args_cbor, language, protocol_major_version, cost_model, budget_cpu, budget_mem, strict_budget) {
234
+ const ptr0 = passArray8ToWasm0(program_flat, wasm.__wbindgen_malloc);
235
+ const len0 = WASM_VECTOR_LEN;
236
+ const ptr1 = passArrayJsValueToWasm0(args_cbor, wasm.__wbindgen_malloc);
237
+ const len1 = WASM_VECTOR_LEN;
238
+ const ptr2 = passArray64ToWasm0(cost_model, wasm.__wbindgen_malloc);
239
+ 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);
241
+ if (ret[2]) {
242
+ throw takeFromExternrefTable0(ret[1]);
243
+ }
244
+ return EvalProgramResult.__wrap(ret[0]);
245
+ };
246
+
247
+ /**
248
+ * Describes this build of the evaluator as JSON: the uplc crate it was built
249
+ * from, the length of each Plutus version's cost model, and a digest of what a
250
+ * fixed set of programs evaluate to, with their costs, under Plutus V3 and the
251
+ * latest protocol version. Two builds with the same digest agree on those
252
+ * programs; `selfTest` says whether this one gives the expected results.
253
+ * @returns {string}
254
+ */
255
+ module.exports.uplc_build_info = function() {
256
+ let deferred1_0;
257
+ let deferred1_1;
258
+ try {
259
+ const ret = wasm.uplc_build_info();
260
+ deferred1_0 = ret[0];
261
+ deferred1_1 = ret[1];
262
+ return getStringFromWasm0(ret[0], ret[1]);
263
+ } finally {
264
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
265
+ }
266
+ };
267
+
268
+ /**
269
+ * Evaluates the builtin `tag` applied to `args` as a Plutus V3 script
270
+ * evaluates it at a protocol version, without any program around it: the
271
+ * result, or how it fails, is what the machine gives for the saturated
272
+ * application.
273
+ *
274
+ * - `tag`: the builtin's flat tag (0 for addInteger to 100 for scaleValue).
275
+ * The Miller-loop builtins (68 to 70) are not supported, since their
276
+ * results cannot be returned.
277
+ * - `args`: exactly the builtin's arguments, in order, each encoded as the
278
+ * matching entry of `arg_kinds` says, a [`BuiltinValueKind`]: 0 for a
279
+ * flat-encoded `(program 1.1.0 (con …))`, 1 for a compressed G1 point, 2
280
+ * for a compressed G2 point, 3 for a list of G1 points, 4 for a list of G2
281
+ * points, 5 for an array of G1 points and 6 for an array of G2 points, each
282
+ * list or array as the compressed points one after the other. Flat cannot
283
+ * encode BLS12-381 points, so they cross as their compressed bytes.
284
+ * - `protocol_major_version`: from 9 (Chang, which introduced Plutus V3) to
285
+ * 12 (Dijkstra). It decides which builtins are available and the semantics
286
+ * they have.
287
+ *
288
+ * The result's `cpu` and `mem` are the builtin's charge for the application
289
+ * under Plutus' default Plutus V3 cost model (not the ledger's protocol
290
+ * parameters), excluding the machine's per-step costs.
291
+ *
292
+ * Fails only when the inputs are malformed or unsupported: an unknown or
293
+ * Miller-loop tag, a number of arguments other than the builtin's arity, an
294
+ * argument that does not decode as its kind says or is not a constant, an
295
+ * invalid compressed point, a protocol version out of range, or a result that
296
+ * none of the kinds can encode. A builtin that fails is an
297
+ * [`EvalBuiltinResult`] that is not `ok`.
298
+ * @param {number} tag
299
+ * @param {Uint8Array[]} args
300
+ * @param {Uint8Array} arg_kinds
301
+ * @param {number} protocol_major_version
302
+ * @returns {EvalBuiltinResult}
303
+ */
304
+ module.exports.eval_builtin_raw = function(tag, args, arg_kinds, protocol_major_version) {
305
+ const ptr0 = passArrayJsValueToWasm0(args, wasm.__wbindgen_malloc);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ const ptr1 = passArray8ToWasm0(arg_kinds, wasm.__wbindgen_malloc);
308
+ const len1 = WASM_VECTOR_LEN;
309
+ const ret = wasm.eval_builtin_raw(tag, ptr0, len0, ptr1, len1, protocol_major_version);
310
+ if (ret[2]) {
311
+ throw takeFromExternrefTable0(ret[1]);
312
+ }
313
+ return EvalBuiltinResult.__wrap(ret[0]);
314
+ };
315
+
316
+ /**
317
+ * Why the builtin given to [`eval_builtin_raw`] did not return a value: the
318
+ * codes of the result's `error_kind`.
319
+ * @enum {0 | 1 | 2 | 3}
320
+ */
321
+ module.exports.BuiltinErrorKind = Object.freeze({
322
+ /**
323
+ * The builtin returned a value.
324
+ */
325
+ Ok: 0, "0": "Ok",
326
+ /**
327
+ * The builtin is not available to Plutus V3 at the protocol version.
328
+ */
329
+ NotAvailable: 1, "1": "NotAvailable",
330
+ /**
331
+ * The builtin did not accept its arguments, which fails the application
332
+ * before it is costed.
333
+ */
334
+ RejectedArguments: 2, "2": "RejectedArguments",
335
+ /**
336
+ * The builtin failed after it was costed.
337
+ */
338
+ Failed: 3, "3": "Failed",
339
+ });
340
+ /**
341
+ * How a value of [`eval_builtin_raw`] is encoded: the codes of its
342
+ * `arg_kinds` and of the result's `result_kind`.
343
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}
344
+ */
345
+ module.exports.BuiltinValueKind = Object.freeze({
346
+ /**
347
+ * A flat-encoded program whose body is a constant,
348
+ * `(program 1.1.0 (con …))`. A result in this form is always version
349
+ * 1.1.0.
350
+ */
351
+ Flat: 0, "0": "Flat",
352
+ /**
353
+ * A BLS12-381 G1 point, as its 48-byte compressed encoding.
354
+ */
355
+ G1: 1, "1": "G1",
356
+ /**
357
+ * A BLS12-381 G2 point, as its 96-byte compressed encoding.
358
+ */
359
+ G2: 2, "2": "G2",
360
+ /**
361
+ * A list of BLS12-381 G1 points, as their compressed encodings one after
362
+ * the other.
363
+ */
364
+ G1List: 3, "3": "G1List",
365
+ /**
366
+ * A list of BLS12-381 G2 points, as their compressed encodings one after
367
+ * the other.
368
+ */
369
+ G2List: 4, "4": "G2List",
370
+ /**
371
+ * An array of BLS12-381 G1 points, as their compressed encodings one after
372
+ * the other.
373
+ */
374
+ G1Array: 5, "5": "G1Array",
375
+ /**
376
+ * An array of BLS12-381 G2 points, as their compressed encodings one after
377
+ * the other.
378
+ */
379
+ G2Array: 6, "6": "G2Array",
380
+ });
381
+
382
+ const EvalBuiltinResultFinalization = (typeof FinalizationRegistry === 'undefined')
383
+ ? { register: () => {}, unregister: () => {} }
384
+ : new FinalizationRegistry(ptr => wasm.__wbg_evalbuiltinresult_free(ptr >>> 0, 1));
385
+ /**
386
+ * The outcome of [`eval_builtin_raw`].
387
+ */
388
+ class EvalBuiltinResult {
389
+
390
+ static __wrap(ptr) {
391
+ ptr = ptr >>> 0;
392
+ const obj = Object.create(EvalBuiltinResult.prototype);
393
+ obj.__wbg_ptr = ptr;
394
+ EvalBuiltinResultFinalization.register(obj, obj.__wbg_ptr, obj);
395
+ return obj;
396
+ }
397
+
398
+ __destroy_into_raw() {
399
+ const ptr = this.__wbg_ptr;
400
+ this.__wbg_ptr = 0;
401
+ EvalBuiltinResultFinalization.unregister(this);
402
+ return ptr;
403
+ }
404
+
405
+ free() {
406
+ const ptr = this.__destroy_into_raw();
407
+ wasm.__wbg_evalbuiltinresult_free(ptr, 0);
408
+ }
409
+ /**
410
+ * Whether the builtin returned a value.
411
+ * @returns {boolean}
412
+ */
413
+ get ok() {
414
+ const ret = wasm.__wbg_get_evalbuiltinresult_ok(this.__wbg_ptr);
415
+ return ret !== 0;
416
+ }
417
+ /**
418
+ * Whether the builtin returned a value.
419
+ * @param {boolean} arg0
420
+ */
421
+ set ok(arg0) {
422
+ wasm.__wbg_set_evalbuiltinresult_ok(this.__wbg_ptr, arg0);
423
+ }
424
+ /**
425
+ * Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
426
+ * it did, 1 when it is not available to Plutus V3 at the protocol version,
427
+ * 2 when it did not accept its arguments (so the machine fails before
428
+ * costing it) and 3 when it failed after being costed.
429
+ * @returns {number}
430
+ */
431
+ get error_kind() {
432
+ const ret = wasm.__wbg_get_evalbuiltinresult_error_kind(this.__wbg_ptr);
433
+ return ret;
434
+ }
435
+ /**
436
+ * Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
437
+ * it did, 1 when it is not available to Plutus V3 at the protocol version,
438
+ * 2 when it did not accept its arguments (so the machine fails before
439
+ * costing it) and 3 when it failed after being costed.
440
+ * @param {number} arg0
441
+ */
442
+ set error_kind(arg0) {
443
+ wasm.__wbg_set_evalbuiltinresult_error_kind(this.__wbg_ptr, arg0);
444
+ }
445
+ /**
446
+ * How `result` encodes the value, a [`BuiltinValueKind`] as for the
447
+ * arguments of [`eval_builtin_raw`]; 0 when there is no value.
448
+ * @returns {number}
449
+ */
450
+ get result_kind() {
451
+ const ret = wasm.__wbg_get_evalbuiltinresult_result_kind(this.__wbg_ptr);
452
+ return ret;
453
+ }
454
+ /**
455
+ * How `result` encodes the value, a [`BuiltinValueKind`] as for the
456
+ * arguments of [`eval_builtin_raw`]; 0 when there is no value.
457
+ * @param {number} arg0
458
+ */
459
+ set result_kind(arg0) {
460
+ wasm.__wbg_set_evalbuiltinresult_result_kind(this.__wbg_ptr, arg0);
461
+ }
462
+ /**
463
+ * The value the builtin returned; empty when there is none.
464
+ * @returns {Uint8Array}
465
+ */
466
+ get result() {
467
+ const ret = wasm.__wbg_get_evalbuiltinresult_result(this.__wbg_ptr);
468
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
469
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
470
+ return v1;
471
+ }
472
+ /**
473
+ * The value the builtin returned; empty when there is none.
474
+ * @param {Uint8Array} arg0
475
+ */
476
+ set result(arg0) {
477
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ wasm.__wbg_set_evalbuiltinresult_result(this.__wbg_ptr, ptr0, len0);
480
+ }
481
+ /**
482
+ * The CPU the builtin's cost model charges for this application, under
483
+ * Plutus' default cost model for Plutus V3 at the protocol version; 0
484
+ * when the builtin was not costed (error kinds 1 and 2). It leaves out the
485
+ * machine's own step costs for evaluating the application (the builtin,
486
+ * each force and each apply).
487
+ * @returns {bigint}
488
+ */
489
+ get cpu() {
490
+ const ret = wasm.__wbg_get_evalbuiltinresult_cpu(this.__wbg_ptr);
491
+ return BigInt.asUintN(64, ret);
492
+ }
493
+ /**
494
+ * The CPU the builtin's cost model charges for this application, under
495
+ * Plutus' default cost model for Plutus V3 at the protocol version; 0
496
+ * when the builtin was not costed (error kinds 1 and 2). It leaves out the
497
+ * machine's own step costs for evaluating the application (the builtin,
498
+ * each force and each apply).
499
+ * @param {bigint} arg0
500
+ */
501
+ set cpu(arg0) {
502
+ wasm.__wbg_set_evalbuiltinresult_cpu(this.__wbg_ptr, arg0);
503
+ }
504
+ /**
505
+ * The memory the builtin's cost model charges for this application; see
506
+ * `cpu`.
507
+ * @returns {bigint}
508
+ */
509
+ get mem() {
510
+ const ret = wasm.__wbg_get_evalbuiltinresult_mem(this.__wbg_ptr);
511
+ return BigInt.asUintN(64, ret);
512
+ }
513
+ /**
514
+ * The memory the builtin's cost model charges for this application; see
515
+ * `cpu`.
516
+ * @param {bigint} arg0
517
+ */
518
+ set mem(arg0) {
519
+ wasm.__wbg_set_evalbuiltinresult_mem(this.__wbg_ptr, arg0);
520
+ }
521
+ /**
522
+ * The evaluator's description of why the builtin did not return a value;
523
+ * empty when it did.
524
+ * @returns {string}
525
+ */
526
+ get error() {
527
+ let deferred1_0;
528
+ let deferred1_1;
529
+ try {
530
+ const ret = wasm.__wbg_get_evalbuiltinresult_error(this.__wbg_ptr);
531
+ deferred1_0 = ret[0];
532
+ deferred1_1 = ret[1];
533
+ return getStringFromWasm0(ret[0], ret[1]);
534
+ } finally {
535
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
536
+ }
537
+ }
538
+ /**
539
+ * The evaluator's description of why the builtin did not return a value;
540
+ * empty when it did.
541
+ * @param {string} arg0
542
+ */
543
+ set error(arg0) {
544
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
+ const len0 = WASM_VECTOR_LEN;
546
+ wasm.__wbg_set_evalbuiltinresult_error(this.__wbg_ptr, ptr0, len0);
547
+ }
548
+ }
549
+ module.exports.EvalBuiltinResult = EvalBuiltinResult;
550
+
551
+ const EvalProgramResultFinalization = (typeof FinalizationRegistry === 'undefined')
552
+ ? { register: () => {}, unregister: () => {} }
553
+ : new FinalizationRegistry(ptr => wasm.__wbg_evalprogramresult_free(ptr >>> 0, 1));
554
+ /**
555
+ * The outcome of [`eval_program_raw`].
556
+ */
557
+ class EvalProgramResult {
558
+
559
+ static __wrap(ptr) {
560
+ ptr = ptr >>> 0;
561
+ const obj = Object.create(EvalProgramResult.prototype);
562
+ obj.__wbg_ptr = ptr;
563
+ EvalProgramResultFinalization.register(obj, obj.__wbg_ptr, obj);
564
+ return obj;
565
+ }
566
+
567
+ __destroy_into_raw() {
568
+ const ptr = this.__wbg_ptr;
569
+ this.__wbg_ptr = 0;
570
+ EvalProgramResultFinalization.unregister(this);
571
+ return ptr;
572
+ }
573
+
574
+ free() {
575
+ const ptr = this.__destroy_into_raw();
576
+ wasm.__wbg_evalprogramresult_free(ptr, 0);
577
+ }
578
+ /**
579
+ * Whether the program succeeded: it did not fail and, for Plutus V3, it
580
+ * returned unit.
581
+ * @returns {boolean}
582
+ */
583
+ get ok() {
584
+ const ret = wasm.__wbg_get_evalprogramresult_ok(this.__wbg_ptr);
585
+ return ret !== 0;
586
+ }
587
+ /**
588
+ * Whether the program succeeded: it did not fail and, for Plutus V3, it
589
+ * returned unit.
590
+ * @param {boolean} arg0
591
+ */
592
+ set ok(arg0) {
593
+ wasm.__wbg_set_evalprogramresult_ok(this.__wbg_ptr, arg0);
594
+ }
595
+ /**
596
+ * The CPU the program used. A program that went over budget is charged
597
+ * what it used up to the point where the machine stopped it.
598
+ * @returns {bigint}
599
+ */
600
+ get cpu() {
601
+ const ret = wasm.__wbg_get_evalbuiltinresult_cpu(this.__wbg_ptr);
602
+ return BigInt.asUintN(64, ret);
603
+ }
604
+ /**
605
+ * The CPU the program used. A program that went over budget is charged
606
+ * what it used up to the point where the machine stopped it.
607
+ * @param {bigint} arg0
608
+ */
609
+ set cpu(arg0) {
610
+ wasm.__wbg_set_evalbuiltinresult_cpu(this.__wbg_ptr, arg0);
611
+ }
612
+ /**
613
+ * The memory the program used.
614
+ * @returns {bigint}
615
+ */
616
+ get mem() {
617
+ const ret = wasm.__wbg_get_evalbuiltinresult_mem(this.__wbg_ptr);
618
+ return BigInt.asUintN(64, ret);
619
+ }
620
+ /**
621
+ * The memory the program used.
622
+ * @param {bigint} arg0
623
+ */
624
+ set mem(arg0) {
625
+ wasm.__wbg_set_evalbuiltinresult_mem(this.__wbg_ptr, arg0);
626
+ }
627
+ /**
628
+ * Why the program did not succeed: 0 when it did, 1 when it went over
629
+ * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
630
+ * returned something other than unit.
631
+ * @returns {number}
632
+ */
633
+ get error_kind() {
634
+ const ret = wasm.__wbg_get_evalprogramresult_error_kind(this.__wbg_ptr);
635
+ return ret;
636
+ }
637
+ /**
638
+ * Why the program did not succeed: 0 when it did, 1 when it went over
639
+ * budget, 2 when it failed in any other way and 3 when a Plutus V3 program
640
+ * returned something other than unit.
641
+ * @param {number} arg0
642
+ */
643
+ set error_kind(arg0) {
644
+ wasm.__wbg_set_evalprogramresult_error_kind(this.__wbg_ptr, arg0);
645
+ }
646
+ /**
647
+ * The messages the program traced, in order.
648
+ * @returns {string[]}
649
+ */
650
+ get logs() {
651
+ const ret = wasm.__wbg_get_evalprogramresult_logs(this.__wbg_ptr);
652
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
653
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
654
+ return v1;
655
+ }
656
+ /**
657
+ * The messages the program traced, in order.
658
+ * @param {string[]} arg0
659
+ */
660
+ set logs(arg0) {
661
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
662
+ const len0 = WASM_VECTOR_LEN;
663
+ wasm.__wbg_set_evalprogramresult_logs(this.__wbg_ptr, ptr0, len0);
664
+ }
665
+ }
666
+ module.exports.EvalProgramResult = EvalProgramResult;
667
+
133
668
  module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
134
669
  const ret = arg0.buffer;
135
670
  return ret;
@@ -170,6 +705,15 @@ module.exports.__wbindgen_memory = function() {
170
705
  return ret;
171
706
  };
172
707
 
708
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
709
+ const obj = arg1;
710
+ const ret = typeof(obj) === 'string' ? obj : undefined;
711
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
712
+ var len1 = WASM_VECTOR_LEN;
713
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
714
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
715
+ };
716
+
173
717
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
174
718
  const ret = getStringFromWasm0(arg0, arg1);
175
719
  return ret;
Binary file