@lucid-evolution/uplc 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/recover-from-trap.js +44 -0
- package/dist/size/browser/uplc_tx.d.ts +191 -35
- package/dist/size/browser/uplc_tx.js +5 -1
- package/dist/size/browser/uplc_tx_bg.js +612 -357
- package/dist/size/browser/uplc_tx_bg.wasm +0 -0
- package/dist/size/browser/uplc_tx_bg.wasm.d.ts +46 -7
- package/dist/size/node/uplc_tx.d.ts +193 -35
- package/dist/size/node/uplc_tx.js +755 -336
- package/dist/size/node/uplc_tx_bg.wasm +0 -0
- package/dist/size/node/uplc_tx_bg.wasm.d.ts +46 -7
- package/dist/size/node.d.ts +11 -0
- package/dist/size/node.js +17 -0
- package/dist/speed/browser/uplc_tx.d.ts +191 -35
- package/dist/speed/browser/uplc_tx.js +5 -1
- package/dist/speed/browser/uplc_tx_bg.js +612 -357
- package/dist/speed/browser/uplc_tx_bg.wasm +0 -0
- package/dist/speed/browser/uplc_tx_bg.wasm.d.ts +46 -7
- package/dist/speed/node/uplc_tx.d.ts +193 -35
- package/dist/speed/node/uplc_tx.js +755 -336
- package/dist/speed/node/uplc_tx_bg.wasm +0 -0
- package/dist/speed/node/uplc_tx_bg.wasm.d.ts +46 -7
- package/dist/speed/node.d.ts +11 -0
- package/dist/speed/node.js +17 -0
- package/package.json +12 -12
|
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,7 +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];
|
|
59
|
-
export const
|
|
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;
|
|
60
98
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
61
99
|
export const __wbindgen_realloc: (
|
|
62
100
|
a: number,
|
|
@@ -64,8 +102,9 @@ export const __wbindgen_realloc: (
|
|
|
64
102
|
c: number,
|
|
65
103
|
d: number,
|
|
66
104
|
) => number;
|
|
67
|
-
export const
|
|
105
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
68
106
|
export const __externref_table_dealloc: (a: number) => void;
|
|
69
|
-
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
70
107
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
108
|
+
export const __externref_table_alloc: () => number;
|
|
109
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
71
110
|
export const __wbindgen_start: () => void;
|
|
@@ -1,5 +1,196 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Why the builtin given to [`eval_builtin_raw`] did not return a value: the
|
|
6
|
+
* codes of the result's `error_kind`.
|
|
7
|
+
*/
|
|
8
|
+
export enum BuiltinErrorKind {
|
|
9
|
+
/**
|
|
10
|
+
* The builtin returned a value.
|
|
11
|
+
*/
|
|
12
|
+
Ok = 0,
|
|
13
|
+
/**
|
|
14
|
+
* The builtin is not available to Plutus V3 at the protocol version.
|
|
15
|
+
*/
|
|
16
|
+
NotAvailable = 1,
|
|
17
|
+
/**
|
|
18
|
+
* The builtin did not accept its arguments, which fails the application
|
|
19
|
+
* before it is costed.
|
|
20
|
+
*/
|
|
21
|
+
RejectedArguments = 2,
|
|
22
|
+
/**
|
|
23
|
+
* The builtin failed after it was costed.
|
|
24
|
+
*/
|
|
25
|
+
Failed = 3,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How a value of [`eval_builtin_raw`] is encoded: the codes of its
|
|
30
|
+
* `arg_kinds` and of the result's `result_kind`.
|
|
31
|
+
*/
|
|
32
|
+
export enum BuiltinValueKind {
|
|
33
|
+
/**
|
|
34
|
+
* A flat-encoded program whose body is a constant,
|
|
35
|
+
* `(program 1.1.0 (con …))`. A result in this form is always version
|
|
36
|
+
* 1.1.0.
|
|
37
|
+
*/
|
|
38
|
+
Flat = 0,
|
|
39
|
+
/**
|
|
40
|
+
* A BLS12-381 G1 point, as its 48-byte compressed encoding.
|
|
41
|
+
*/
|
|
42
|
+
G1 = 1,
|
|
43
|
+
/**
|
|
44
|
+
* A BLS12-381 G2 point, as its 96-byte compressed encoding.
|
|
45
|
+
*/
|
|
46
|
+
G2 = 2,
|
|
47
|
+
/**
|
|
48
|
+
* A list of BLS12-381 G1 points, as their compressed encodings one after
|
|
49
|
+
* the other.
|
|
50
|
+
*/
|
|
51
|
+
G1List = 3,
|
|
52
|
+
/**
|
|
53
|
+
* A list of BLS12-381 G2 points, as their compressed encodings one after
|
|
54
|
+
* the other.
|
|
55
|
+
*/
|
|
56
|
+
G2List = 4,
|
|
57
|
+
/**
|
|
58
|
+
* An array of BLS12-381 G1 points, as their compressed encodings one after
|
|
59
|
+
* the other.
|
|
60
|
+
*/
|
|
61
|
+
G1Array = 5,
|
|
62
|
+
/**
|
|
63
|
+
* An array of BLS12-381 G2 points, as their compressed encodings one after
|
|
64
|
+
* the other.
|
|
65
|
+
*/
|
|
66
|
+
G2Array = 6,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The outcome of [`eval_builtin_raw`].
|
|
71
|
+
*/
|
|
72
|
+
export class EvalBuiltinResult {
|
|
73
|
+
private constructor();
|
|
74
|
+
free(): void;
|
|
75
|
+
[Symbol.dispose](): void;
|
|
76
|
+
/**
|
|
77
|
+
* The CPU the builtin's cost model charges for this application, under
|
|
78
|
+
* Plutus' default cost model for Plutus V3 at the protocol version; 0
|
|
79
|
+
* when the builtin was not costed (error kinds 1 and 2). It leaves out the
|
|
80
|
+
* machine's own step costs for evaluating the application (the builtin,
|
|
81
|
+
* each force and each apply).
|
|
82
|
+
*/
|
|
83
|
+
cpu: bigint;
|
|
84
|
+
/**
|
|
85
|
+
* Why the builtin did not return a value, a [`BuiltinErrorKind`]: 0 when
|
|
86
|
+
* it did, 1 when it is not available to Plutus V3 at the protocol version,
|
|
87
|
+
* 2 when it did not accept its arguments (so the machine fails before
|
|
88
|
+
* costing it) and 3 when it failed after being costed.
|
|
89
|
+
*/
|
|
90
|
+
error_kind: number;
|
|
91
|
+
/**
|
|
92
|
+
* The evaluator's description of why the builtin did not return a value;
|
|
93
|
+
* empty when it did.
|
|
94
|
+
*/
|
|
95
|
+
error: string;
|
|
96
|
+
/**
|
|
97
|
+
* The memory the builtin's cost model charges for this application; see
|
|
98
|
+
* `cpu`.
|
|
99
|
+
*/
|
|
100
|
+
mem: bigint;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the builtin returned a value.
|
|
103
|
+
*/
|
|
104
|
+
ok: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* How `result` encodes the value, a [`BuiltinValueKind`] as for the
|
|
107
|
+
* arguments of [`eval_builtin_raw`]; 0 when there is no value.
|
|
108
|
+
*/
|
|
109
|
+
result_kind: number;
|
|
110
|
+
/**
|
|
111
|
+
* The value the builtin returned; empty when there is none.
|
|
112
|
+
*/
|
|
113
|
+
result: Uint8Array;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The outcome of [`eval_program_raw`].
|
|
118
|
+
*/
|
|
119
|
+
export class EvalProgramResult {
|
|
120
|
+
private constructor();
|
|
121
|
+
free(): void;
|
|
122
|
+
[Symbol.dispose](): void;
|
|
123
|
+
/**
|
|
124
|
+
* The CPU the program used. A program that went over budget is charged
|
|
125
|
+
* what it used up to the point where the machine stopped it.
|
|
126
|
+
*/
|
|
127
|
+
cpu: bigint;
|
|
128
|
+
/**
|
|
129
|
+
* Why the program did not succeed: 0 when it did, 1 when it went over
|
|
130
|
+
* budget, 2 when it failed in any other way and 3 when a Plutus V3 program
|
|
131
|
+
* returned something other than unit.
|
|
132
|
+
*/
|
|
133
|
+
error_kind: number;
|
|
134
|
+
/**
|
|
135
|
+
* The messages the program traced, in order.
|
|
136
|
+
*/
|
|
137
|
+
logs: string[];
|
|
138
|
+
/**
|
|
139
|
+
* The memory the program used.
|
|
140
|
+
*/
|
|
141
|
+
mem: bigint;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the program succeeded: it did not fail and, for Plutus V3, it
|
|
144
|
+
* returned unit.
|
|
145
|
+
*/
|
|
146
|
+
ok: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function __wbg_reset_state(): void;
|
|
150
|
+
|
|
151
|
+
export function apply_params_to_script(
|
|
152
|
+
params_bytes: Uint8Array,
|
|
153
|
+
plutus_script_bytes: Uint8Array,
|
|
154
|
+
): Uint8Array;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Evaluates the builtin `tag` applied to `args` as a Plutus V3 script
|
|
158
|
+
* evaluates it at a protocol version, without any program around it: the
|
|
159
|
+
* result, or how it fails, is what the machine gives for the saturated
|
|
160
|
+
* application.
|
|
161
|
+
*
|
|
162
|
+
* - `tag`: the builtin's flat tag (0 for addInteger to 100 for scaleValue).
|
|
163
|
+
* The Miller-loop builtins (68 to 70) are not supported, since their
|
|
164
|
+
* results cannot be returned.
|
|
165
|
+
* - `args`: exactly the builtin's arguments, in order, each encoded as the
|
|
166
|
+
* matching entry of `arg_kinds` says, a [`BuiltinValueKind`]: 0 for a
|
|
167
|
+
* flat-encoded `(program 1.1.0 (con …))`, 1 for a compressed G1 point, 2
|
|
168
|
+
* for a compressed G2 point, 3 for a list of G1 points, 4 for a list of G2
|
|
169
|
+
* points, 5 for an array of G1 points and 6 for an array of G2 points, each
|
|
170
|
+
* list or array as the compressed points one after the other. Flat cannot
|
|
171
|
+
* encode BLS12-381 points, so they cross as their compressed bytes.
|
|
172
|
+
* - `protocol_major_version`: from 9 (Chang, which introduced Plutus V3) to
|
|
173
|
+
* 12 (Dijkstra). It decides which builtins are available and the semantics
|
|
174
|
+
* they have.
|
|
175
|
+
*
|
|
176
|
+
* The result's `cpu` and `mem` are the builtin's charge for the application
|
|
177
|
+
* under Plutus' default Plutus V3 cost model (not the ledger's protocol
|
|
178
|
+
* parameters), excluding the machine's per-step costs.
|
|
179
|
+
*
|
|
180
|
+
* Fails only when the inputs are malformed or unsupported: an unknown or
|
|
181
|
+
* Miller-loop tag, a number of arguments other than the builtin's arity, an
|
|
182
|
+
* argument that does not decode as its kind says or is not a constant, an
|
|
183
|
+
* invalid compressed point, a protocol version out of range, or a result that
|
|
184
|
+
* none of the kinds can encode. A builtin that fails is an
|
|
185
|
+
* [`EvalBuiltinResult`] that is not `ok`.
|
|
186
|
+
*/
|
|
187
|
+
export function eval_builtin_raw(
|
|
188
|
+
tag: number,
|
|
189
|
+
args: Uint8Array[],
|
|
190
|
+
arg_kinds: Uint8Array,
|
|
191
|
+
protocol_major_version: number,
|
|
192
|
+
): EvalBuiltinResult;
|
|
193
|
+
|
|
3
194
|
export function eval_phase_two_raw(
|
|
4
195
|
tx_bytes: Uint8Array,
|
|
5
196
|
utxos_bytes_x: Uint8Array[],
|
|
@@ -12,10 +203,7 @@ export function eval_phase_two_raw(
|
|
|
12
203
|
slot_config_z: number,
|
|
13
204
|
protocol_major_version?: number | null,
|
|
14
205
|
): Uint8Array[];
|
|
15
|
-
|
|
16
|
-
params_bytes: Uint8Array,
|
|
17
|
-
plutus_script_bytes: Uint8Array,
|
|
18
|
-
): Uint8Array;
|
|
206
|
+
|
|
19
207
|
/**
|
|
20
208
|
* Evaluates a UPLC program applied to Data arguments, outside of any
|
|
21
209
|
* transaction: the caller builds whatever arguments the program expects,
|
|
@@ -48,6 +236,7 @@ export function eval_program_raw(
|
|
|
48
236
|
budget_mem: bigint,
|
|
49
237
|
strict_budget: boolean,
|
|
50
238
|
): EvalProgramResult;
|
|
239
|
+
|
|
51
240
|
/**
|
|
52
241
|
* Describes this build of the evaluator as JSON: the uplc crate it was built
|
|
53
242
|
* from, the length of each Plutus version's cost model, and a digest of what a
|
|
@@ -56,34 +245,3 @@ export function eval_program_raw(
|
|
|
56
245
|
* programs; `selfTest` says whether this one gives the expected results.
|
|
57
246
|
*/
|
|
58
247
|
export function uplc_build_info(): string;
|
|
59
|
-
/**
|
|
60
|
-
* The outcome of [`eval_program_raw`].
|
|
61
|
-
*/
|
|
62
|
-
export class EvalProgramResult {
|
|
63
|
-
private constructor();
|
|
64
|
-
free(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Whether the program succeeded: it did not fail and, for Plutus V3, it
|
|
67
|
-
* returned unit.
|
|
68
|
-
*/
|
|
69
|
-
ok: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* The CPU the program used. A program that went over budget is charged
|
|
72
|
-
* what it used up to the point where the machine stopped it.
|
|
73
|
-
*/
|
|
74
|
-
cpu: bigint;
|
|
75
|
-
/**
|
|
76
|
-
* The memory the program used.
|
|
77
|
-
*/
|
|
78
|
-
mem: bigint;
|
|
79
|
-
/**
|
|
80
|
-
* Why the program did not succeed: 0 when it did, 1 when it went over
|
|
81
|
-
* budget, 2 when it failed in any other way and 3 when a Plutus V3 program
|
|
82
|
-
* returned something other than unit.
|
|
83
|
-
*/
|
|
84
|
-
error_kind: number;
|
|
85
|
-
/**
|
|
86
|
-
* The messages the program traced, in order.
|
|
87
|
-
*/
|
|
88
|
-
logs: string[];
|
|
89
|
-
}
|