@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
|
@@ -1,12 +1,65 @@
|
|
|
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;
|
|
5
|
+
export const __wbg_evalprogramresult_free: (a: number, b: number) => void;
|
|
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;
|
|
15
|
+
export const __wbg_get_evalprogramresult_error_kind: (a: number) => number;
|
|
16
|
+
export const __wbg_get_evalprogramresult_logs: (a: number) => [number, number];
|
|
17
|
+
export const __wbg_get_evalprogramresult_ok: (a: number) => number;
|
|
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;
|
|
39
|
+
export const __wbg_set_evalprogramresult_error_kind: (
|
|
40
|
+
a: number,
|
|
41
|
+
b: number,
|
|
42
|
+
) => void;
|
|
43
|
+
export const __wbg_set_evalprogramresult_logs: (
|
|
44
|
+
a: number,
|
|
45
|
+
b: number,
|
|
46
|
+
c: number,
|
|
47
|
+
) => void;
|
|
48
|
+
export const __wbg_set_evalprogramresult_ok: (a: number, b: number) => void;
|
|
4
49
|
export const apply_params_to_script: (
|
|
5
50
|
a: number,
|
|
6
51
|
b: number,
|
|
7
52
|
c: number,
|
|
8
53
|
d: number,
|
|
9
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];
|
|
10
63
|
export const eval_phase_two_raw: (
|
|
11
64
|
a: number,
|
|
12
65
|
b: number,
|
|
@@ -24,8 +77,32 @@ export const eval_phase_two_raw: (
|
|
|
24
77
|
n: number,
|
|
25
78
|
o: number,
|
|
26
79
|
) => [number, number, number, number];
|
|
80
|
+
export const eval_program_raw: (
|
|
81
|
+
a: number,
|
|
82
|
+
b: number,
|
|
83
|
+
c: number,
|
|
84
|
+
d: number,
|
|
85
|
+
e: number,
|
|
86
|
+
f: number,
|
|
87
|
+
g: number,
|
|
88
|
+
h: number,
|
|
89
|
+
i: bigint,
|
|
90
|
+
j: bigint,
|
|
91
|
+
k: number,
|
|
92
|
+
) => [number, number, number];
|
|
93
|
+
export const uplc_build_info: () => [number, number];
|
|
94
|
+
export const __wbg_set_evalprogramresult_cpu: (a: number, b: bigint) => void;
|
|
95
|
+
export const __wbg_set_evalprogramresult_mem: (a: number, b: bigint) => void;
|
|
96
|
+
export const __wbg_get_evalprogramresult_cpu: (a: number) => bigint;
|
|
97
|
+
export const __wbg_get_evalprogramresult_mem: (a: number) => bigint;
|
|
27
98
|
export const __wbindgen_export_0: WebAssembly.Table;
|
|
28
99
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
100
|
+
export const __wbindgen_realloc: (
|
|
101
|
+
a: number,
|
|
102
|
+
b: number,
|
|
103
|
+
c: number,
|
|
104
|
+
d: number,
|
|
105
|
+
) => number;
|
|
29
106
|
export const __externref_table_alloc: () => number;
|
|
30
107
|
export const __externref_table_dealloc: (a: number) => void;
|
|
31
108
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
@@ -16,3 +16,219 @@ export function apply_params_to_script(
|
|
|
16
16
|
params_bytes: Uint8Array,
|
|
17
17
|
plutus_script_bytes: Uint8Array,
|
|
18
18
|
): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Evaluates a UPLC program applied to Data arguments, outside of any
|
|
21
|
+
* transaction: the caller builds whatever arguments the program expects,
|
|
22
|
+
* including its script context.
|
|
23
|
+
*
|
|
24
|
+
* - `program_flat`: the program, flat-encoded without a CBOR wrapper.
|
|
25
|
+
* - `args_cbor`: the arguments, each one CBOR-encoded Data, applied in order.
|
|
26
|
+
* - `language`: the Plutus version to evaluate as, 1, 2 or 3.
|
|
27
|
+
* - `protocol_major_version`: the protocol version whose semantics to use,
|
|
28
|
+
* from 5 (Alonzo) to 12 (Dijkstra).
|
|
29
|
+
* - `cost_model`: the cost model parameters, every one the evaluator knows
|
|
30
|
+
* for this Plutus version (350 for Plutus V3), in the ledger's order.
|
|
31
|
+
* - `budget_cpu`, `budget_mem`: the budget.
|
|
32
|
+
* - `strict_budget`: charge every step as the machine takes it, and stop the
|
|
33
|
+
* program as soon as it goes over budget, instead of charging steps and
|
|
34
|
+
* checking the budget every 200 steps as the ledger does. Only the cost of a
|
|
35
|
+
* program that fails differs: the ledger does not charge the steps it took
|
|
36
|
+
* since the budget was last checked.
|
|
37
|
+
*
|
|
38
|
+
* Fails only when the inputs are malformed or unsupported. A program that fails
|
|
39
|
+
* is an [`EvalProgramResult`] that is not `ok`.
|
|
40
|
+
*/
|
|
41
|
+
export function eval_program_raw(
|
|
42
|
+
program_flat: Uint8Array,
|
|
43
|
+
args_cbor: Uint8Array[],
|
|
44
|
+
language: number,
|
|
45
|
+
protocol_major_version: number,
|
|
46
|
+
cost_model: BigInt64Array,
|
|
47
|
+
budget_cpu: bigint,
|
|
48
|
+
budget_mem: bigint,
|
|
49
|
+
strict_budget: boolean,
|
|
50
|
+
): EvalProgramResult;
|
|
51
|
+
/**
|
|
52
|
+
* Describes this build of the evaluator as JSON: the uplc crate it was built
|
|
53
|
+
* from, the length of each Plutus version's cost model, and a digest of what a
|
|
54
|
+
* fixed set of programs evaluate to, with their costs, under Plutus V3 and the
|
|
55
|
+
* latest protocol version. Two builds with the same digest agree on those
|
|
56
|
+
* programs; `selfTest` says whether this one gives the expected results.
|
|
57
|
+
*/
|
|
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
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The outcome of [`eval_program_raw`].
|
|
206
|
+
*/
|
|
207
|
+
export class EvalProgramResult {
|
|
208
|
+
private constructor();
|
|
209
|
+
free(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Whether the program succeeded: it did not fail and, for Plutus V3, it
|
|
212
|
+
* returned unit.
|
|
213
|
+
*/
|
|
214
|
+
ok: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* The CPU the program used. A program that went over budget is charged
|
|
217
|
+
* what it used up to the point where the machine stopped it.
|
|
218
|
+
*/
|
|
219
|
+
cpu: bigint;
|
|
220
|
+
/**
|
|
221
|
+
* The memory the program used.
|
|
222
|
+
*/
|
|
223
|
+
mem: bigint;
|
|
224
|
+
/**
|
|
225
|
+
* Why the program did not succeed: 0 when it did, 1 when it went over
|
|
226
|
+
* budget, 2 when it failed in any other way and 3 when a Plutus V3 program
|
|
227
|
+
* returned something other than unit.
|
|
228
|
+
*/
|
|
229
|
+
error_kind: number;
|
|
230
|
+
/**
|
|
231
|
+
* The messages the program traced, in order.
|
|
232
|
+
*/
|
|
233
|
+
logs: string[];
|
|
234
|
+
}
|