@cardananium/cquisitor-lib 0.1.0-beta.7 → 0.1.0-beta.8
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/{browser/cquisitor_lib_bg.wasm → cquisitor_lib_bg.wasm} +0 -0
- package/node/cquisitor_lib.d.ts +417 -0
- package/node/cquisitor_lib.js +39586 -0
- package/node/cquisitor_lib_bg.wasm +0 -0
- package/node/cquisitor_lib_bg.wasm.d.ts +2437 -0
- package/package.json +16 -12
- package/{browser/cquisitor_lib.d.ts → cquisitor_lib.d.ts} +0 -0
- package/{browser/cquisitor_lib.js → cquisitor_lib.js} +35 -35
- /package/{browser/cquisitor_lib_bg.wasm.d.ts → cquisitor_lib_bg.wasm.d.ts} +0 -0
|
Binary file
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns {(string)[]}
|
|
3
|
+
*/
|
|
4
|
+
export function get_decodable_types(): (string)[];
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} input
|
|
7
|
+
* @param {string} type_name
|
|
8
|
+
* @param {any} params_json
|
|
9
|
+
* @returns {any}
|
|
10
|
+
*/
|
|
11
|
+
export function decode_specific_type(input: string, type_name: string, params_json: DecodingParams): any;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} input
|
|
14
|
+
* @returns {(string)[]}
|
|
15
|
+
*/
|
|
16
|
+
export function get_possible_types_for_input(input: string): (string)[];
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} cbor_hex
|
|
19
|
+
* @returns {any}
|
|
20
|
+
*/
|
|
21
|
+
export function cbor_to_json(cbor_hex: string): CborValue;
|
|
22
|
+
|
|
23
|
+
export function check_block_or_tx_signatures(hex_str: string): CheckSignaturesResult;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} tx_hex
|
|
27
|
+
* @returns {(string)[]}
|
|
28
|
+
*/
|
|
29
|
+
export function get_utxo_list_from_tx(tx_hex: string): string[];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} tx_hex
|
|
33
|
+
* @param {UTxO[]} utxo_json
|
|
34
|
+
* @param {CostModels} cost_models_json
|
|
35
|
+
* @returns {ExecuteTxScriptsResult}
|
|
36
|
+
*/
|
|
37
|
+
export function execute_tx_scripts(tx_hex: string, utxo_json: UTxO[], cost_models_json: CostModels): ExecuteTxScriptsResult;
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} hex
|
|
40
|
+
* @returns {ProgramJson}
|
|
41
|
+
*/
|
|
42
|
+
export function decode_plutus_program_uplc_json(hex: string): ProgramJson;
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} hex
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
export function decode_plutus_program_pretty_uplc(hex: string): string;
|
|
48
|
+
|
|
49
|
+
export interface CborPosition {
|
|
50
|
+
offset: number;
|
|
51
|
+
length: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type CborSimpleType =
|
|
55
|
+
| "Null"
|
|
56
|
+
| "Bool"
|
|
57
|
+
| "U8"
|
|
58
|
+
| "U16"
|
|
59
|
+
| "U32"
|
|
60
|
+
| "U64"
|
|
61
|
+
| "I8"
|
|
62
|
+
| "I16"
|
|
63
|
+
| "I32"
|
|
64
|
+
| "I64"
|
|
65
|
+
| "Int"
|
|
66
|
+
| "F16"
|
|
67
|
+
| "F32"
|
|
68
|
+
| "F64"
|
|
69
|
+
| "Bytes"
|
|
70
|
+
| "String"
|
|
71
|
+
| "Simple"
|
|
72
|
+
| "Undefined"
|
|
73
|
+
| "Break";
|
|
74
|
+
|
|
75
|
+
export interface CborSimple {
|
|
76
|
+
position_info: CborPosition;
|
|
77
|
+
struct_position_info?: CborPosition;
|
|
78
|
+
value: any;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface CborArray {
|
|
82
|
+
type: "Array";
|
|
83
|
+
position_info: CborPosition;
|
|
84
|
+
struct_position_info: CborPosition;
|
|
85
|
+
items: number | "Indefinite";
|
|
86
|
+
values: CborValue[]; // nested
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface CborMap {
|
|
90
|
+
type: "Map";
|
|
91
|
+
position_info: CborPosition;
|
|
92
|
+
struct_position_info: CborPosition;
|
|
93
|
+
items: number | "Indefinite";
|
|
94
|
+
values: {
|
|
95
|
+
key: CborValue;
|
|
96
|
+
value: CborValue;
|
|
97
|
+
}[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface CborTag {
|
|
101
|
+
type: "Tag";
|
|
102
|
+
position_info: CborPosition;
|
|
103
|
+
struct_position_info: CborPosition;
|
|
104
|
+
tag: string;
|
|
105
|
+
value: CborValue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface CborIndefiniteString {
|
|
109
|
+
type: "IndefiniteLengthString";
|
|
110
|
+
position_info: CborPosition;
|
|
111
|
+
struct_position_info: CborPosition;
|
|
112
|
+
chunks: CborValue[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface CborIndefiniteBytes {
|
|
116
|
+
type: "IndefiniteLengthBytes";
|
|
117
|
+
position_info: CborPosition;
|
|
118
|
+
struct_position_info: CborPosition;
|
|
119
|
+
chunks: CborValue[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type CborValue =
|
|
123
|
+
| CborSimple
|
|
124
|
+
| CborArray
|
|
125
|
+
| CborMap
|
|
126
|
+
| CborTag
|
|
127
|
+
| CborIndefiniteString
|
|
128
|
+
| CborIndefiniteBytes;
|
|
129
|
+
|
|
130
|
+
export interface DecodingParams {
|
|
131
|
+
plutus_script_version?: number;
|
|
132
|
+
plutus_data_schema?: PlutusDataSchema;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type PlutusDataSchema = "BasicConversions" | "DetailedSchema";
|
|
136
|
+
|
|
137
|
+
export interface CheckSignaturesResult {
|
|
138
|
+
/** Indicates whether the transaction or block is valid. */
|
|
139
|
+
valid: boolean;
|
|
140
|
+
/** The transaction hash as a hexadecimal string (if available). */
|
|
141
|
+
tx_hash?: string;
|
|
142
|
+
/** An array of invalid Catalyst witness signatures (hex strings). */
|
|
143
|
+
invalidCatalystWitnesses: string[];
|
|
144
|
+
/** An array of invalid VKey witness signatures (hex strings). */
|
|
145
|
+
invalidVkeyWitnesses: string[];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
// The execution units object contains two numeric fields.
|
|
150
|
+
export type ExUnits = {
|
|
151
|
+
steps: number;
|
|
152
|
+
mem: number;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// The redeemer tag is one of the following literal strings.
|
|
156
|
+
export type RedeemerTag = "Spend" | "Mint" | "Cert" | "Reward" | "Propose" | "Vote";
|
|
157
|
+
|
|
158
|
+
// A successful redeemer evaluation contains the original execution units,
|
|
159
|
+
// the calculated execution units, and additional redeemer info.
|
|
160
|
+
export interface RedeemerSuccess {
|
|
161
|
+
original_ex_units: ExUnits;
|
|
162
|
+
calculated_ex_units: ExUnits;
|
|
163
|
+
redeemer_index: number;
|
|
164
|
+
redeemer_tag: RedeemerTag;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// A failed redeemer evaluation contains the original execution units,
|
|
168
|
+
// an error message, and additional redeemer info.
|
|
169
|
+
export interface RedeemerError {
|
|
170
|
+
original_ex_units: ExUnits;
|
|
171
|
+
error: string;
|
|
172
|
+
redeemer_index: number;
|
|
173
|
+
redeemer_tag: RedeemerTag;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// The result from executing the transaction scripts is an array of redeemer results.
|
|
177
|
+
// Each result can be either a success or an error.
|
|
178
|
+
export type RedeemerResult = RedeemerSuccess | RedeemerError;
|
|
179
|
+
|
|
180
|
+
// Type for the `execute_tx_scripts` response after JSON-parsing.
|
|
181
|
+
export type ExecuteTxScriptsResult = RedeemerResult[];
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// The overall JSON produced by `to_json_program`:
|
|
185
|
+
export interface ProgramJson {
|
|
186
|
+
program: {
|
|
187
|
+
version: string;
|
|
188
|
+
term: Term;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// A UPLC term can be one of several forms.
|
|
193
|
+
export type Term =
|
|
194
|
+
| VarTerm
|
|
195
|
+
| DelayTerm
|
|
196
|
+
| LambdaTerm
|
|
197
|
+
| ApplyTerm
|
|
198
|
+
| ConstantTerm
|
|
199
|
+
| ForceTerm
|
|
200
|
+
| ErrorTerm
|
|
201
|
+
| BuiltinTerm
|
|
202
|
+
| ConstrTerm
|
|
203
|
+
| CaseTerm;
|
|
204
|
+
|
|
205
|
+
export interface VarTerm {
|
|
206
|
+
var: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface DelayTerm {
|
|
210
|
+
delay: Term;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface LambdaTerm {
|
|
214
|
+
lambda: {
|
|
215
|
+
parameter_name: string;
|
|
216
|
+
body: Term;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface ApplyTerm {
|
|
221
|
+
apply: {
|
|
222
|
+
function: Term;
|
|
223
|
+
argument: Term;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface ConstantTerm {
|
|
228
|
+
constant: Constant;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface ForceTerm {
|
|
232
|
+
force: Term;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface ErrorTerm {
|
|
236
|
+
error: "error";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface BuiltinTerm {
|
|
240
|
+
builtin: string;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface ConstrTerm {
|
|
244
|
+
constr: {
|
|
245
|
+
tag: number;
|
|
246
|
+
fields: Term[];
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface CaseTerm {
|
|
251
|
+
case: {
|
|
252
|
+
constr: Term;
|
|
253
|
+
branches: Term[];
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// The UPLC constant is one of several union types.
|
|
258
|
+
export type Constant =
|
|
259
|
+
| IntegerConstant
|
|
260
|
+
| ByteStringConstant
|
|
261
|
+
| StringConstant
|
|
262
|
+
| UnitConstant
|
|
263
|
+
| BoolConstant
|
|
264
|
+
| ListConstant
|
|
265
|
+
| PairConstant
|
|
266
|
+
| DataConstant
|
|
267
|
+
| Bls12_381G1ElementConstant
|
|
268
|
+
| Bls12_381G2ElementConstant;
|
|
269
|
+
|
|
270
|
+
export interface IntegerConstant {
|
|
271
|
+
integer: string; // represented as a string
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface ByteStringConstant {
|
|
275
|
+
bytestring: string; // hex-encoded string
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface StringConstant {
|
|
279
|
+
string: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface UnitConstant {
|
|
283
|
+
unit: "()";
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface BoolConstant {
|
|
287
|
+
bool: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface ListConstant {
|
|
291
|
+
list: {
|
|
292
|
+
type: Type;
|
|
293
|
+
items: Constant[];
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface PairConstant {
|
|
298
|
+
pair: {
|
|
299
|
+
type_left: Type;
|
|
300
|
+
type_right: Type;
|
|
301
|
+
left: Constant;
|
|
302
|
+
right: Constant;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface DataConstant {
|
|
307
|
+
data: PlutusData;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface Bls12_381G1ElementConstant {
|
|
311
|
+
bls12_381_G1_element: {
|
|
312
|
+
x: number;
|
|
313
|
+
y: number;
|
|
314
|
+
z: number;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface Bls12_381G2ElementConstant {
|
|
319
|
+
bls12_381_G2_element: BlstP2;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// The UPLC type is represented either as a string literal or an object.
|
|
323
|
+
export type Type =
|
|
324
|
+
| "bool"
|
|
325
|
+
| "integer"
|
|
326
|
+
| "string"
|
|
327
|
+
| "bytestring"
|
|
328
|
+
| "unit"
|
|
329
|
+
| "data"
|
|
330
|
+
| "bls12_381_G1_element"
|
|
331
|
+
| "bls12_381_G2_element"
|
|
332
|
+
| "bls12_381_mlresult"
|
|
333
|
+
| ListType
|
|
334
|
+
| PairType;
|
|
335
|
+
|
|
336
|
+
export interface ListType {
|
|
337
|
+
list: Type;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface PairType {
|
|
341
|
+
pair: {
|
|
342
|
+
left: Type;
|
|
343
|
+
right: Type;
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// The JSON representation for a blst_p2 element: each coordinate is an array of numbers.
|
|
348
|
+
export interface BlstP2 {
|
|
349
|
+
x: number[];
|
|
350
|
+
y: number[];
|
|
351
|
+
z: number[];
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Plutus data is also a tagged union.
|
|
355
|
+
export type PlutusData =
|
|
356
|
+
| ConstrData
|
|
357
|
+
| MapData
|
|
358
|
+
| BigIntData
|
|
359
|
+
| BoundedBytesData
|
|
360
|
+
| ArrayData;
|
|
361
|
+
|
|
362
|
+
export interface ConstrData {
|
|
363
|
+
constr: {
|
|
364
|
+
tag: number;
|
|
365
|
+
any_constructor: boolean;
|
|
366
|
+
fields: PlutusData[];
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export interface MapData {
|
|
371
|
+
map: Array<{
|
|
372
|
+
key: PlutusData;
|
|
373
|
+
value: PlutusData;
|
|
374
|
+
}>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface BigIntData {
|
|
378
|
+
integer: string; // big integers are represented as strings
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface BoundedBytesData {
|
|
382
|
+
bytestring: string; // hex-encoded
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface ArrayData {
|
|
386
|
+
list: PlutusData[];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface Asset {
|
|
390
|
+
unit: string;
|
|
391
|
+
quantity: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface TxInput {
|
|
395
|
+
outputIndex: number;
|
|
396
|
+
txHash: string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export interface TxOutput {
|
|
400
|
+
address: string;
|
|
401
|
+
amount: Asset[];
|
|
402
|
+
dataHash?: string;
|
|
403
|
+
plutusData?: string;
|
|
404
|
+
scriptRef?: string;
|
|
405
|
+
scriptHash?: string;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface UTxO {
|
|
409
|
+
input: TxInput;
|
|
410
|
+
output: TxOutput;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export interface CostModels {
|
|
414
|
+
plutusV1?: number[];
|
|
415
|
+
plutusV2?: number[];
|
|
416
|
+
plutusV3?: number[];
|
|
417
|
+
}
|