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