@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cast/Cast.js +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helios-lang/contract-utils",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",
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("not yet implemented")
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("not yet implemented")
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("not yet implemented")
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("not yet implemented")
321
+ throw new Error(
322
+ `not yet implemented for ${JSON.stringify(schema, undefined, 4)}`
323
+ )
316
324
  }
317
325
  }