@helios-lang/contract-utils 0.1.30 → 0.1.31
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 +1 -1
- package/src/cast/Cast.js +12 -4
package/package.json
CHANGED
package/src/cast/Cast.js
CHANGED
|
@@ -133,7 +133,9 @@ function schemaToUplc(schema, x) {
|
|
|
133
133
|
case "Value":
|
|
134
134
|
return Value.fromAlike(x).toUplcData()
|
|
135
135
|
default:
|
|
136
|
-
throw new Error(
|
|
136
|
+
throw new Error(
|
|
137
|
+
`not yet implemented for ${schema.primitiveType}`
|
|
138
|
+
)
|
|
137
139
|
}
|
|
138
140
|
} else if ("listItemType" in schema) {
|
|
139
141
|
return new ListData(x.map((x) => schemaToUplc(schema.listItemType, x)))
|
|
@@ -183,7 +185,9 @@ function schemaToUplc(schema, x) {
|
|
|
183
185
|
)
|
|
184
186
|
)
|
|
185
187
|
} else {
|
|
186
|
-
throw new Error(
|
|
188
|
+
throw new Error(
|
|
189
|
+
`not yet implemented for ${JSON.stringify(schema, undefined, 4)}`
|
|
190
|
+
)
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
|
|
@@ -242,7 +246,9 @@ function uplcToSchema(schema, data) {
|
|
|
242
246
|
case "Value":
|
|
243
247
|
return Value.fromUplcData(data)
|
|
244
248
|
default:
|
|
245
|
-
throw new Error(
|
|
249
|
+
throw new Error(
|
|
250
|
+
`not yet implemented for ${schema.primitiveType}`
|
|
251
|
+
)
|
|
246
252
|
}
|
|
247
253
|
} else if ("listItemType" in schema) {
|
|
248
254
|
return ListData.expect(data).items.map((x) =>
|
|
@@ -312,6 +318,8 @@ function uplcToSchema(schema, data) {
|
|
|
312
318
|
)
|
|
313
319
|
}
|
|
314
320
|
} else {
|
|
315
|
-
throw new Error(
|
|
321
|
+
throw new Error(
|
|
322
|
+
`not yet implemented for ${JSON.stringify(schema, undefined, 4)}`
|
|
323
|
+
)
|
|
316
324
|
}
|
|
317
325
|
}
|