@cardananium/cquisitor-lib 0.1.0-beta.50 → 0.1.0-beta.52
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 +62 -4
- package/browser/cquisitor_lib.d.ts +125 -0
- package/browser/cquisitor_lib.js +1 -1
- package/browser/cquisitor_lib_bg.js +130 -0
- package/browser/cquisitor_lib_bg.wasm +0 -0
- package/browser/cquisitor_lib_bg.wasm.d.ts +10 -5
- package/node/cquisitor_lib.d.ts +125 -0
- package/node/cquisitor_lib.js +135 -0
- package/node/cquisitor_lib_bg.wasm +0 -0
- package/node/cquisitor_lib_bg.wasm.d.ts +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,9 +25,13 @@ Functions:
|
|
|
25
25
|
### CBOR Decoder & CDDL Validation
|
|
26
26
|
|
|
27
27
|
- `cbor_to_json(cbor_hex)` - Converts raw CBOR to JSON with positional information, supporting indefinite arrays/maps and all CBOR types. Each node carries an optional `oddities` array flagging deviations from RFC 8949 deterministic encoding (overlong integers/floats, indefinite length, unsorted/duplicate map keys, non-canonical bignums). Never throws on malformed input — returns a `{ok, value}` / `{ok: false, error, partial?}` union where `error` is a structured `CborDecodeError` (kind / byte offset / byte span / semantic `path`) and `partial` is the sub-tree decoded before the failure, with every unfinished container flagged `incomplete: true`.
|
|
28
|
-
- `validate_cddl(cddl)` - Parses a CDDL schema; reports parse errors and unresolved rule references (e.g. `thing = [unknown_rule, int]` → `kind: "unresolved_references"`).
|
|
29
|
-
- `validate_cbor_against_cddl(cbor_hex, cddl, rule_name)` - Validates a CBOR payload against a named rule. Errors carry `kind`, `expected`, semantic `path`, byte/anchor spans, and an `additional` array when multiple violations fire.
|
|
28
|
+
- `validate_cddl(cddl)` - Parses a CDDL schema; reports parse errors (with a `byte_span` for editor squiggles) and unresolved rule references (e.g. `thing = [unknown_rule, int]` → `kind: "unresolved_references"`).
|
|
29
|
+
- `validate_cbor_against_cddl(cbor_hex, cddl, rule_name)` - Validates a CBOR payload against a named rule. Errors carry `kind`, `expected`, semantic `path`, byte/anchor spans, a `cddl_byte_span` pointing at the failing CDDL type, and an `additional` array when multiple violations fire.
|
|
30
30
|
- `decode_cbor_against_cddl(cbor_hex, cddl, rule_name)` - Maps decoded CBOR onto a CDDL schema and returns labelled JSON (e.g. Cardano `[body, witness_set, bool, aux]` becomes `{transaction_body, transaction_witness_set, ...}`). Handles generics (`set<a>`), tagged sets, type rules used as field labels, and a few well-known tags (bignum → string number, datetime → ISO string). Sub-structures the schema doesn't cover surface under `@extra` / `@positional` so partial matches don't lose data.
|
|
31
|
+
- `cddl_outline(cddl)` - Returns one `{name, kind, span, name_span}` entry per top-level rule. Editor outline view, breadcrumbs, fuzzy "go to rule".
|
|
32
|
+
- `cddl_references(cddl, name)` - Returns `{definition, uses[]}` byte ranges for a rule name. Powers find-references and same-name highlighting on cursor.
|
|
33
|
+
- `cddl_symbol_at(cddl, offset)` - Returns the symbol under the cursor (or `null`), with `role: "definition" | "use"` and a `definition_span` pointing at its rule. Powers hover and Cmd-click go-to-definition.
|
|
34
|
+
- `cddl_format(cddl)` - Pretty-prints CDDL by round-tripping through the AST. Useful for format-on-save.
|
|
31
35
|
|
|
32
36
|
### Plutus Script Decoder
|
|
33
37
|
|
|
@@ -349,9 +353,15 @@ validate_cddl("thing = {n: uint}");
|
|
|
349
353
|
validate_cddl("thing = [unknown_rule, int]");
|
|
350
354
|
// { valid: false, error: { kind: "unresolved_references",
|
|
351
355
|
// message: "missing definition for rule unknown_rule" } }
|
|
356
|
+
|
|
357
|
+
validate_cddl("; only a comment\n");
|
|
358
|
+
// { valid: false, error: { kind: "no_rules",
|
|
359
|
+
// message: "CDDL document defines no rules" } }
|
|
352
360
|
```
|
|
353
361
|
|
|
354
|
-
`
|
|
362
|
+
Parser errors include a `byte_span: {offset, length, line}` so editors can squiggle the exact position pest tripped on.
|
|
363
|
+
|
|
364
|
+
`error.kind` values: `"parse_error"`, `"unresolved_references"`, `"no_rules"`.
|
|
355
365
|
|
|
356
366
|
#### `validate_cbor_against_cddl(cbor_hex: string, cddl: string, rule_name: string): { valid: boolean, error?: object }`
|
|
357
367
|
|
|
@@ -366,12 +376,17 @@ validate_cbor_against_cddl("01", "thing = tstr", "thing");
|
|
|
366
376
|
// expected: "tstr",
|
|
367
377
|
// path: "$",
|
|
368
378
|
// byte_spans: [{ offset: 0, length: 1 }],
|
|
379
|
+
// cddl_byte_span: { offset: 8, length: 4, line: 1 }, // points at `tstr`
|
|
369
380
|
// message: "expected type tstr, got Integer(Integer(1))"
|
|
370
381
|
// }
|
|
371
382
|
// }
|
|
372
383
|
```
|
|
373
384
|
|
|
374
|
-
`error.
|
|
385
|
+
`error.cddl_byte_span` carries the byte range in the **CDDL source** pointing at the type the validator tried (and failed) to apply — useful for highlighting the offending rule in an editor. It's synthesised by walking the AST in parallel with `path`, so it's available for any error that has a meaningful `path`. When the `rule_name` you passed isn't the first rule of the document, the offsets are still expressed in *your* CDDL coordinates (the wrapper we use internally is invisible to callers).
|
|
386
|
+
|
|
387
|
+
`error.kind` values: `"parse_error"`, `"unresolved_references"`, `"no_rules"`, `"missing_rule"`, `"input_parse"`, `"mismatch"`, `"map_cut"`, `"generic"`. When multiple violations fire, the headline goes in the top-level fields and the rest land in `error.additional`.
|
|
388
|
+
|
|
389
|
+
`anchor_spans` is always populated — for container values (Map / Array / Tag / indefinite strings) it covers the whole structure; for scalars it falls back to `position_info` so a UI's halo highlight always has something to draw.
|
|
375
390
|
|
|
376
391
|
#### `decode_cbor_against_cddl(cbor_hex: string, cddl: string, rule_name: string): unknown`
|
|
377
392
|
|
|
@@ -395,6 +410,49 @@ decode_cbor_against_cddl(txHex, conwayCddl, "transaction");
|
|
|
395
410
|
|
|
396
411
|
Recognised features: type choices (first match wins), generics (`set<a>`), tagged data (well-known tags 0/2/3 specialised to ISO date / bignum string), rule references, optionals/repetitions, prelude scalars. Sub-structures the schema doesn't cover or that don't match any choice fall back to a raw form under `@extra` (maps) or `@positional` (arrays) so data is never silently dropped.
|
|
397
412
|
|
|
413
|
+
#### CDDL editor primitives
|
|
414
|
+
|
|
415
|
+
For embedding a CDDL editor / inspector. All four functions parse the document with the same checked parser as `validate_cddl` and throw on parse errors.
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
// Document outline — list every rule with its byte range.
|
|
419
|
+
cddl_outline("alpha = uint\nbeta = (a: int)");
|
|
420
|
+
// [
|
|
421
|
+
// {name: "alpha", kind: "type", span: {offset: 0, length: 12, line: 1},
|
|
422
|
+
// name_span: {offset: 0, length: 5, line: 1}},
|
|
423
|
+
// {name: "beta", kind: "group", span: {offset: 13, length: 14, line: 2},
|
|
424
|
+
// name_span: {offset: 13, length: 4, line: 2}}
|
|
425
|
+
// ]
|
|
426
|
+
|
|
427
|
+
// Find every use of a rule — the IDE "Find references" affordance.
|
|
428
|
+
cddl_references("coin = uint\noutput = [bstr, coin]\nfee = coin", "coin");
|
|
429
|
+
// {definition: {offset: 0, length: 4, line: 1},
|
|
430
|
+
// uses: [
|
|
431
|
+
// {offset: 26, length: 4, line: 2},
|
|
432
|
+
// {offset: 38, length: 4, line: 3}
|
|
433
|
+
// ]}
|
|
434
|
+
|
|
435
|
+
// Symbol at cursor — hover info and Cmd-click target.
|
|
436
|
+
cddl_symbol_at("coin = uint\nfee = coin", /* offset = */ 18);
|
|
437
|
+
// {name: "coin", kind: "rule_reference", role: "use",
|
|
438
|
+
// span: {offset: 18, length: 4, line: 2},
|
|
439
|
+
// definition_span: {offset: 0, length: 4, line: 1},
|
|
440
|
+
// rule_span: {offset: 0, length: 11, line: 1}}
|
|
441
|
+
|
|
442
|
+
// Re-format — round-trip via Display. Comments survive
|
|
443
|
+
// (both standalone `; …` and trailing `; …`).
|
|
444
|
+
cddl_format("; header\nalpha = uint ; trailing");
|
|
445
|
+
// "; header\nalpha = uint ; trailing\n"
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
`validate_cddl` itself returns a `byte_span` on parser errors so editor-side squiggles can underline the offending position directly:
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
validate_cddl("alpha = ");
|
|
452
|
+
// {valid: false,
|
|
453
|
+
// error: {kind: "parse_error", message: "...", byte_span: {offset: 8, length: 0, line: 1}}}
|
|
454
|
+
```
|
|
455
|
+
|
|
398
456
|
### Plutus Script Decoder
|
|
399
457
|
|
|
400
458
|
#### `decode_plutus_program_uplc_json(hex: string): ProgramJson`
|
|
@@ -171,6 +171,113 @@ export function validate_cbor_against_cddl(
|
|
|
171
171
|
rule_name: string
|
|
172
172
|
): CborValidationResult;
|
|
173
173
|
|
|
174
|
+
/** Outline entry — one rule from `cddl_outline`. */
|
|
175
|
+
export interface CddlOutlineEntry {
|
|
176
|
+
/** Rule name (`transaction_body`, `set`, …). */
|
|
177
|
+
name: string;
|
|
178
|
+
/** `"type"` for `=`, `"group"` for `( … )`. */
|
|
179
|
+
kind: "type" | "group";
|
|
180
|
+
/** Byte range covering the whole `name = …` rule definition. */
|
|
181
|
+
span: { offset: number; length: number; line: number };
|
|
182
|
+
/** Byte range of just the rule's name identifier. */
|
|
183
|
+
name_span: { offset: number; length: number; line: number };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Result of `cddl_symbol_at`. `null` when the cursor isn't on an identifier. */
|
|
187
|
+
export type CddlSymbolAtResult =
|
|
188
|
+
| null
|
|
189
|
+
| {
|
|
190
|
+
name: string;
|
|
191
|
+
kind: "type" | "group" | "rule_reference" | "prelude_or_unknown";
|
|
192
|
+
role: "definition" | "use";
|
|
193
|
+
span: { offset: number; length: number; line: number };
|
|
194
|
+
definition_span: { offset: number; length: number; line: number } | null;
|
|
195
|
+
rule_span: { offset: number; length: number; line: number } | null;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** Result of `cddl_references`. */
|
|
199
|
+
export interface CddlReferencesResult {
|
|
200
|
+
definition: { offset: number; length: number; line: number } | null;
|
|
201
|
+
uses: { offset: number; length: number; line: number }[];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns one entry per top-level rule (`{name, kind, span, name_span}`).
|
|
206
|
+
* Used for editor outline view, breadcrumbs, fuzzy "go to rule".
|
|
207
|
+
* @param cddl
|
|
208
|
+
*/
|
|
209
|
+
export function cddl_outline(cddl: string): CddlOutlineEntry[];
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns `{definition, uses[]}` byte ranges for the rule named `name`.
|
|
213
|
+
* Powers find-references and rename-aware highlighting.
|
|
214
|
+
* @param cddl
|
|
215
|
+
* @param name
|
|
216
|
+
*/
|
|
217
|
+
export function cddl_references(cddl: string, name: string): CddlReferencesResult;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Returns the symbol under `offset` (or `null` if none). For uses,
|
|
221
|
+
* `definition_span` points at the rule's name — the "go to definition"
|
|
222
|
+
* target.
|
|
223
|
+
* @param cddl
|
|
224
|
+
* @param offset
|
|
225
|
+
*/
|
|
226
|
+
export function cddl_symbol_at(cddl: string, offset: number): CddlSymbolAtResult;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Pretty-prints the CDDL by parsing it and serialising via `Display`.
|
|
230
|
+
* Useful for "format on save". Throws on invalid input.
|
|
231
|
+
* @param cddl
|
|
232
|
+
*/
|
|
233
|
+
export function cddl_format(cddl: string): string;
|
|
234
|
+
|
|
235
|
+
/** One entry from `map_cbor_to_cddl`: a single position of a CBOR
|
|
236
|
+
* node, the type that matched it, and the path it ends up at in the
|
|
237
|
+
* output of `decode_cbor_against_cddl`. */
|
|
238
|
+
export interface CborCddlMapEntry {
|
|
239
|
+
/** Path into the *raw* CBOR tree (numeric map keys are bracketed). */
|
|
240
|
+
cbor_path: string;
|
|
241
|
+
/** Path into the labelled JSON returned by `decode_cbor_against_cddl`.
|
|
242
|
+
* Numeric map keys come back as bracket-quoted strings (`["0"]`)
|
|
243
|
+
* because decoded JSON has only string keys; identifier-safe keys
|
|
244
|
+
* use dot notation (`.name`). For unspecialised tags (anything
|
|
245
|
+
* except 0 / 2 / 3) the inner gets an extra `["@value"]` segment
|
|
246
|
+
* to match the `{@tag, @value}` wrapper the decoder emits. */
|
|
247
|
+
decoded_path: string;
|
|
248
|
+
/** Header byte range of the CBOR node. */
|
|
249
|
+
cbor_byte_span: { offset: number; length: number };
|
|
250
|
+
/** Whole-structure byte range (= `cbor_byte_span` for scalars). */
|
|
251
|
+
cbor_anchor_span: { offset: number; length: number };
|
|
252
|
+
/** Byte range in the CDDL source describing this position. */
|
|
253
|
+
cddl_byte_span: { offset: number; length: number; line: number };
|
|
254
|
+
/** Name of the CDDL rule that matched, if a rule boundary was crossed. */
|
|
255
|
+
rule_name?: string;
|
|
256
|
+
/** CBOR node's wire type (`U8`, `Bytes`, `Map`, `Array`, `Tag`, …). */
|
|
257
|
+
cbor_type?: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Returns a flat list of mapping entries pairing each visited CBOR node
|
|
262
|
+
* with the CDDL position that describes it. Use it to wire
|
|
263
|
+
* bidirectional highlight between a CBOR panel and a CDDL panel without
|
|
264
|
+
* needing a validation error to trigger it.
|
|
265
|
+
*
|
|
266
|
+
* Order is depth-first pre-order, so a parent's entry precedes its
|
|
267
|
+
* children's. Tags in the CBOR are transparent to the path grammar
|
|
268
|
+
* (anweiss-style): `Tag(258, [...])` is walked as if the tag wrapper
|
|
269
|
+
* weren't there when matching against `[* a]`-shaped schemas.
|
|
270
|
+
*
|
|
271
|
+
* @param cbor_hex
|
|
272
|
+
* @param cddl
|
|
273
|
+
* @param rule_name
|
|
274
|
+
*/
|
|
275
|
+
export function map_cbor_to_cddl(
|
|
276
|
+
cbor_hex: string,
|
|
277
|
+
cddl: string,
|
|
278
|
+
rule_name: string
|
|
279
|
+
): CborCddlMapEntry[];
|
|
280
|
+
|
|
174
281
|
/**
|
|
175
282
|
* Maps decoded CBOR onto a CDDL schema and returns labelled JSON. Where
|
|
176
283
|
* `cbor_to_json` returns positional CBOR (numeric map keys, raw arrays),
|
|
@@ -408,6 +515,11 @@ export type CddlValidationResult =
|
|
|
408
515
|
export interface CddlErrorInfo {
|
|
409
516
|
kind: string;
|
|
410
517
|
message: string;
|
|
518
|
+
/**
|
|
519
|
+
* Byte range in the CDDL source the parser tripped over, when the
|
|
520
|
+
* error has positional info. Useful for IDE squiggly underlines.
|
|
521
|
+
*/
|
|
522
|
+
byte_span?: { offset: number; length: number; line: number };
|
|
411
523
|
}
|
|
412
524
|
|
|
413
525
|
export type CborValidationResult =
|
|
@@ -418,6 +530,7 @@ export type CborValidationResult =
|
|
|
418
530
|
* `kind` categorises the failure:
|
|
419
531
|
* - "parse_error" — the CDDL itself failed to parse
|
|
420
532
|
* - "unresolved_references" — the CDDL references a rule name that isn't defined
|
|
533
|
+
* - "no_rules" — the CDDL parsed but defined no rules (empty / comment-only document)
|
|
421
534
|
* - "missing_rule" — the rule name passed to `validate_cbor_against_cddl` is not in the CDDL
|
|
422
535
|
* - "input_parse" — the CBOR bytes themselves are malformed
|
|
423
536
|
* - "mismatch" / "map_cut" — a data mismatch; inspect `expected`, `path`,
|
|
@@ -428,9 +541,21 @@ export interface CborValidationErrorInfo {
|
|
|
428
541
|
kind: string;
|
|
429
542
|
message: string;
|
|
430
543
|
expected?: string;
|
|
544
|
+
/** Semantic path into the CBOR (e.g. `$.b[0]`). */
|
|
431
545
|
path?: string;
|
|
546
|
+
/** Byte range in the CBOR input that triggered the error. */
|
|
432
547
|
byte_spans?: CborPosition[];
|
|
548
|
+
/** Byte range covering the whole containing CBOR structure. */
|
|
433
549
|
anchor_spans?: CborPosition[];
|
|
550
|
+
/**
|
|
551
|
+
* Byte range in the CDDL **source** pointing at the type the
|
|
552
|
+
* validator tried to apply when it failed (synthesised by walking
|
|
553
|
+
* the AST in parallel with `path`). Useful for highlighting the
|
|
554
|
+
* offending CDDL rule in editors.
|
|
555
|
+
*/
|
|
556
|
+
cddl_byte_span?: { offset: number; length: number; line: number };
|
|
557
|
+
/** Other validation errors reported in the same run. */
|
|
558
|
+
additional?: CborValidationErrorInfo[];
|
|
434
559
|
}
|
|
435
560
|
|
|
436
561
|
export interface DecodingParams {
|
package/browser/cquisitor_lib.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./cquisitor_lib_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
Address, AddressKind, Anchor, AnchorDataHash, AssetName, AssetNames, Assets, AuxiliaryData, AuxiliaryDataHash, AuxiliaryDataSet, BaseAddress, BigInt, BigNum, Bip32PrivateKey, Bip32PublicKey, Block, BlockEra, BlockHash, BootstrapWitness, BootstrapWitnesses, ByronAddress, ByronAddressType, CborContainerType, CborSetType, Certificate, CertificateKind, Certificates, CertificatesBuilder, ChangeConfig, CoinSelectionStrategyCIP2, Committee, CommitteeColdResign, CommitteeHotAuth, Constitution, ConstrPlutusData, CostModel, Costmdls, CredKind, Credential, Credentials, DNSRecordAorAAAA, DNSRecordSRV, DRep, DRepDeregistration, DRepKind, DRepRegistration, DRepUpdate, DRepVotingThresholds, DataCost, DataHash, DatumSource, Ed25519KeyHash, Ed25519KeyHashes, Ed25519Signature, EnterpriseAddress, ExUnitPrices, ExUnits, FixedBlock, FixedTransaction, FixedTransactionBodies, FixedTransactionBody, FixedTxWitnessesSet, FixedVersionedBlock, GeneralTransactionMetadata, GenesisDelegateHash, GenesisHash, GenesisHashes, GenesisKeyDelegation, GovernanceAction, GovernanceActionId, GovernanceActionIds, GovernanceActionKind, HardForkInitiationAction, Header, HeaderBody, InfoAction, Int, Ipv4, Ipv6, KESSignature, KESVKey, Language, LanguageKind, Languages, LegacyDaedalusPrivateKey, LinearFee, MIRKind, MIRPot, MIRToStakeCredentials, MalformedAddress, MetadataJsonSchema, MetadataList, MetadataMap, Mint, MintAssets, MintBuilder, MintWitness, MintsAssets, MoveInstantaneousReward, MoveInstantaneousRewardsCert, MultiAsset, MultiHostName, NativeScript, NativeScriptKind, NativeScriptSource, NativeScripts, NetworkId, NetworkIdKind, NetworkInfo, NewConstitutionAction, NoConfidenceAction, Nonce, OperationalCert, OutputDatum, ParameterChangeAction, PlutusData, PlutusDataKind, PlutusDatumSchema, PlutusList, PlutusMap, PlutusMapValues, PlutusScript, PlutusScriptSource, PlutusScripts, PlutusWitness, PlutusWitnesses, Pointer, PointerAddress, PoolMetadata, PoolMetadataHash, PoolParams, PoolRegistration, PoolRetirement, PoolVotingThresholds, PrivateKey, ProposedProtocolParameterUpdates, ProtocolParamUpdate, ProtocolVersion, PublicKey, PublicKeys, Redeemer, RedeemerTag, RedeemerTagKind, Redeemers, Relay, RelayKind, Relays, RewardAddress, RewardAddresses, ScriptAll, ScriptAny, ScriptDataHash, ScriptHash, ScriptHashNamespace, ScriptHashes, ScriptNOfK, ScriptPubkey, ScriptRef, ScriptSchema, SingleHostAddr, SingleHostName, StakeAndVoteDelegation, StakeDelegation, StakeDeregistration, StakeRegistration, StakeRegistrationAndDelegation, StakeVoteRegistrationAndDelegation, Strings, TimelockExpiry, TimelockStart, Transaction, TransactionBatch, TransactionBatchList, TransactionBodies, TransactionBody, TransactionBuilder, TransactionBuilderConfig, TransactionBuilderConfigBuilder, TransactionHash, TransactionInput, TransactionInputs, TransactionMetadatum, TransactionMetadatumKind, TransactionMetadatumLabels, TransactionOutput, TransactionOutputAmountBuilder, TransactionOutputBuilder, TransactionOutputs, TransactionSetsState, TransactionUnspentOutput, TransactionUnspentOutputs, TransactionWitnessSet, TransactionWitnessSets, TreasuryWithdrawals, TreasuryWithdrawalsAction, TxInputsBuilder, URL, UnitInterval, Update, UpdateCommitteeAction, VRFCert, VRFKeyHash, VRFVKey, Value, VersionedBlock, Vkey, Vkeys, Vkeywitness, Vkeywitnesses, VoteDelegation, VoteKind, VoteRegistrationAndDelegation, Voter, VoterKind, Voters, VotingBuilder, VotingProcedure, VotingProcedures, VotingProposal, VotingProposalBuilder, VotingProposals, Withdrawals, WithdrawalsBuilder, calculate_ex_units_ceil_cost, cbor_to_json, cddl_from_str, check_block_or_tx_signatures, create_send_all, decode_arbitrary_bytes_from_metadatum, decode_cbor_against_cddl, decode_metadatum_to_json_str, decode_plutus_datum_to_json_str, decode_plutus_program_pretty_uplc, decode_plutus_program_uplc_json, decode_specific_type, decrypt_with_password, encode_arbitrary_bytes_as_metadatum, encode_json_str_to_metadatum, encode_json_str_to_native_script, encode_json_str_to_plutus_datum, encrypt_with_password, execute_tx_scripts, extract_hashes_from_transaction_js, get_decodable_types, get_deposit, get_implicit_input, get_necessary_data_list_js, get_possible_types_for_input, get_ref_script_bytes, get_utxo_list_from_tx, has_transaction_set_tag, hash_auxiliary_data, hash_plutus_data, hash_script_data, make_daedalus_bootstrap_witness, make_icarus_bootstrap_witness, make_vkey_witness, min_ada_for_output, min_fee, min_ref_script_fee, min_script_fee, validate_cbor_against_cddl, validate_cbor_from_slice, validate_cddl, validate_cddl_from_str, validate_json_from_str, validate_transaction_js
|
|
8
|
+
Address, AddressKind, Anchor, AnchorDataHash, AssetName, AssetNames, Assets, AuxiliaryData, AuxiliaryDataHash, AuxiliaryDataSet, BaseAddress, BigInt, BigNum, Bip32PrivateKey, Bip32PublicKey, Block, BlockEra, BlockHash, BootstrapWitness, BootstrapWitnesses, ByronAddress, ByronAddressType, CborContainerType, CborSetType, Certificate, CertificateKind, Certificates, CertificatesBuilder, ChangeConfig, CoinSelectionStrategyCIP2, Committee, CommitteeColdResign, CommitteeHotAuth, Constitution, ConstrPlutusData, CostModel, Costmdls, CredKind, Credential, Credentials, DNSRecordAorAAAA, DNSRecordSRV, DRep, DRepDeregistration, DRepKind, DRepRegistration, DRepUpdate, DRepVotingThresholds, DataCost, DataHash, DatumSource, Ed25519KeyHash, Ed25519KeyHashes, Ed25519Signature, EnterpriseAddress, ExUnitPrices, ExUnits, FixedBlock, FixedTransaction, FixedTransactionBodies, FixedTransactionBody, FixedTxWitnessesSet, FixedVersionedBlock, GeneralTransactionMetadata, GenesisDelegateHash, GenesisHash, GenesisHashes, GenesisKeyDelegation, GovernanceAction, GovernanceActionId, GovernanceActionIds, GovernanceActionKind, HardForkInitiationAction, Header, HeaderBody, InfoAction, Int, Ipv4, Ipv6, KESSignature, KESVKey, Language, LanguageKind, Languages, LegacyDaedalusPrivateKey, LinearFee, MIRKind, MIRPot, MIRToStakeCredentials, MalformedAddress, MetadataJsonSchema, MetadataList, MetadataMap, Mint, MintAssets, MintBuilder, MintWitness, MintsAssets, MoveInstantaneousReward, MoveInstantaneousRewardsCert, MultiAsset, MultiHostName, NativeScript, NativeScriptKind, NativeScriptSource, NativeScripts, NetworkId, NetworkIdKind, NetworkInfo, NewConstitutionAction, NoConfidenceAction, Nonce, OperationalCert, OutputDatum, ParameterChangeAction, PlutusData, PlutusDataKind, PlutusDatumSchema, PlutusList, PlutusMap, PlutusMapValues, PlutusScript, PlutusScriptSource, PlutusScripts, PlutusWitness, PlutusWitnesses, Pointer, PointerAddress, PoolMetadata, PoolMetadataHash, PoolParams, PoolRegistration, PoolRetirement, PoolVotingThresholds, PrivateKey, ProposedProtocolParameterUpdates, ProtocolParamUpdate, ProtocolVersion, PublicKey, PublicKeys, Redeemer, RedeemerTag, RedeemerTagKind, Redeemers, Relay, RelayKind, Relays, RewardAddress, RewardAddresses, ScriptAll, ScriptAny, ScriptDataHash, ScriptHash, ScriptHashNamespace, ScriptHashes, ScriptNOfK, ScriptPubkey, ScriptRef, ScriptSchema, SingleHostAddr, SingleHostName, StakeAndVoteDelegation, StakeDelegation, StakeDeregistration, StakeRegistration, StakeRegistrationAndDelegation, StakeVoteRegistrationAndDelegation, Strings, TimelockExpiry, TimelockStart, Transaction, TransactionBatch, TransactionBatchList, TransactionBodies, TransactionBody, TransactionBuilder, TransactionBuilderConfig, TransactionBuilderConfigBuilder, TransactionHash, TransactionInput, TransactionInputs, TransactionMetadatum, TransactionMetadatumKind, TransactionMetadatumLabels, TransactionOutput, TransactionOutputAmountBuilder, TransactionOutputBuilder, TransactionOutputs, TransactionSetsState, TransactionUnspentOutput, TransactionUnspentOutputs, TransactionWitnessSet, TransactionWitnessSets, TreasuryWithdrawals, TreasuryWithdrawalsAction, TxInputsBuilder, URL, UnitInterval, Update, UpdateCommitteeAction, VRFCert, VRFKeyHash, VRFVKey, Value, VersionedBlock, Vkey, Vkeys, Vkeywitness, Vkeywitnesses, VoteDelegation, VoteKind, VoteRegistrationAndDelegation, Voter, VoterKind, Voters, VotingBuilder, VotingProcedure, VotingProcedures, VotingProposal, VotingProposalBuilder, VotingProposals, Withdrawals, WithdrawalsBuilder, calculate_ex_units_ceil_cost, cbor_to_json, cddl_format, cddl_from_str, cddl_outline, cddl_references, cddl_symbol_at, check_block_or_tx_signatures, create_send_all, decode_arbitrary_bytes_from_metadatum, decode_cbor_against_cddl, decode_metadatum_to_json_str, decode_plutus_datum_to_json_str, decode_plutus_program_pretty_uplc, decode_plutus_program_uplc_json, decode_specific_type, decrypt_with_password, encode_arbitrary_bytes_as_metadatum, encode_json_str_to_metadatum, encode_json_str_to_native_script, encode_json_str_to_plutus_datum, encrypt_with_password, execute_tx_scripts, extract_hashes_from_transaction_js, get_decodable_types, get_deposit, get_implicit_input, get_necessary_data_list_js, get_possible_types_for_input, get_ref_script_bytes, get_utxo_list_from_tx, has_transaction_set_tag, hash_auxiliary_data, hash_plutus_data, hash_script_data, make_daedalus_bootstrap_witness, make_icarus_bootstrap_witness, make_vkey_witness, map_cbor_to_cddl, min_ada_for_output, min_fee, min_ref_script_fee, min_script_fee, validate_cbor_against_cddl, validate_cbor_from_slice, validate_cddl, validate_cddl_from_str, validate_json_from_str, validate_transaction_js
|
|
9
9
|
} from "./cquisitor_lib_bg.js";
|
|
@@ -28456,6 +28456,34 @@ export function cbor_to_json(cbor_hex) {
|
|
|
28456
28456
|
return takeFromExternrefTable0(ret[0]);
|
|
28457
28457
|
}
|
|
28458
28458
|
|
|
28459
|
+
/**
|
|
28460
|
+
* Re-format the CDDL document by parsing and serialising via `Display`.
|
|
28461
|
+
* Useful for "format on save". Returns the parse error message on
|
|
28462
|
+
* invalid input.
|
|
28463
|
+
* @param {string} cddl
|
|
28464
|
+
* @returns {string}
|
|
28465
|
+
*/
|
|
28466
|
+
export function cddl_format(cddl) {
|
|
28467
|
+
let deferred3_0;
|
|
28468
|
+
let deferred3_1;
|
|
28469
|
+
try {
|
|
28470
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28472
|
+
const ret = wasm.cddl_format(ptr0, len0);
|
|
28473
|
+
var ptr2 = ret[0];
|
|
28474
|
+
var len2 = ret[1];
|
|
28475
|
+
if (ret[3]) {
|
|
28476
|
+
ptr2 = 0; len2 = 0;
|
|
28477
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
28478
|
+
}
|
|
28479
|
+
deferred3_0 = ptr2;
|
|
28480
|
+
deferred3_1 = len2;
|
|
28481
|
+
return getStringFromWasm0(ptr2, len2);
|
|
28482
|
+
} finally {
|
|
28483
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
28484
|
+
}
|
|
28485
|
+
}
|
|
28486
|
+
|
|
28459
28487
|
/**
|
|
28460
28488
|
* Returns a `ast::CDDL` wrapped in `JsValue` from a `&str`
|
|
28461
28489
|
*
|
|
@@ -28488,6 +28516,61 @@ export function cddl_from_str(input) {
|
|
|
28488
28516
|
return takeFromExternrefTable0(ret[0]);
|
|
28489
28517
|
}
|
|
28490
28518
|
|
|
28519
|
+
/**
|
|
28520
|
+
* Returns `[{name, kind, span, name_span}]` for every top-level rule
|
|
28521
|
+
* in the CDDL document. Use it for editor outline / breadcrumbs /
|
|
28522
|
+
* fuzzy-pick-rule navigation.
|
|
28523
|
+
* @param {string} cddl
|
|
28524
|
+
* @returns {any}
|
|
28525
|
+
*/
|
|
28526
|
+
export function cddl_outline(cddl) {
|
|
28527
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28528
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28529
|
+
const ret = wasm.cddl_outline(ptr0, len0);
|
|
28530
|
+
if (ret[2]) {
|
|
28531
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28532
|
+
}
|
|
28533
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28534
|
+
}
|
|
28535
|
+
|
|
28536
|
+
/**
|
|
28537
|
+
* Returns `{definition: span | null, uses: span[]}` for the rule
|
|
28538
|
+
* `name`. Powers find-references and rename-aware highlighting.
|
|
28539
|
+
* @param {string} cddl
|
|
28540
|
+
* @param {string} name
|
|
28541
|
+
* @returns {any}
|
|
28542
|
+
*/
|
|
28543
|
+
export function cddl_references(cddl, name) {
|
|
28544
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28545
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28546
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28547
|
+
const len1 = WASM_VECTOR_LEN;
|
|
28548
|
+
const ret = wasm.cddl_references(ptr0, len0, ptr1, len1);
|
|
28549
|
+
if (ret[2]) {
|
|
28550
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28551
|
+
}
|
|
28552
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28553
|
+
}
|
|
28554
|
+
|
|
28555
|
+
/**
|
|
28556
|
+
* Returns the symbol under `offset` (`null` if the cursor isn't on an
|
|
28557
|
+
* identifier), with `role: "definition" | "use"`, `kind`, `span`, and
|
|
28558
|
+
* `definition_span` (the rule's name span — the go-to-definition
|
|
28559
|
+
* target).
|
|
28560
|
+
* @param {string} cddl
|
|
28561
|
+
* @param {number} offset
|
|
28562
|
+
* @returns {any}
|
|
28563
|
+
*/
|
|
28564
|
+
export function cddl_symbol_at(cddl, offset) {
|
|
28565
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28566
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28567
|
+
const ret = wasm.cddl_symbol_at(ptr0, len0, offset);
|
|
28568
|
+
if (ret[2]) {
|
|
28569
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28570
|
+
}
|
|
28571
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28572
|
+
}
|
|
28573
|
+
|
|
28491
28574
|
/**
|
|
28492
28575
|
* @param {string} hex_str
|
|
28493
28576
|
* @returns {any}
|
|
@@ -29066,6 +29149,31 @@ export function make_vkey_witness(tx_body_hash, sk) {
|
|
|
29066
29149
|
return Vkeywitness.__wrap(ret);
|
|
29067
29150
|
}
|
|
29068
29151
|
|
|
29152
|
+
/**
|
|
29153
|
+
* Returns a flat list of `{cbor_path, cbor_byte_span, cbor_anchor_span,
|
|
29154
|
+
* cddl_byte_span, rule_name?}` entries — one per node visited during a
|
|
29155
|
+
* parallel CBOR ↔ CDDL traversal. Use it to wire bidirectional
|
|
29156
|
+
* highlight between a CBOR panel and a CDDL panel without needing a
|
|
29157
|
+
* validation error to trigger it.
|
|
29158
|
+
* @param {string} cbor_hex
|
|
29159
|
+
* @param {string} cddl
|
|
29160
|
+
* @param {string} rule_name
|
|
29161
|
+
* @returns {any}
|
|
29162
|
+
*/
|
|
29163
|
+
export function map_cbor_to_cddl(cbor_hex, cddl, rule_name) {
|
|
29164
|
+
const ptr0 = passStringToWasm0(cbor_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29166
|
+
const ptr1 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29167
|
+
const len1 = WASM_VECTOR_LEN;
|
|
29168
|
+
const ptr2 = passStringToWasm0(rule_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29169
|
+
const len2 = WASM_VECTOR_LEN;
|
|
29170
|
+
const ret = wasm.map_cbor_to_cddl(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
29171
|
+
if (ret[2]) {
|
|
29172
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
29173
|
+
}
|
|
29174
|
+
return takeFromExternrefTable0(ret[0]);
|
|
29175
|
+
}
|
|
29176
|
+
|
|
29069
29177
|
/**
|
|
29070
29178
|
* returns minimal amount of ada for the output for case when the amount is included to the output
|
|
29071
29179
|
* @param {TransactionOutput} output
|
|
@@ -29389,6 +29497,17 @@ export function __wbg_entries_e0b73aa8571ddb56(arg0) {
|
|
|
29389
29497
|
const ret = Object.entries(arg0);
|
|
29390
29498
|
return ret;
|
|
29391
29499
|
}
|
|
29500
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
29501
|
+
let deferred0_0;
|
|
29502
|
+
let deferred0_1;
|
|
29503
|
+
try {
|
|
29504
|
+
deferred0_0 = arg0;
|
|
29505
|
+
deferred0_1 = arg1;
|
|
29506
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
29507
|
+
} finally {
|
|
29508
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
29509
|
+
}
|
|
29510
|
+
}
|
|
29392
29511
|
export function __wbg_getRandomValues_112147a6595454ff(arg0) {
|
|
29393
29512
|
const ret = arg0.getRandomValues;
|
|
29394
29513
|
return ret;
|
|
@@ -29463,6 +29582,10 @@ export function __wbg_new_0c7403db6e782f19(arg0) {
|
|
|
29463
29582
|
const ret = new Uint8Array(arg0);
|
|
29464
29583
|
return ret;
|
|
29465
29584
|
}
|
|
29585
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
29586
|
+
const ret = new Error();
|
|
29587
|
+
return ret;
|
|
29588
|
+
}
|
|
29466
29589
|
export function __wbg_new_34d45cc8e36aaead() {
|
|
29467
29590
|
const ret = new Map();
|
|
29468
29591
|
return ret;
|
|
@@ -29533,6 +29656,13 @@ export function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {
|
|
|
29533
29656
|
const ret = arg0.set(arg1, arg2);
|
|
29534
29657
|
return ret;
|
|
29535
29658
|
}
|
|
29659
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
29660
|
+
const ret = arg1.stack;
|
|
29661
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29662
|
+
const len1 = WASM_VECTOR_LEN;
|
|
29663
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
29664
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
29665
|
+
}
|
|
29536
29666
|
export function __wbg_static_accessor_GLOBAL_8cfadc87a297ca02() {
|
|
29537
29667
|
const ret = typeof global === 'undefined' ? null : global;
|
|
29538
29668
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
Binary file
|
|
@@ -4,19 +4,24 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const decode_specific_type: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
5
5
|
export const get_decodable_types: () => [number, number];
|
|
6
6
|
export const get_possible_types_for_input: (a: number, b: number) => [number, number];
|
|
7
|
+
export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
|
|
7
8
|
export const cbor_to_json: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const cddl_format: (a: number, b: number) => [number, number, number, number];
|
|
10
|
+
export const cddl_outline: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const cddl_references: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
12
|
+
export const cddl_symbol_at: (a: number, b: number, c: number) => [number, number, number];
|
|
8
13
|
export const decode_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
14
|
+
export const map_cbor_to_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
9
15
|
export const validate_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
10
16
|
export const validate_cddl: (a: number, b: number) => [number, number, number];
|
|
11
|
-
export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
|
|
12
|
-
export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
13
|
-
export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
14
17
|
export const decode_plutus_program_pretty_uplc: (a: number, b: number) => [number, number, number, number];
|
|
15
18
|
export const decode_plutus_program_uplc_json: (a: number, b: number) => [number, number, number];
|
|
16
19
|
export const execute_tx_scripts: (a: number, b: number, c: any, d: any) => [number, number, number];
|
|
17
20
|
export const get_ref_script_bytes: (a: number, b: number, c: number) => [number, number, number, number];
|
|
18
21
|
export const get_utxo_list_from_tx: (a: number, b: number) => [number, number, number, number];
|
|
19
|
-
export const
|
|
22
|
+
export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
|
|
23
|
+
export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
24
|
+
export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
20
25
|
export const validate_cbor_from_slice: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
21
26
|
export const validate_json_from_str: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
22
27
|
export const cddl_from_str: (a: number, b: number) => [number, number, number];
|
|
@@ -2446,7 +2451,7 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
|
|
|
2446
2451
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
2447
2452
|
export const __externref_table_alloc: () => number;
|
|
2448
2453
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
2449
|
-
export const __externref_table_dealloc: (a: number) => void;
|
|
2450
2454
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
2455
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
2451
2456
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
2452
2457
|
export const __wbindgen_start: () => void;
|
package/node/cquisitor_lib.d.ts
CHANGED
|
@@ -171,6 +171,113 @@ export function validate_cbor_against_cddl(
|
|
|
171
171
|
rule_name: string
|
|
172
172
|
): CborValidationResult;
|
|
173
173
|
|
|
174
|
+
/** Outline entry — one rule from `cddl_outline`. */
|
|
175
|
+
export interface CddlOutlineEntry {
|
|
176
|
+
/** Rule name (`transaction_body`, `set`, …). */
|
|
177
|
+
name: string;
|
|
178
|
+
/** `"type"` for `=`, `"group"` for `( … )`. */
|
|
179
|
+
kind: "type" | "group";
|
|
180
|
+
/** Byte range covering the whole `name = …` rule definition. */
|
|
181
|
+
span: { offset: number; length: number; line: number };
|
|
182
|
+
/** Byte range of just the rule's name identifier. */
|
|
183
|
+
name_span: { offset: number; length: number; line: number };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Result of `cddl_symbol_at`. `null` when the cursor isn't on an identifier. */
|
|
187
|
+
export type CddlSymbolAtResult =
|
|
188
|
+
| null
|
|
189
|
+
| {
|
|
190
|
+
name: string;
|
|
191
|
+
kind: "type" | "group" | "rule_reference" | "prelude_or_unknown";
|
|
192
|
+
role: "definition" | "use";
|
|
193
|
+
span: { offset: number; length: number; line: number };
|
|
194
|
+
definition_span: { offset: number; length: number; line: number } | null;
|
|
195
|
+
rule_span: { offset: number; length: number; line: number } | null;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** Result of `cddl_references`. */
|
|
199
|
+
export interface CddlReferencesResult {
|
|
200
|
+
definition: { offset: number; length: number; line: number } | null;
|
|
201
|
+
uses: { offset: number; length: number; line: number }[];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns one entry per top-level rule (`{name, kind, span, name_span}`).
|
|
206
|
+
* Used for editor outline view, breadcrumbs, fuzzy "go to rule".
|
|
207
|
+
* @param cddl
|
|
208
|
+
*/
|
|
209
|
+
export function cddl_outline(cddl: string): CddlOutlineEntry[];
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns `{definition, uses[]}` byte ranges for the rule named `name`.
|
|
213
|
+
* Powers find-references and rename-aware highlighting.
|
|
214
|
+
* @param cddl
|
|
215
|
+
* @param name
|
|
216
|
+
*/
|
|
217
|
+
export function cddl_references(cddl: string, name: string): CddlReferencesResult;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Returns the symbol under `offset` (or `null` if none). For uses,
|
|
221
|
+
* `definition_span` points at the rule's name — the "go to definition"
|
|
222
|
+
* target.
|
|
223
|
+
* @param cddl
|
|
224
|
+
* @param offset
|
|
225
|
+
*/
|
|
226
|
+
export function cddl_symbol_at(cddl: string, offset: number): CddlSymbolAtResult;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Pretty-prints the CDDL by parsing it and serialising via `Display`.
|
|
230
|
+
* Useful for "format on save". Throws on invalid input.
|
|
231
|
+
* @param cddl
|
|
232
|
+
*/
|
|
233
|
+
export function cddl_format(cddl: string): string;
|
|
234
|
+
|
|
235
|
+
/** One entry from `map_cbor_to_cddl`: a single position of a CBOR
|
|
236
|
+
* node, the type that matched it, and the path it ends up at in the
|
|
237
|
+
* output of `decode_cbor_against_cddl`. */
|
|
238
|
+
export interface CborCddlMapEntry {
|
|
239
|
+
/** Path into the *raw* CBOR tree (numeric map keys are bracketed). */
|
|
240
|
+
cbor_path: string;
|
|
241
|
+
/** Path into the labelled JSON returned by `decode_cbor_against_cddl`.
|
|
242
|
+
* Numeric map keys come back as bracket-quoted strings (`["0"]`)
|
|
243
|
+
* because decoded JSON has only string keys; identifier-safe keys
|
|
244
|
+
* use dot notation (`.name`). For unspecialised tags (anything
|
|
245
|
+
* except 0 / 2 / 3) the inner gets an extra `["@value"]` segment
|
|
246
|
+
* to match the `{@tag, @value}` wrapper the decoder emits. */
|
|
247
|
+
decoded_path: string;
|
|
248
|
+
/** Header byte range of the CBOR node. */
|
|
249
|
+
cbor_byte_span: { offset: number; length: number };
|
|
250
|
+
/** Whole-structure byte range (= `cbor_byte_span` for scalars). */
|
|
251
|
+
cbor_anchor_span: { offset: number; length: number };
|
|
252
|
+
/** Byte range in the CDDL source describing this position. */
|
|
253
|
+
cddl_byte_span: { offset: number; length: number; line: number };
|
|
254
|
+
/** Name of the CDDL rule that matched, if a rule boundary was crossed. */
|
|
255
|
+
rule_name?: string;
|
|
256
|
+
/** CBOR node's wire type (`U8`, `Bytes`, `Map`, `Array`, `Tag`, …). */
|
|
257
|
+
cbor_type?: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Returns a flat list of mapping entries pairing each visited CBOR node
|
|
262
|
+
* with the CDDL position that describes it. Use it to wire
|
|
263
|
+
* bidirectional highlight between a CBOR panel and a CDDL panel without
|
|
264
|
+
* needing a validation error to trigger it.
|
|
265
|
+
*
|
|
266
|
+
* Order is depth-first pre-order, so a parent's entry precedes its
|
|
267
|
+
* children's. Tags in the CBOR are transparent to the path grammar
|
|
268
|
+
* (anweiss-style): `Tag(258, [...])` is walked as if the tag wrapper
|
|
269
|
+
* weren't there when matching against `[* a]`-shaped schemas.
|
|
270
|
+
*
|
|
271
|
+
* @param cbor_hex
|
|
272
|
+
* @param cddl
|
|
273
|
+
* @param rule_name
|
|
274
|
+
*/
|
|
275
|
+
export function map_cbor_to_cddl(
|
|
276
|
+
cbor_hex: string,
|
|
277
|
+
cddl: string,
|
|
278
|
+
rule_name: string
|
|
279
|
+
): CborCddlMapEntry[];
|
|
280
|
+
|
|
174
281
|
/**
|
|
175
282
|
* Maps decoded CBOR onto a CDDL schema and returns labelled JSON. Where
|
|
176
283
|
* `cbor_to_json` returns positional CBOR (numeric map keys, raw arrays),
|
|
@@ -408,6 +515,11 @@ export type CddlValidationResult =
|
|
|
408
515
|
export interface CddlErrorInfo {
|
|
409
516
|
kind: string;
|
|
410
517
|
message: string;
|
|
518
|
+
/**
|
|
519
|
+
* Byte range in the CDDL source the parser tripped over, when the
|
|
520
|
+
* error has positional info. Useful for IDE squiggly underlines.
|
|
521
|
+
*/
|
|
522
|
+
byte_span?: { offset: number; length: number; line: number };
|
|
411
523
|
}
|
|
412
524
|
|
|
413
525
|
export type CborValidationResult =
|
|
@@ -418,6 +530,7 @@ export type CborValidationResult =
|
|
|
418
530
|
* `kind` categorises the failure:
|
|
419
531
|
* - "parse_error" — the CDDL itself failed to parse
|
|
420
532
|
* - "unresolved_references" — the CDDL references a rule name that isn't defined
|
|
533
|
+
* - "no_rules" — the CDDL parsed but defined no rules (empty / comment-only document)
|
|
421
534
|
* - "missing_rule" — the rule name passed to `validate_cbor_against_cddl` is not in the CDDL
|
|
422
535
|
* - "input_parse" — the CBOR bytes themselves are malformed
|
|
423
536
|
* - "mismatch" / "map_cut" — a data mismatch; inspect `expected`, `path`,
|
|
@@ -428,9 +541,21 @@ export interface CborValidationErrorInfo {
|
|
|
428
541
|
kind: string;
|
|
429
542
|
message: string;
|
|
430
543
|
expected?: string;
|
|
544
|
+
/** Semantic path into the CBOR (e.g. `$.b[0]`). */
|
|
431
545
|
path?: string;
|
|
546
|
+
/** Byte range in the CBOR input that triggered the error. */
|
|
432
547
|
byte_spans?: CborPosition[];
|
|
548
|
+
/** Byte range covering the whole containing CBOR structure. */
|
|
433
549
|
anchor_spans?: CborPosition[];
|
|
550
|
+
/**
|
|
551
|
+
* Byte range in the CDDL **source** pointing at the type the
|
|
552
|
+
* validator tried to apply when it failed (synthesised by walking
|
|
553
|
+
* the AST in parallel with `path`). Useful for highlighting the
|
|
554
|
+
* offending CDDL rule in editors.
|
|
555
|
+
*/
|
|
556
|
+
cddl_byte_span?: { offset: number; length: number; line: number };
|
|
557
|
+
/** Other validation errors reported in the same run. */
|
|
558
|
+
additional?: CborValidationErrorInfo[];
|
|
434
559
|
}
|
|
435
560
|
|
|
436
561
|
export interface DecodingParams {
|
package/node/cquisitor_lib.js
CHANGED
|
@@ -28683,6 +28683,35 @@ function cbor_to_json(cbor_hex) {
|
|
|
28683
28683
|
}
|
|
28684
28684
|
exports.cbor_to_json = cbor_to_json;
|
|
28685
28685
|
|
|
28686
|
+
/**
|
|
28687
|
+
* Re-format the CDDL document by parsing and serialising via `Display`.
|
|
28688
|
+
* Useful for "format on save". Returns the parse error message on
|
|
28689
|
+
* invalid input.
|
|
28690
|
+
* @param {string} cddl
|
|
28691
|
+
* @returns {string}
|
|
28692
|
+
*/
|
|
28693
|
+
function cddl_format(cddl) {
|
|
28694
|
+
let deferred3_0;
|
|
28695
|
+
let deferred3_1;
|
|
28696
|
+
try {
|
|
28697
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28698
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28699
|
+
const ret = wasm.cddl_format(ptr0, len0);
|
|
28700
|
+
var ptr2 = ret[0];
|
|
28701
|
+
var len2 = ret[1];
|
|
28702
|
+
if (ret[3]) {
|
|
28703
|
+
ptr2 = 0; len2 = 0;
|
|
28704
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
28705
|
+
}
|
|
28706
|
+
deferred3_0 = ptr2;
|
|
28707
|
+
deferred3_1 = len2;
|
|
28708
|
+
return getStringFromWasm0(ptr2, len2);
|
|
28709
|
+
} finally {
|
|
28710
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
28711
|
+
}
|
|
28712
|
+
}
|
|
28713
|
+
exports.cddl_format = cddl_format;
|
|
28714
|
+
|
|
28686
28715
|
/**
|
|
28687
28716
|
* Returns a `ast::CDDL` wrapped in `JsValue` from a `&str`
|
|
28688
28717
|
*
|
|
@@ -28716,6 +28745,64 @@ function cddl_from_str(input) {
|
|
|
28716
28745
|
}
|
|
28717
28746
|
exports.cddl_from_str = cddl_from_str;
|
|
28718
28747
|
|
|
28748
|
+
/**
|
|
28749
|
+
* Returns `[{name, kind, span, name_span}]` for every top-level rule
|
|
28750
|
+
* in the CDDL document. Use it for editor outline / breadcrumbs /
|
|
28751
|
+
* fuzzy-pick-rule navigation.
|
|
28752
|
+
* @param {string} cddl
|
|
28753
|
+
* @returns {any}
|
|
28754
|
+
*/
|
|
28755
|
+
function cddl_outline(cddl) {
|
|
28756
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28757
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28758
|
+
const ret = wasm.cddl_outline(ptr0, len0);
|
|
28759
|
+
if (ret[2]) {
|
|
28760
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28761
|
+
}
|
|
28762
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28763
|
+
}
|
|
28764
|
+
exports.cddl_outline = cddl_outline;
|
|
28765
|
+
|
|
28766
|
+
/**
|
|
28767
|
+
* Returns `{definition: span | null, uses: span[]}` for the rule
|
|
28768
|
+
* `name`. Powers find-references and rename-aware highlighting.
|
|
28769
|
+
* @param {string} cddl
|
|
28770
|
+
* @param {string} name
|
|
28771
|
+
* @returns {any}
|
|
28772
|
+
*/
|
|
28773
|
+
function cddl_references(cddl, name) {
|
|
28774
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28776
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28777
|
+
const len1 = WASM_VECTOR_LEN;
|
|
28778
|
+
const ret = wasm.cddl_references(ptr0, len0, ptr1, len1);
|
|
28779
|
+
if (ret[2]) {
|
|
28780
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28781
|
+
}
|
|
28782
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28783
|
+
}
|
|
28784
|
+
exports.cddl_references = cddl_references;
|
|
28785
|
+
|
|
28786
|
+
/**
|
|
28787
|
+
* Returns the symbol under `offset` (`null` if the cursor isn't on an
|
|
28788
|
+
* identifier), with `role: "definition" | "use"`, `kind`, `span`, and
|
|
28789
|
+
* `definition_span` (the rule's name span — the go-to-definition
|
|
28790
|
+
* target).
|
|
28791
|
+
* @param {string} cddl
|
|
28792
|
+
* @param {number} offset
|
|
28793
|
+
* @returns {any}
|
|
28794
|
+
*/
|
|
28795
|
+
function cddl_symbol_at(cddl, offset) {
|
|
28796
|
+
const ptr0 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28797
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28798
|
+
const ret = wasm.cddl_symbol_at(ptr0, len0, offset);
|
|
28799
|
+
if (ret[2]) {
|
|
28800
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
28801
|
+
}
|
|
28802
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28803
|
+
}
|
|
28804
|
+
exports.cddl_symbol_at = cddl_symbol_at;
|
|
28805
|
+
|
|
28719
28806
|
/**
|
|
28720
28807
|
* @param {string} hex_str
|
|
28721
28808
|
* @returns {any}
|
|
@@ -29325,6 +29412,32 @@ function make_vkey_witness(tx_body_hash, sk) {
|
|
|
29325
29412
|
}
|
|
29326
29413
|
exports.make_vkey_witness = make_vkey_witness;
|
|
29327
29414
|
|
|
29415
|
+
/**
|
|
29416
|
+
* Returns a flat list of `{cbor_path, cbor_byte_span, cbor_anchor_span,
|
|
29417
|
+
* cddl_byte_span, rule_name?}` entries — one per node visited during a
|
|
29418
|
+
* parallel CBOR ↔ CDDL traversal. Use it to wire bidirectional
|
|
29419
|
+
* highlight between a CBOR panel and a CDDL panel without needing a
|
|
29420
|
+
* validation error to trigger it.
|
|
29421
|
+
* @param {string} cbor_hex
|
|
29422
|
+
* @param {string} cddl
|
|
29423
|
+
* @param {string} rule_name
|
|
29424
|
+
* @returns {any}
|
|
29425
|
+
*/
|
|
29426
|
+
function map_cbor_to_cddl(cbor_hex, cddl, rule_name) {
|
|
29427
|
+
const ptr0 = passStringToWasm0(cbor_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29428
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29429
|
+
const ptr1 = passStringToWasm0(cddl, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29430
|
+
const len1 = WASM_VECTOR_LEN;
|
|
29431
|
+
const ptr2 = passStringToWasm0(rule_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29432
|
+
const len2 = WASM_VECTOR_LEN;
|
|
29433
|
+
const ret = wasm.map_cbor_to_cddl(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
29434
|
+
if (ret[2]) {
|
|
29435
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
29436
|
+
}
|
|
29437
|
+
return takeFromExternrefTable0(ret[0]);
|
|
29438
|
+
}
|
|
29439
|
+
exports.map_cbor_to_cddl = map_cbor_to_cddl;
|
|
29440
|
+
|
|
29328
29441
|
/**
|
|
29329
29442
|
* returns minimal amount of ada for the output for case when the amount is included to the output
|
|
29330
29443
|
* @param {TransactionOutput} output
|
|
@@ -29661,6 +29774,17 @@ function __wbg_get_imports() {
|
|
|
29661
29774
|
const ret = Object.entries(arg0);
|
|
29662
29775
|
return ret;
|
|
29663
29776
|
},
|
|
29777
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
29778
|
+
let deferred0_0;
|
|
29779
|
+
let deferred0_1;
|
|
29780
|
+
try {
|
|
29781
|
+
deferred0_0 = arg0;
|
|
29782
|
+
deferred0_1 = arg1;
|
|
29783
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
29784
|
+
} finally {
|
|
29785
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
29786
|
+
}
|
|
29787
|
+
},
|
|
29664
29788
|
__wbg_getRandomValues_112147a6595454ff: function(arg0) {
|
|
29665
29789
|
const ret = arg0.getRandomValues;
|
|
29666
29790
|
return ret;
|
|
@@ -29735,6 +29859,10 @@ function __wbg_get_imports() {
|
|
|
29735
29859
|
const ret = new Uint8Array(arg0);
|
|
29736
29860
|
return ret;
|
|
29737
29861
|
},
|
|
29862
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
29863
|
+
const ret = new Error();
|
|
29864
|
+
return ret;
|
|
29865
|
+
},
|
|
29738
29866
|
__wbg_new_34d45cc8e36aaead: function() {
|
|
29739
29867
|
const ret = new Map();
|
|
29740
29868
|
return ret;
|
|
@@ -29805,6 +29933,13 @@ function __wbg_get_imports() {
|
|
|
29805
29933
|
const ret = arg0.set(arg1, arg2);
|
|
29806
29934
|
return ret;
|
|
29807
29935
|
},
|
|
29936
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
29937
|
+
const ret = arg1.stack;
|
|
29938
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29939
|
+
const len1 = WASM_VECTOR_LEN;
|
|
29940
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
29941
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
29942
|
+
},
|
|
29808
29943
|
__wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
|
|
29809
29944
|
const ret = typeof global === 'undefined' ? null : global;
|
|
29810
29945
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
Binary file
|
|
@@ -4,19 +4,24 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const decode_specific_type: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
|
|
5
5
|
export const get_decodable_types: () => [number, number];
|
|
6
6
|
export const get_possible_types_for_input: (a: number, b: number) => [number, number];
|
|
7
|
+
export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
|
|
7
8
|
export const cbor_to_json: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const cddl_format: (a: number, b: number) => [number, number, number, number];
|
|
10
|
+
export const cddl_outline: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const cddl_references: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
12
|
+
export const cddl_symbol_at: (a: number, b: number, c: number) => [number, number, number];
|
|
8
13
|
export const decode_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
14
|
+
export const map_cbor_to_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
9
15
|
export const validate_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
10
16
|
export const validate_cddl: (a: number, b: number) => [number, number, number];
|
|
11
|
-
export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
|
|
12
|
-
export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
13
|
-
export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
14
17
|
export const decode_plutus_program_pretty_uplc: (a: number, b: number) => [number, number, number, number];
|
|
15
18
|
export const decode_plutus_program_uplc_json: (a: number, b: number) => [number, number, number];
|
|
16
19
|
export const execute_tx_scripts: (a: number, b: number, c: any, d: any) => [number, number, number];
|
|
17
20
|
export const get_ref_script_bytes: (a: number, b: number, c: number) => [number, number, number, number];
|
|
18
21
|
export const get_utxo_list_from_tx: (a: number, b: number) => [number, number, number, number];
|
|
19
|
-
export const
|
|
22
|
+
export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
|
|
23
|
+
export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
24
|
+
export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
20
25
|
export const validate_cbor_from_slice: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
21
26
|
export const validate_json_from_str: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
22
27
|
export const cddl_from_str: (a: number, b: number) => [number, number, number];
|
|
@@ -2446,7 +2451,7 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
|
|
|
2446
2451
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
2447
2452
|
export const __externref_table_alloc: () => number;
|
|
2448
2453
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
2449
|
-
export const __externref_table_dealloc: (a: number) => void;
|
|
2450
2454
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
2455
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
2451
2456
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
2452
2457
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED