@helios-lang/contract-utils 0.3.3 → 0.3.5
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/package.json +3 -3
- package/src/cast/Cast.js +273 -154
- package/src/index.js +2 -13
- package/types/cast/Cast.d.ts +46 -3
- package/types/cast/Cast.d.ts.map +1 -1
- package/types/index.d.ts +4 -24
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helios-lang/contract-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Convenience and type-safety utilities for using Helios validators from within Typescript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@helios-lang/codec-utils": "^0.3.3",
|
|
41
41
|
"@helios-lang/compiler-utils": "^0.5.2",
|
|
42
42
|
"@helios-lang/crypto": "0.2.2",
|
|
43
|
-
"@helios-lang/ledger": "^0.6.
|
|
43
|
+
"@helios-lang/ledger": "^0.6.11",
|
|
44
44
|
"@helios-lang/type-utils": "^0.2.8",
|
|
45
|
-
"@helios-lang/uplc": "^0.7.
|
|
45
|
+
"@helios-lang/uplc": "^0.7.8"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "pnpm run prettify && pnpm run build:types && pnpm run test:suite",
|
package/src/cast/Cast.js
CHANGED
|
@@ -54,9 +54,24 @@ import {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* @import { TxInput, TxOutput } from "@helios-lang/ledger"
|
|
57
|
-
* @import { TypeSchema } from "@helios-lang/type-utils"
|
|
58
|
-
* @import { UplcData } from "@helios-lang/uplc"
|
|
59
|
-
* @import { Cast, CastConfig, CastLike
|
|
57
|
+
* @import { EnumTypeSchema, TypeSchema } from "@helios-lang/type-utils"
|
|
58
|
+
* @import { ConstrData, UplcData } from "@helios-lang/uplc"
|
|
59
|
+
* @import { Cast, CastConfig, CastLike } from "../index.js"
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} SchemaToUplcContext
|
|
64
|
+
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
65
|
+
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
66
|
+
* @prop {boolean} unwrapSingleFieldEnumVariants - defaults to false. If true, assumes the following input objects for enum variants: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @typedef {Object} UplcToSchemaContext
|
|
71
|
+
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
72
|
+
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
73
|
+
* @prop {boolean} unwrapSingleFieldEnumVariants - defaults to false. If true, the following enum variant outputs are created: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
74
|
+
* @prop {boolean} isMainnet
|
|
60
75
|
*/
|
|
61
76
|
|
|
62
77
|
/**
|
|
@@ -110,8 +125,10 @@ class CastImpl {
|
|
|
110
125
|
* @returns {TStrict}
|
|
111
126
|
*/
|
|
112
127
|
fromUplcData(data, dataPath = "") {
|
|
113
|
-
return
|
|
114
|
-
|
|
128
|
+
return convertUplcDataToSchemaDataWithDataPath(this.schema, data, {
|
|
129
|
+
isMainnet: this.config.isMainnet,
|
|
130
|
+
unwrapSingleFieldEnumVariants:
|
|
131
|
+
!!this.config.unwrapSingleFieldEnumVariants,
|
|
115
132
|
dataPath,
|
|
116
133
|
defs: {}
|
|
117
134
|
})
|
|
@@ -129,8 +146,10 @@ class CastImpl {
|
|
|
129
146
|
* @returns {UplcData}
|
|
130
147
|
*/
|
|
131
148
|
toUplcData(x, dataPath = "") {
|
|
132
|
-
const t =
|
|
149
|
+
const t = convertSchemaDataToUplcDataWithDataPath(this.schema, x, {
|
|
133
150
|
defs: {},
|
|
151
|
+
unwrapSingleFieldEnumVariants:
|
|
152
|
+
!!this.config.unwrapSingleFieldEnumVariants,
|
|
134
153
|
dataPath
|
|
135
154
|
})
|
|
136
155
|
t.rawData = x
|
|
@@ -140,13 +159,13 @@ class CastImpl {
|
|
|
140
159
|
|
|
141
160
|
/**
|
|
142
161
|
* @param {TypeSchema} schema
|
|
143
|
-
* @param {any} x
|
|
162
|
+
* @param {any} x - data
|
|
144
163
|
* @param {SchemaToUplcContext} context
|
|
145
164
|
* @returns {UplcData}
|
|
146
165
|
*/
|
|
147
|
-
function
|
|
166
|
+
function convertSchemaDataToUplcDataWithDataPath(schema, x, context) {
|
|
148
167
|
try {
|
|
149
|
-
const t =
|
|
168
|
+
const t = convertSchemaDataToUplcData(schema, x, context)
|
|
150
169
|
t.dataPath = context.dataPath
|
|
151
170
|
return t
|
|
152
171
|
} catch (e) {
|
|
@@ -159,28 +178,37 @@ function schemaToUplcWithDataPath(schema, x, context) {
|
|
|
159
178
|
}
|
|
160
179
|
}
|
|
161
180
|
|
|
181
|
+
/**
|
|
182
|
+
* @template T [{dataPath: string}]
|
|
183
|
+
* @param {T} context
|
|
184
|
+
* @param {string} dataPath
|
|
185
|
+
* @returns {T}
|
|
186
|
+
*/
|
|
187
|
+
function passContext(context, dataPath) {
|
|
188
|
+
return {
|
|
189
|
+
...context,
|
|
190
|
+
dataPath
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
162
194
|
/**
|
|
163
195
|
* @param {TypeSchema} schema
|
|
164
|
-
* @param {any} x
|
|
165
|
-
* @param {SchemaToUplcContext}
|
|
196
|
+
* @param {any} x - JS data
|
|
197
|
+
* @param {SchemaToUplcContext} context
|
|
166
198
|
* @returns {UplcData}
|
|
167
199
|
*/
|
|
168
|
-
function
|
|
169
|
-
|
|
170
|
-
// important: DON'T extend the inputContext for use in nested calls.
|
|
171
|
-
const { dataPath, defs } = inputContextOnly
|
|
172
|
-
|
|
173
|
-
// Only the defs can be passed down, and it's simpler syntactically
|
|
174
|
-
// ... just use the defs directly in the nested calls.
|
|
200
|
+
function convertSchemaDataToUplcData(schema, x, context) {
|
|
201
|
+
const { dataPath, defs } = context
|
|
175
202
|
|
|
176
203
|
const kind = schema.kind
|
|
177
204
|
switch (kind) {
|
|
178
205
|
case "reference": {
|
|
179
206
|
const def = expectDefined(defs[schema.id])
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
207
|
+
return convertSchemaDataToUplcDataWithDataPath(
|
|
208
|
+
def,
|
|
209
|
+
x,
|
|
210
|
+
passContext(context, `${dataPath}::ref{${schema.id}}`)
|
|
211
|
+
)
|
|
184
212
|
}
|
|
185
213
|
case "internal": {
|
|
186
214
|
const name = schema.name
|
|
@@ -258,10 +286,11 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
258
286
|
case "list":
|
|
259
287
|
return makeListData(
|
|
260
288
|
x.map((x, i) =>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
289
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
290
|
+
schema.itemType,
|
|
291
|
+
x,
|
|
292
|
+
passContext(context, `${dataPath}.list[${i}]`)
|
|
293
|
+
)
|
|
265
294
|
)
|
|
266
295
|
)
|
|
267
296
|
case "map": {
|
|
@@ -275,14 +304,22 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
275
304
|
entries.map(([k, v], i) => {
|
|
276
305
|
const displayKey = "string" == typeof k ? `'${k}'` : `@{i}`
|
|
277
306
|
return [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
307
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
308
|
+
schema.keyType,
|
|
309
|
+
k,
|
|
310
|
+
passContext(
|
|
311
|
+
context,
|
|
312
|
+
`${dataPath}[mapKey ${displayKey}]`
|
|
313
|
+
)
|
|
314
|
+
),
|
|
315
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
316
|
+
schema.valueType,
|
|
317
|
+
v,
|
|
318
|
+
passContext(
|
|
319
|
+
context,
|
|
320
|
+
`${dataPath}[mapVal ${displayKey}]`
|
|
321
|
+
)
|
|
322
|
+
)
|
|
286
323
|
]
|
|
287
324
|
})
|
|
288
325
|
)
|
|
@@ -290,19 +327,21 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
290
327
|
case "tuple":
|
|
291
328
|
return makeListData(
|
|
292
329
|
x.map((x, i) =>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
330
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
331
|
+
schema.itemTypes[i],
|
|
332
|
+
x,
|
|
333
|
+
passContext(context, `${dataPath}[tuple@${i}]`)
|
|
334
|
+
)
|
|
297
335
|
)
|
|
298
336
|
)
|
|
299
337
|
case "option":
|
|
300
338
|
return wrapUplcDataOption(
|
|
301
339
|
x
|
|
302
|
-
?
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
340
|
+
? convertSchemaDataToUplcDataWithDataPath(
|
|
341
|
+
schema.someType,
|
|
342
|
+
x,
|
|
343
|
+
passContext(context, `${dataPath}::Some`)
|
|
344
|
+
)
|
|
306
345
|
: undefined
|
|
307
346
|
)
|
|
308
347
|
case "struct": {
|
|
@@ -310,21 +349,25 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
310
349
|
switch (schema.format) {
|
|
311
350
|
case "singleton":
|
|
312
351
|
const singleFieldName = schema.fieldTypes[0].name
|
|
313
|
-
return
|
|
352
|
+
return convertSchemaDataToUplcDataWithDataPath(
|
|
314
353
|
schema.fieldTypes[0].type,
|
|
315
354
|
x[singleFieldName],
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
355
|
+
passContext(
|
|
356
|
+
context,
|
|
357
|
+
`${dataPath}[sfStruct.${singleFieldName}]`
|
|
358
|
+
)
|
|
320
359
|
)
|
|
321
360
|
case "list":
|
|
322
361
|
return makeListData(
|
|
323
362
|
schema.fieldTypes.map(({ name, type }) =>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
363
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
364
|
+
type,
|
|
365
|
+
x[name],
|
|
366
|
+
passContext(
|
|
367
|
+
context,
|
|
368
|
+
`${dataPath}[fStruct].${name}`
|
|
369
|
+
)
|
|
370
|
+
)
|
|
328
371
|
)
|
|
329
372
|
)
|
|
330
373
|
case "map": {
|
|
@@ -365,14 +408,15 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
365
408
|
encodeUtf8(encodingKey)
|
|
366
409
|
)
|
|
367
410
|
|
|
368
|
-
const valueData =
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
411
|
+
const valueData =
|
|
412
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
413
|
+
ft.type,
|
|
414
|
+
value,
|
|
415
|
+
passContext(
|
|
416
|
+
context,
|
|
417
|
+
`${dataPath}[mStruct].${fieldName}${encodingInfo}`
|
|
418
|
+
)
|
|
419
|
+
)
|
|
376
420
|
|
|
377
421
|
pairs.push([keyData, valueData])
|
|
378
422
|
}
|
|
@@ -405,16 +449,11 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
405
449
|
)
|
|
406
450
|
}
|
|
407
451
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
return makeConstrData(
|
|
452
|
+
return convertEnumVariantDataToConstrData(
|
|
453
|
+
schema,
|
|
411
454
|
tag,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
defs,
|
|
415
|
-
dataPath: `${dataPath}[${schema.name}::${variantName}].${f.name}`
|
|
416
|
-
})
|
|
417
|
-
)
|
|
455
|
+
variantFields,
|
|
456
|
+
passContext(context, dataPath)
|
|
418
457
|
)
|
|
419
458
|
}
|
|
420
459
|
case "variant":
|
|
@@ -423,10 +462,14 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
423
462
|
return makeConstrData(
|
|
424
463
|
schema.tag,
|
|
425
464
|
schema.fieldTypes.map(({ name, type }) =>
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
465
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
466
|
+
type,
|
|
467
|
+
x[name],
|
|
468
|
+
passContext(
|
|
469
|
+
context,
|
|
470
|
+
`${dataPath}[enumVariant ${schema.id}.${name}`
|
|
471
|
+
)
|
|
472
|
+
)
|
|
430
473
|
)
|
|
431
474
|
)
|
|
432
475
|
default:
|
|
@@ -434,13 +477,54 @@ function schemaToUplc(schema, x, inputContextOnly) {
|
|
|
434
477
|
}
|
|
435
478
|
}
|
|
436
479
|
|
|
480
|
+
/**
|
|
481
|
+
* Gives the encoding of nested data a context to prevent a second ConstrData wrapper on the MapData
|
|
482
|
+
* ... only for the first field.
|
|
483
|
+
* @param {EnumTypeSchema} schema
|
|
484
|
+
* @param {number} tag
|
|
485
|
+
* @param {any} data - can be any in order to represent a single unwrapped field
|
|
486
|
+
* @param {SchemaToUplcContext} context
|
|
487
|
+
* @returns {ConstrData}
|
|
488
|
+
*/
|
|
489
|
+
function convertEnumVariantDataToConstrData(schema, tag, data, context) {
|
|
490
|
+
const variantSchema = schema.variantTypes[tag]
|
|
491
|
+
const variantName = variantSchema.name
|
|
492
|
+
|
|
493
|
+
if (
|
|
494
|
+
context.unwrapSingleFieldEnumVariants &&
|
|
495
|
+
variantSchema.fieldTypes.length == 1
|
|
496
|
+
) {
|
|
497
|
+
const singleFieldName = variantSchema.fieldTypes[0].name
|
|
498
|
+
|
|
499
|
+
// rewrap as preparation for converting to UplcData
|
|
500
|
+
data = {
|
|
501
|
+
[singleFieldName]: data
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// at this point `data` should be of type `Record<string, any>`
|
|
506
|
+
return makeConstrData(
|
|
507
|
+
tag,
|
|
508
|
+
variantSchema.fieldTypes.map((f) =>
|
|
509
|
+
convertSchemaDataToUplcDataWithDataPath(
|
|
510
|
+
f.type,
|
|
511
|
+
data[f.name],
|
|
512
|
+
passContext(
|
|
513
|
+
context,
|
|
514
|
+
`[${schema.name}::${variantName}].${f.name}`
|
|
515
|
+
)
|
|
516
|
+
)
|
|
517
|
+
)
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
|
|
437
521
|
/**
|
|
438
522
|
* @param {TypeSchema} schema
|
|
439
523
|
* @param {UplcData} data
|
|
440
524
|
* @param {UplcToSchemaContext} context
|
|
441
525
|
* @returns {any}
|
|
442
526
|
*/
|
|
443
|
-
function
|
|
527
|
+
function convertUplcDataToSchemaDataWithDataPath(schema, data, context) {
|
|
444
528
|
try {
|
|
445
529
|
const t = uplcToSchema(schema, data, context)
|
|
446
530
|
return t
|
|
@@ -460,15 +544,12 @@ function uplcToSchemaWithDataPath(schema, data, context) {
|
|
|
460
544
|
* This should fail when deviating
|
|
461
545
|
* @param {TypeSchema} schema
|
|
462
546
|
* @param {UplcData} data
|
|
463
|
-
* @param {UplcToSchemaContext}
|
|
547
|
+
* @param {UplcToSchemaContext} context
|
|
464
548
|
* @returns {any}
|
|
465
549
|
*/
|
|
466
|
-
function uplcToSchema(schema, data,
|
|
550
|
+
function uplcToSchema(schema, data, context) {
|
|
467
551
|
const kind = schema.kind
|
|
468
|
-
const {
|
|
469
|
-
// Note: don't use the inputContext directly in nested calls.
|
|
470
|
-
const { dataPath, ...context } = inputContextOnly
|
|
471
|
-
// use { ... context } augmented with a de-novo `dataPath` attr
|
|
552
|
+
const { dataPath, defs, isMainnet } = context
|
|
472
553
|
|
|
473
554
|
switch (kind) {
|
|
474
555
|
case "internal": {
|
|
@@ -476,10 +557,7 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
476
557
|
|
|
477
558
|
switch (name) {
|
|
478
559
|
case "Address":
|
|
479
|
-
return convertUplcDataToShelleyAddress(
|
|
480
|
-
config.isMainnet,
|
|
481
|
-
data
|
|
482
|
-
)
|
|
560
|
+
return convertUplcDataToShelleyAddress(isMainnet, data)
|
|
483
561
|
case "Any":
|
|
484
562
|
// TODO: should this throw an error?
|
|
485
563
|
return null
|
|
@@ -533,9 +611,9 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
533
611
|
case "TxId":
|
|
534
612
|
return convertUplcDataToTxId(data)
|
|
535
613
|
case "TxInput":
|
|
536
|
-
return convertUplcDataToTxInput(
|
|
614
|
+
return convertUplcDataToTxInput(isMainnet, data)
|
|
537
615
|
case "TxOutput":
|
|
538
|
-
return convertUplcDataToTxOutput(
|
|
616
|
+
return convertUplcDataToTxOutput(isMainnet, data)
|
|
539
617
|
case "TxOutputDatum":
|
|
540
618
|
return convertUplcDataToTxOutputDatum(data)
|
|
541
619
|
case "TxOutputId":
|
|
@@ -550,43 +628,51 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
550
628
|
}
|
|
551
629
|
case "list":
|
|
552
630
|
return expectListData(data).items.map((x, i) =>
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
631
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
632
|
+
schema.itemType,
|
|
633
|
+
x,
|
|
634
|
+
passContext(context, `${dataPath}[${i}]`)
|
|
635
|
+
)
|
|
557
636
|
)
|
|
558
637
|
case "map":
|
|
559
638
|
return new Map(
|
|
560
639
|
expectMapData(data).items.map(([k, v], i) => {
|
|
561
|
-
const key =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
640
|
+
const key = convertUplcDataToSchemaDataWithDataPath(
|
|
641
|
+
schema.keyType,
|
|
642
|
+
k,
|
|
643
|
+
passContext(context, `${dataPath}[mapKey @${i}]`)
|
|
644
|
+
)
|
|
565
645
|
const displayKey =
|
|
566
646
|
"string" == typeof key ? `'${key}'` : `@{i}`
|
|
567
647
|
return [
|
|
568
648
|
key,
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
649
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
650
|
+
schema.valueType,
|
|
651
|
+
v,
|
|
652
|
+
passContext(
|
|
653
|
+
context,
|
|
654
|
+
`${dataPath}[mapVal ${displayKey}]`
|
|
655
|
+
)
|
|
656
|
+
)
|
|
573
657
|
]
|
|
574
658
|
})
|
|
575
659
|
)
|
|
576
660
|
case "tuple":
|
|
577
661
|
return expectListData(data).items.map((x, i) =>
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
662
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
663
|
+
schema.itemTypes[i],
|
|
664
|
+
x,
|
|
665
|
+
passContext(context, `${dataPath}[tuple@${i}]`)
|
|
666
|
+
)
|
|
582
667
|
)
|
|
583
668
|
case "option": {
|
|
584
669
|
const optionData = unwrapUplcDataOption(data)
|
|
585
670
|
return optionData
|
|
586
|
-
?
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
671
|
+
? convertUplcDataToSchemaDataWithDataPath(
|
|
672
|
+
schema.someType,
|
|
673
|
+
optionData,
|
|
674
|
+
passContext(context, `${dataPath}::Some`)
|
|
675
|
+
)
|
|
590
676
|
: undefined
|
|
591
677
|
}
|
|
592
678
|
case "struct": {
|
|
@@ -594,11 +680,12 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
594
680
|
switch (schema.format) {
|
|
595
681
|
case "singleton":
|
|
596
682
|
return {
|
|
597
|
-
[schema.fieldTypes[0].name]:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
683
|
+
[schema.fieldTypes[0].name]:
|
|
684
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
685
|
+
schema.fieldTypes[0].type,
|
|
686
|
+
data,
|
|
687
|
+
passContext(context, `${dataPath}[sfStruct]`)
|
|
688
|
+
)
|
|
602
689
|
}
|
|
603
690
|
case "list": {
|
|
604
691
|
const fields = expectListData(data).items
|
|
@@ -615,10 +702,14 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
615
702
|
const { name, type } = schema.fieldTypes[i]
|
|
616
703
|
return [
|
|
617
704
|
name,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
705
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
706
|
+
type,
|
|
707
|
+
field,
|
|
708
|
+
passContext(
|
|
709
|
+
context,
|
|
710
|
+
`${dataPath}[fStruct].${name}`
|
|
711
|
+
)
|
|
712
|
+
)
|
|
622
713
|
]
|
|
623
714
|
})
|
|
624
715
|
)
|
|
@@ -679,13 +770,13 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
679
770
|
return /** @type {const} */ ([
|
|
680
771
|
i,
|
|
681
772
|
name,
|
|
682
|
-
|
|
773
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
683
774
|
type,
|
|
684
775
|
encodedDataPair[1],
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
776
|
+
passContext(
|
|
777
|
+
context,
|
|
778
|
+
`${dataPath}[mStruct].${name}`
|
|
779
|
+
)
|
|
689
780
|
)
|
|
690
781
|
])
|
|
691
782
|
})
|
|
@@ -701,38 +792,12 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
701
792
|
}
|
|
702
793
|
case "enum": {
|
|
703
794
|
defs[schema.id] = schema
|
|
704
|
-
const { tag, fields } = expectConstrData(data)
|
|
705
|
-
|
|
706
|
-
const variantSchema = schema.variantTypes[tag]
|
|
707
|
-
|
|
708
|
-
if (!variantSchema) {
|
|
709
|
-
throw new Error(`tag ${tag} out of range`)
|
|
710
|
-
}
|
|
711
795
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
)
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
const fieldCount = variantSchema.fieldTypes.length
|
|
721
|
-
return {
|
|
722
|
-
[variantSchema.name]: Object.fromEntries(
|
|
723
|
-
fields.map((f, i) => [
|
|
724
|
-
variantSchema.fieldTypes[i].name,
|
|
725
|
-
uplcToSchemaWithDataPath(
|
|
726
|
-
variantSchema.fieldTypes[i].type,
|
|
727
|
-
f,
|
|
728
|
-
{
|
|
729
|
-
...context,
|
|
730
|
-
dataPath: `${dataPath}[${schema.name}::${variantSchema.name}]`
|
|
731
|
-
}
|
|
732
|
-
)
|
|
733
|
-
])
|
|
734
|
-
)
|
|
735
|
-
}
|
|
796
|
+
return convertConstrDataFieldsToEnumVariantFields(
|
|
797
|
+
schema,
|
|
798
|
+
expectConstrData(data),
|
|
799
|
+
passContext(context, dataPath)
|
|
800
|
+
)
|
|
736
801
|
}
|
|
737
802
|
case "variant": {
|
|
738
803
|
defs[schema.id] = schema
|
|
@@ -741,10 +806,14 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
741
806
|
return Object.fromEntries(
|
|
742
807
|
fields.map((field, i) => [
|
|
743
808
|
schema.fieldTypes[i].name,
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
809
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
810
|
+
schema.fieldTypes[i].type,
|
|
811
|
+
field,
|
|
812
|
+
passContext(
|
|
813
|
+
context,
|
|
814
|
+
`${dataPath}[enumVariant ${schema.id}].${schema.fieldTypes[i].name}`
|
|
815
|
+
)
|
|
816
|
+
)
|
|
748
817
|
])
|
|
749
818
|
)
|
|
750
819
|
}
|
|
@@ -753,6 +822,56 @@ function uplcToSchema(schema, data, inputContextOnly) {
|
|
|
753
822
|
}
|
|
754
823
|
}
|
|
755
824
|
|
|
825
|
+
/**
|
|
826
|
+
* @param {EnumTypeSchema} schema
|
|
827
|
+
* @param {ConstrData} data
|
|
828
|
+
* @param {UplcToSchemaContext} context
|
|
829
|
+
* @returns {Record<string, any>}
|
|
830
|
+
*/
|
|
831
|
+
function convertConstrDataFieldsToEnumVariantFields(schema, data, context) {
|
|
832
|
+
const { tag, fields } = data
|
|
833
|
+
|
|
834
|
+
const variantSchema = schema.variantTypes[tag]
|
|
835
|
+
|
|
836
|
+
if (!variantSchema) {
|
|
837
|
+
throw new Error(`tag ${tag} out of range`)
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
const nExpected = variantSchema.fieldTypes.length
|
|
841
|
+
|
|
842
|
+
if (fields.length != nExpected) {
|
|
843
|
+
throw new Error(
|
|
844
|
+
`expected ${nExpected} fields for variant ${variantSchema.name} (tag ${tag}), got ${fields.length} fields`
|
|
845
|
+
)
|
|
846
|
+
}
|
|
847
|
+
const result = {
|
|
848
|
+
[variantSchema.name]: Object.fromEntries(
|
|
849
|
+
fields.map((f, i) => [
|
|
850
|
+
variantSchema.fieldTypes[i].name,
|
|
851
|
+
convertUplcDataToSchemaDataWithDataPath(
|
|
852
|
+
variantSchema.fieldTypes[i].type,
|
|
853
|
+
f,
|
|
854
|
+
passContext(
|
|
855
|
+
context,
|
|
856
|
+
`${context.dataPath}[${schema.name}::${variantSchema.name}]`
|
|
857
|
+
)
|
|
858
|
+
)
|
|
859
|
+
])
|
|
860
|
+
)
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if (
|
|
864
|
+
context.unwrapSingleFieldEnumVariants &&
|
|
865
|
+
variantSchema.fieldTypes.length == 1
|
|
866
|
+
) {
|
|
867
|
+
const singleFieldName = variantSchema.fieldTypes[0].name
|
|
868
|
+
const variantName = variantSchema.name
|
|
869
|
+
result[variantName] = result[variantName][singleFieldName]
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
return result
|
|
873
|
+
}
|
|
874
|
+
|
|
756
875
|
/**
|
|
757
876
|
* @template TStrict
|
|
758
877
|
* @template TPermissive
|
package/src/index.js
CHANGED
|
@@ -122,8 +122,10 @@ export { genTypes } from "./codegen/TypeSchema.js"
|
|
|
122
122
|
*/
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
+
* `unwrapSingleFieldEnumVariants` defaults to false. If true, the following enum variant data structure is used: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
125
126
|
* @typedef {{
|
|
126
127
|
* isMainnet: boolean
|
|
128
|
+
* unwrapSingleFieldEnumVariants?: boolean
|
|
127
129
|
* }} CastConfig
|
|
128
130
|
*/
|
|
129
131
|
|
|
@@ -156,19 +158,6 @@ export { genTypes } from "./codegen/TypeSchema.js"
|
|
|
156
158
|
* @typedef {Cast<TStrict, TPermissive> | ConfigurableCast<TStrict, TPermissive>} CastLike
|
|
157
159
|
*/
|
|
158
160
|
|
|
159
|
-
/**
|
|
160
|
-
* @typedef {Object} SchemaToUplcContext
|
|
161
|
-
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
162
|
-
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @typedef {Object} UplcToSchemaContext
|
|
167
|
-
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
168
|
-
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
169
|
-
* @prop {CastConfig} config - has isMainnet indicator
|
|
170
|
-
*/
|
|
171
|
-
|
|
172
161
|
/**
|
|
173
162
|
* TODO: add logOptions here as well (which can be overridden by logOptions passed directly to eval(), evalUnsafe() and profile())?
|
|
174
163
|
* `returns` is optional to accomodate main functions that return void
|
package/types/cast/Cast.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import { TxInput, TxOutput } from "@helios-lang/ledger"
|
|
3
|
-
* @import { TypeSchema } from "@helios-lang/type-utils"
|
|
4
|
-
* @import { UplcData } from "@helios-lang/uplc"
|
|
5
|
-
* @import { Cast, CastConfig, CastLike
|
|
3
|
+
* @import { EnumTypeSchema, TypeSchema } from "@helios-lang/type-utils"
|
|
4
|
+
* @import { ConstrData, UplcData } from "@helios-lang/uplc"
|
|
5
|
+
* @import { Cast, CastConfig, CastLike } from "../index.js"
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} SchemaToUplcContext
|
|
9
|
+
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
10
|
+
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
11
|
+
* @prop {boolean} unwrapSingleFieldEnumVariants - defaults to false. If true, assumes the following input objects for enum variants: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} UplcToSchemaContext
|
|
15
|
+
* @prop {Record<string, TypeSchema>} defs - symbol table permitting recursive schema references
|
|
16
|
+
* @prop {string} dataPath - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
17
|
+
* @prop {boolean} unwrapSingleFieldEnumVariants - defaults to false. If true, the following enum variant outputs are created: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
18
|
+
* @prop {boolean} isMainnet
|
|
6
19
|
*/
|
|
7
20
|
/**
|
|
8
21
|
* @template TStrict
|
|
@@ -20,8 +33,38 @@ export function makeCast<TStrict, TPermissive>(schema: TypeSchema, config: CastC
|
|
|
20
33
|
* @returns {Cast<TStrict, TPermissive>}
|
|
21
34
|
*/
|
|
22
35
|
export function configureCast<TStrict, TPermissive>(cast: CastLike<TStrict, TPermissive>, config: CastConfig): Cast<TStrict, TPermissive>;
|
|
36
|
+
export type SchemaToUplcContext = {
|
|
37
|
+
/**
|
|
38
|
+
* - symbol table permitting recursive schema references
|
|
39
|
+
*/
|
|
40
|
+
defs: Record<string, TypeSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
43
|
+
*/
|
|
44
|
+
dataPath: string;
|
|
45
|
+
/**
|
|
46
|
+
* - defaults to false. If true, assumes the following input objects for enum variants: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
47
|
+
*/
|
|
48
|
+
unwrapSingleFieldEnumVariants: boolean;
|
|
49
|
+
};
|
|
50
|
+
export type UplcToSchemaContext = {
|
|
51
|
+
/**
|
|
52
|
+
* - symbol table permitting recursive schema references
|
|
53
|
+
*/
|
|
54
|
+
defs: Record<string, TypeSchema>;
|
|
55
|
+
/**
|
|
56
|
+
* - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
57
|
+
*/
|
|
58
|
+
dataPath: string;
|
|
59
|
+
/**
|
|
60
|
+
* - defaults to false. If true, the following enum variant outputs are created: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
61
|
+
*/
|
|
62
|
+
unwrapSingleFieldEnumVariants: boolean;
|
|
63
|
+
isMainnet: boolean;
|
|
64
|
+
};
|
|
23
65
|
import type { TypeSchema } from "@helios-lang/type-utils";
|
|
24
66
|
import type { CastConfig } from "../index.js";
|
|
25
67
|
import type { Cast } from "../index.js";
|
|
26
68
|
import type { CastLike } from "../index.js";
|
|
69
|
+
import type { TypeSchema as TypeSchema_1 } from "@helios-lang/type-utils";
|
|
27
70
|
//# sourceMappingURL=Cast.d.ts.map
|
package/types/cast/Cast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cast.d.ts","sourceRoot":"","sources":["../../src/cast/Cast.js"],"names":[],"mappings":"AAsDA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,yBANa,OAAO,EACP,WAAW,UACb,UAAU,UACV,UAAU,GACR,KAAK,OAAO,EAAE,WAAW,CAAC,CAItC;
|
|
1
|
+
{"version":3,"file":"Cast.d.ts","sourceRoot":"","sources":["../../src/cast/Cast.js"],"names":[],"mappings":"AAsDA;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,yBANa,OAAO,EACP,WAAW,UACb,UAAU,UACV,UAAU,GACR,KAAK,OAAO,EAAE,WAAW,CAAC,CAItC;AAqxBD;;;;;;GAMG;AACH,8BANa,OAAO,EACP,WAAW,QACb,SAAS,OAAO,EAAE,WAAW,CAAC,UAC9B,UAAU,GACR,KAAK,OAAO,EAAE,WAAW,CAAC,CAQtC;;;;;UAxzBS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;cAC1B,MAAM;;;;mCACN,OAAO;;;;;;UAKP,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;cAC1B,MAAM;;;;mCACN,OAAO;eACP,OAAO;;gCAjB8B,yBAAyB;gCAEzB,aAAa;0BAAb,aAAa;8BAAb,aAAa;gDAFb,yBAAyB"}
|
package/types/index.d.ts
CHANGED
|
@@ -89,8 +89,12 @@ export type CompilerLib = {
|
|
|
89
89
|
compile: (main: string, modules: string[], options: CompileOptions) => CompileOutput;
|
|
90
90
|
};
|
|
91
91
|
export type DagDependencies = Record<string, string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* `unwrapSingleFieldEnumVariants` defaults to false. If true, the following enum variant data structure is used: `{VariantName: SingleFieldData}`, instead of the more verbose `{VariantName: {SingleFieldName: SingleFieldData}}`
|
|
94
|
+
*/
|
|
92
95
|
export type CastConfig = {
|
|
93
96
|
isMainnet: boolean;
|
|
97
|
+
unwrapSingleFieldEnumVariants?: boolean;
|
|
94
98
|
};
|
|
95
99
|
export type Cast<TStrict, TPermissive> = {
|
|
96
100
|
kind: "Cast";
|
|
@@ -110,30 +114,6 @@ export type ConfigurableCast<TStrict, TPermissive> = (config: CastConfig) => Cas
|
|
|
110
114
|
* StrictType and PermissiveType work for both Cast and ConfigurableCast
|
|
111
115
|
*/
|
|
112
116
|
export type CastLike<TStrict, TPermissive> = Cast<TStrict, TPermissive> | ConfigurableCast<TStrict, TPermissive>;
|
|
113
|
-
export type SchemaToUplcContext = {
|
|
114
|
-
/**
|
|
115
|
-
* - symbol table permitting recursive schema references
|
|
116
|
-
*/
|
|
117
|
-
defs: Record<string, TypeSchema>;
|
|
118
|
-
/**
|
|
119
|
-
* - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
120
|
-
*/
|
|
121
|
-
dataPath: string;
|
|
122
|
-
};
|
|
123
|
-
export type UplcToSchemaContext = {
|
|
124
|
-
/**
|
|
125
|
-
* - symbol table permitting recursive schema references
|
|
126
|
-
*/
|
|
127
|
-
defs: Record<string, TypeSchema>;
|
|
128
|
-
/**
|
|
129
|
-
* - provides developer-facing cues for any parsing errors, showing the deep field path of any error
|
|
130
|
-
*/
|
|
131
|
-
dataPath: string;
|
|
132
|
-
/**
|
|
133
|
-
* - has isMainnet indicator
|
|
134
|
-
*/
|
|
135
|
-
config: CastConfig;
|
|
136
|
-
};
|
|
137
117
|
/**
|
|
138
118
|
* TODO: add logOptions here as well (which can be overridden by logOptions passed directly to eval(), evalUnsafe() and profile())?
|
|
139
119
|
* `returns` is optional to accomodate main functions that return void
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;kCAkBa;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,qBAAqB,EAAE,OAAO,CAAA;IAC9B,qBAAqB,EAAE,OAAO,CAAA;IAC9B,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,UAAU,CAAA;QAChB,UAAU,EAAE,OAAO,CAAA;KACpB,EAAE,CAAA;IACH,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;gCAIS;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;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