@lucid-evolution/uplc 0.4.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 +31 -0
- package/dist/size/browser/uplc_tx.d.ts +145 -0
- package/dist/size/browser/uplc_tx_bg.js +286 -4
- package/dist/size/browser/uplc_tx_bg.wasm +0 -0
- package/dist/size/browser/uplc_tx_bg.wasm.d.ts +43 -4
- package/dist/size/node/uplc_tx.d.ts +145 -0
- package/dist/size/node/uplc_tx.js +287 -4
- package/dist/size/node/uplc_tx_bg.wasm +0 -0
- package/dist/size/node/uplc_tx_bg.wasm.d.ts +43 -4
- package/dist/speed/browser/uplc_tx.d.ts +145 -0
- package/dist/speed/browser/uplc_tx_bg.js +286 -4
- package/dist/speed/browser/uplc_tx_bg.wasm +0 -0
- package/dist/speed/browser/uplc_tx_bg.wasm.d.ts +43 -4
- package/dist/speed/node/uplc_tx.d.ts +145 -0
- package/dist/speed/node/uplc_tx.js +287 -4
- package/dist/speed/node/uplc_tx_bg.wasm +0 -0
- package/dist/speed/node/uplc_tx_bg.wasm.d.ts +43 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,35 @@ result.logs; // string[]: the program's traces
|
|
|
60
60
|
|
|
61
61
|
With `false` as the last argument, steps are charged and the budget is checked every 200 steps as the ledger does. That only changes the cost reported for a program that fails, as the ledger does not charge the steps it took since the budget was last checked; the Haskell evaluator reports the same cost. It throws only when the inputs are malformed or unsupported.
|
|
62
62
|
|
|
63
|
+
## Evaluating a builtin
|
|
64
|
+
|
|
65
|
+
`eval_builtin_raw` evaluates one builtin applied to constant arguments as the evaluator does for a Plutus V3 script at a protocol version (9 to 12), for callers that step through UPLC themselves.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import {
|
|
69
|
+
BuiltinErrorKind,
|
|
70
|
+
BuiltinValueKind,
|
|
71
|
+
eval_builtin_raw,
|
|
72
|
+
} from "@lucid-evolution/uplc";
|
|
73
|
+
|
|
74
|
+
const result = eval_builtin_raw(
|
|
75
|
+
0, // the builtin's flat tag: 0 is addInteger
|
|
76
|
+
[one, two], // Uint8Array[]: each argument, encoded as its kind says
|
|
77
|
+
Uint8Array.of(BuiltinValueKind.Flat, BuiltinValueKind.Flat),
|
|
78
|
+
11, // protocol major version: 9 to 12
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
result.ok; // whether the builtin returned a value
|
|
82
|
+
result.error_kind; // a BuiltinErrorKind: Ok, NotAvailable, RejectedArguments or Failed
|
|
83
|
+
result.result_kind; // a BuiltinValueKind
|
|
84
|
+
result.result; // Uint8Array: the value, encoded as result_kind says
|
|
85
|
+
result.cpu; // bigint
|
|
86
|
+
result.mem; // bigint
|
|
87
|
+
result.error; // the evaluator's message when the builtin did not return a value
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
A `Flat` value is a flat-encoded `(program 1.1.0 (con …))`. Flat cannot encode BLS12-381 points, so a point crosses as its compressed bytes (`G1`, `G2`), and a list or array of points as the compressed points one after the other (`G1List`, `G2List`, `G1Array`, `G2Array`). The Miller-loop builtins (68 to 70) are not supported. `cpu` and `mem` are the builtin's charge under Plutus' default Plutus V3 cost model for the protocol version, excluding the machine's per-step costs; they are 0 when the builtin is not available or rejects its arguments, as the machine fails before costing it. It throws only when the inputs are malformed or unsupported.
|
|
91
|
+
|
|
63
92
|
`uplc_build_info()` returns JSON that describes the build: the uplc crate it was built from, the latest protocol version it supports, each Plutus version's cost model length, a digest of what a fixed set of programs evaluate to, and whether those programs give the expected results (`"selfTest": "pass"`).
|
|
64
93
|
|
|
65
94
|
## Tests
|
|
@@ -68,4 +97,6 @@ With `false` as the last argument, steps are charged and the budget is checked e
|
|
|
68
97
|
pnpm test
|
|
69
98
|
```
|
|
70
99
|
|
|
100
|
+
`test/fixtures/builtins.json` holds builtin applications with the outcome and cost the evaluator gives them. It is generated by the crate's tests (`packages/uplc/rust/src/builtin/tests.rs`), which check each one against the machine; rerun `cargo test` with `UPDATE_BUILTIN_FIXTURE=1` after changing the cases.
|
|
101
|
+
|
|
71
102
|
`test/fixtures/programs.json` holds programs with their outcome and cost under Plutus V3 and protocol version 11, as given by the Haskell evaluator (plutus-core 1.71).
|
|
@@ -56,6 +56,151 @@ export function eval_program_raw(
|
|
|
56
56
|
* programs; `selfTest` says whether this one gives the expected results.
|
|
57
57
|
*/
|
|
58
58
|
export function uplc_build_info(): string;
|
|
59
|
+
/**
|
|
60
|
+
* Evaluates the builtin `tag` applied to `args` as a Plutus V3 script
|
|
61
|
+
* evaluates it at a protocol version, without any program around it: the
|
|
62
|
+
* result, or how it fails, is what the machine gives for the saturated
|
|
63
|
+
* application.
|
|
64
|
+
*
|
|
65
|
+
* - `tag`: the builtin's flat tag (0 for addInteger to 100 for scaleValue).
|
|
66
|
+
* The Miller-loop builtins (68 to 70) are not supported, since their
|
|
67
|
+
* results cannot be returned.
|
|
68
|
+
* - `args`: exactly the builtin's arguments, in order, each encoded as the
|
|
69
|
+
* matching entry of `arg_kinds` says, a [`BuiltinValueKind`]: 0 for a
|
|
70
|
+
* flat-encoded `(program 1.1.0 (con …))`, 1 for a compressed G1 point, 2
|
|
71
|
+
* for a compressed G2 point, 3 for a list of G1 points, 4 for a list of G2
|
|
72
|
+
* points, 5 for an array of G1 points and 6 for an array of G2 points, each
|
|
73
|
+
* list or array as the compressed points one after the other. Flat cannot
|
|
74
|
+
* encode BLS12-381 points, so they cross as their compressed bytes.
|
|
75
|
+
* - `protocol_major_version`: from 9 (Chang, which introduced Plutus V3) to
|
|
76
|
+
* 12 (Dijkstra). It decides which builtins are available and the semantics
|
|
77
|
+
* they have.
|
|
78
|
+
*
|
|
79
|
+
* The result's `cpu` and `mem` are the builtin's charge for the application
|
|
80
|
+
* under Plutus' default Plutus V3 cost model (not the ledger's protocol
|
|
81
|
+
* parameters), excluding the machine's per-step costs.
|
|
82
|
+
*
|
|
83
|
+
* Fails only when the inputs are malformed or unsupported: an unknown or
|
|
84
|
+
* Miller-loop tag, a number of arguments other than the builtin's arity, an
|
|
85
|
+
* argument that does not decode as its kind says or is not a constant, an
|
|
86
|
+
* invalid compressed point, a protocol version out of range, or a result that
|
|
87
|
+
* none of the kinds can encode. A builtin that fails is an
|
|
88
|
+
* [`EvalBuiltinResult`] that is not `ok`.
|
|
89
|
+
*/
|
|
90
|
+
export function eval_builtin_raw(
|
|
91
|
+
tag: number,
|
|
92
|
+
args: Uint8Array[],
|
|
93
|
+
arg_kinds: Uint8Array,
|
|
94
|
+
protocol_major_version: number,
|
|
95
|
+
): EvalBuiltinResult;
|
|
96
|
+
/**
|
|
97
|
+
* Why the builtin given to [`eval_builtin_raw`] did not return a value: the
|
|
98
|
+
* codes of the result's `error_kind`.
|
|
99
|
+
*/
|
|
100
|
+
export enum BuiltinErrorKind {
|
|
101
|
+
/**
|
|
102
|
+
* The builtin returned a value.
|
|
103
|
+
*/
|
|
104
|
+
Ok = 0,
|
|
105
|
+
/**
|
|
106
|
+
* The builtin is not available to Plutus V3 at the protocol version.
|
|
107
|
+
*/
|
|
108
|
+
NotAvailable = 1,
|
|
109
|
+
/**
|
|
110
|
+
* The builtin did not accept its arguments, which fails the application
|
|
111
|
+
* before it is costed.
|
|
112
|
+
*/
|
|
113
|
+
RejectedArguments = 2,
|
|
114
|
+
/**
|
|
115
|
+
* The builtin failed after it was costed.
|
|
116
|
+
*/
|
|
117
|
+
Failed = 3,
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* How a value of [`eval_builtin_raw`] is encoded: the codes of its
|
|
121
|
+
* `arg_kinds` and of the result's `result_kind`.
|
|
122
|
+
*/
|
|
123
|
+
export enum BuiltinValueKind {
|
|
124
|
+
/**
|
|
125
|
+
* A flat-encoded program whose body is a constant,
|
|
126
|
+
* `(program 1.1.0 (con …))`. A result in this form is always version
|
|
127
|
+
* 1.1.0.
|
|
128
|
+
*/
|
|
129
|
+
Flat = 0,
|
|
130
|
+
/**
|
|
131
|
+
* A BLS12-381 G1 point, as its 48-byte compressed encoding.
|
|
132
|
+
*/
|
|
133
|
+
G1 = 1,
|
|
134
|
+
/**
|
|
135
|
+
* A BLS12-381 G2 point, as its 96-byte compressed encoding.
|
|
136
|
+
*/
|
|
137
|
+
G2 = 2,
|
|
138
|
+
/**
|
|
139
|
+
* A list of BLS12-381 G1 points, as their compressed encodings one after
|
|
140
|
+
* the other.
|
|
141
|
+
*/
|
|
142
|
+
G1List = 3,
|
|
143
|
+
/**
|
|
144
|
+
* A list of BLS12-381 G2 points, as their compressed encodings one after
|
|
145
|
+
* the other.
|
|
146
|
+
*/
|
|
147
|
+
G2List = 4,
|
|
148
|
+
/**
|
|
149
|
+
* An array of BLS12-381 G1 points, as their compressed encodings one after
|
|
150
|
+
* the other.
|
|
151
|
+
*/
|
|
152
|
+
G1Array = 5,
|
|
153
|
+
/**
|
|
154
|
+
* An array of BLS12-381 G2 points, as their compressed encodings one after
|
|
155
|
+
* the other.
|
|
156
|
+
*/
|
|
157
|
+
G2Array = 6,
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The outcome of [`eval_builtin_raw`].
|
|
161
|
+
*/
|
|
162
|
+
export class EvalBuiltinResult {
|
|
163
|
+
private constructor();
|
|
164
|
+
free(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the builtin returned a value.
|
|
167
|
+
*/
|
|
168
|
+
ok: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
|
|
171
|
+
* it did, 1 when it is not available to Plutus V3 at the protocol version,
|
|
172
|
+
* 2 when it did not accept its arguments (so the machine fails before
|
|
173
|
+
* costing it) and 3 when it failed after being costed.
|
|
174
|
+
*/
|
|
175
|
+
error_kind: number;
|
|
176
|
+
/**
|
|
177
|
+
* How `result` encodes the value, a [`BuiltinValueKind`] as for the
|
|
178
|
+
* arguments of [`eval_builtin_raw`]; 0 when there is no value.
|
|
179
|
+
*/
|
|
180
|
+
result_kind: number;
|
|
181
|
+
/**
|
|
182
|
+
* The value the builtin returned; empty when there is none.
|
|
183
|
+
*/
|
|
184
|
+
result: Uint8Array;
|
|
185
|
+
/**
|
|
186
|
+
* The CPU the builtin's cost model charges for this application, under
|
|
187
|
+
* Plutus' default cost model for Plutus V3 at the protocol version; 0
|
|
188
|
+
* when the builtin was not costed (error kinds 1 and 2). It leaves out the
|
|
189
|
+
* machine's own step costs for evaluating the application (the builtin,
|
|
190
|
+
* each force and each apply).
|
|
191
|
+
*/
|
|
192
|
+
cpu: bigint;
|
|
193
|
+
/**
|
|
194
|
+
* The memory the builtin's cost model charges for this application; see
|
|
195
|
+
* `cpu`.
|
|
196
|
+
*/
|
|
197
|
+
mem: bigint;
|
|
198
|
+
/**
|
|
199
|
+
* The evaluator's description of why the builtin did not return a value;
|
|
200
|
+
* empty when it did.
|
|
201
|
+
*/
|
|
202
|
+
error: string;
|
|
203
|
+
}
|
|
59
204
|
/**
|
|
60
205
|
* The outcome of [`eval_program_raw`].
|
|
61
206
|
*/
|
|
@@ -269,6 +269,288 @@ export function uplc_build_info() {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
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
|
+
|
|
272
554
|
const EvalProgramResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
273
555
|
? { register: () => {}, unregister: () => {} }
|
|
274
556
|
: new FinalizationRegistry(ptr => wasm.__wbg_evalprogramresult_free(ptr >>> 0, 1));
|
|
@@ -319,7 +601,7 @@ export class EvalProgramResult {
|
|
|
319
601
|
* @returns {bigint}
|
|
320
602
|
*/
|
|
321
603
|
get cpu() {
|
|
322
|
-
const ret = wasm.
|
|
604
|
+
const ret = wasm.__wbg_get_evalbuiltinresult_cpu(this.__wbg_ptr);
|
|
323
605
|
return BigInt.asUintN(64, ret);
|
|
324
606
|
}
|
|
325
607
|
/**
|
|
@@ -328,14 +610,14 @@ export class EvalProgramResult {
|
|
|
328
610
|
* @param {bigint} arg0
|
|
329
611
|
*/
|
|
330
612
|
set cpu(arg0) {
|
|
331
|
-
wasm.
|
|
613
|
+
wasm.__wbg_set_evalbuiltinresult_cpu(this.__wbg_ptr, arg0);
|
|
332
614
|
}
|
|
333
615
|
/**
|
|
334
616
|
* The memory the program used.
|
|
335
617
|
* @returns {bigint}
|
|
336
618
|
*/
|
|
337
619
|
get mem() {
|
|
338
|
-
const ret = wasm.
|
|
620
|
+
const ret = wasm.__wbg_get_evalbuiltinresult_mem(this.__wbg_ptr);
|
|
339
621
|
return BigInt.asUintN(64, ret);
|
|
340
622
|
}
|
|
341
623
|
/**
|
|
@@ -343,7 +625,7 @@ export class EvalProgramResult {
|
|
|
343
625
|
* @param {bigint} arg0
|
|
344
626
|
*/
|
|
345
627
|
set mem(arg0) {
|
|
346
|
-
wasm.
|
|
628
|
+
wasm.__wbg_set_evalbuiltinresult_mem(this.__wbg_ptr, arg0);
|
|
347
629
|
}
|
|
348
630
|
/**
|
|
349
631
|
* Why the program did not succeed: 0 when it did, 1 when it went over
|
|
Binary file
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_evalbuiltinresult_free: (a: number, b: number) => void;
|
|
4
5
|
export const __wbg_evalprogramresult_free: (a: number, b: number) => void;
|
|
5
|
-
export const
|
|
6
|
+
export const __wbg_get_evalbuiltinresult_cpu: (a: number) => bigint;
|
|
7
|
+
export const __wbg_get_evalbuiltinresult_error: (a: number) => [number, number];
|
|
8
|
+
export const __wbg_get_evalbuiltinresult_error_kind: (a: number) => number;
|
|
9
|
+
export const __wbg_get_evalbuiltinresult_mem: (a: number) => bigint;
|
|
10
|
+
export const __wbg_get_evalbuiltinresult_ok: (a: number) => number;
|
|
11
|
+
export const __wbg_get_evalbuiltinresult_result: (
|
|
12
|
+
a: number,
|
|
13
|
+
) => [number, number];
|
|
14
|
+
export const __wbg_get_evalbuiltinresult_result_kind: (a: number) => number;
|
|
6
15
|
export const __wbg_get_evalprogramresult_error_kind: (a: number) => number;
|
|
7
16
|
export const __wbg_get_evalprogramresult_logs: (a: number) => [number, number];
|
|
8
|
-
export const __wbg_get_evalprogramresult_mem: (a: number) => bigint;
|
|
9
17
|
export const __wbg_get_evalprogramresult_ok: (a: number) => number;
|
|
10
|
-
export const
|
|
18
|
+
export const __wbg_set_evalbuiltinresult_cpu: (a: number, b: bigint) => void;
|
|
19
|
+
export const __wbg_set_evalbuiltinresult_error: (
|
|
20
|
+
a: number,
|
|
21
|
+
b: number,
|
|
22
|
+
c: number,
|
|
23
|
+
) => void;
|
|
24
|
+
export const __wbg_set_evalbuiltinresult_error_kind: (
|
|
25
|
+
a: number,
|
|
26
|
+
b: number,
|
|
27
|
+
) => void;
|
|
28
|
+
export const __wbg_set_evalbuiltinresult_mem: (a: number, b: bigint) => void;
|
|
29
|
+
export const __wbg_set_evalbuiltinresult_ok: (a: number, b: number) => void;
|
|
30
|
+
export const __wbg_set_evalbuiltinresult_result: (
|
|
31
|
+
a: number,
|
|
32
|
+
b: number,
|
|
33
|
+
c: number,
|
|
34
|
+
) => void;
|
|
35
|
+
export const __wbg_set_evalbuiltinresult_result_kind: (
|
|
36
|
+
a: number,
|
|
37
|
+
b: number,
|
|
38
|
+
) => void;
|
|
11
39
|
export const __wbg_set_evalprogramresult_error_kind: (
|
|
12
40
|
a: number,
|
|
13
41
|
b: number,
|
|
@@ -17,7 +45,6 @@ export const __wbg_set_evalprogramresult_logs: (
|
|
|
17
45
|
b: number,
|
|
18
46
|
c: number,
|
|
19
47
|
) => void;
|
|
20
|
-
export const __wbg_set_evalprogramresult_mem: (a: number, b: bigint) => void;
|
|
21
48
|
export const __wbg_set_evalprogramresult_ok: (a: number, b: number) => void;
|
|
22
49
|
export const apply_params_to_script: (
|
|
23
50
|
a: number,
|
|
@@ -25,6 +52,14 @@ export const apply_params_to_script: (
|
|
|
25
52
|
c: number,
|
|
26
53
|
d: number,
|
|
27
54
|
) => [number, number, number, number];
|
|
55
|
+
export const eval_builtin_raw: (
|
|
56
|
+
a: number,
|
|
57
|
+
b: number,
|
|
58
|
+
c: number,
|
|
59
|
+
d: number,
|
|
60
|
+
e: number,
|
|
61
|
+
f: number,
|
|
62
|
+
) => [number, number, number];
|
|
28
63
|
export const eval_phase_two_raw: (
|
|
29
64
|
a: number,
|
|
30
65
|
b: number,
|
|
@@ -56,6 +91,10 @@ export const eval_program_raw: (
|
|
|
56
91
|
k: number,
|
|
57
92
|
) => [number, number, number];
|
|
58
93
|
export const uplc_build_info: () => [number, number];
|
|
94
|
+
export const __wbg_get_evalprogramresult_mem: (a: number) => bigint;
|
|
95
|
+
export const __wbg_set_evalprogramresult_mem: (a: number, b: bigint) => void;
|
|
96
|
+
export const __wbg_set_evalprogramresult_cpu: (a: number, b: bigint) => void;
|
|
97
|
+
export const __wbg_get_evalprogramresult_cpu: (a: number) => bigint;
|
|
59
98
|
export const __wbindgen_export_0: WebAssembly.Table;
|
|
60
99
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
61
100
|
export const __wbindgen_realloc: (
|