@helios-lang/contract-utils 0.1.31 → 0.1.33

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 +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helios-lang/contract-utils",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
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
@@ -99,6 +99,9 @@ function schemaToUplc(schema, x) {
99
99
  return DatumHash.fromAlike(x).toUplcData()
100
100
  case "DCert":
101
101
  return x.toUplcData()
102
+ case "Duration":
103
+ case "Int":
104
+ return new IntData(x)
102
105
  case "MintingPolicyHash":
103
106
  return MintingPolicyHash.fromAlike(x).toUplcData()
104
107
  case "PubKeyHash":
@@ -209,6 +212,7 @@ function uplcToSchema(schema, data) {
209
212
  return decodeBoolData(data, true)
210
213
  case "ByteArray":
211
214
  return ByteArrayData.expect(data).bytes
215
+ case "SpendingCredential":
212
216
  case "Credential":
213
217
  return SpendingCredential.fromUplcData(data)
214
218
  case "Data":
@@ -217,6 +221,9 @@ function uplcToSchema(schema, data) {
217
221
  throw new Error(
218
222
  "can't convert UplcData back into DCert (significant loss of information)"
219
223
  )
224
+ case "Duration":
225
+ case "Int":
226
+ return IntData.expect(data).value
220
227
  case "MintingPolicyHash":
221
228
  return MintingPolicyHash.fromUplcData(data)
222
229
  case "PubKeyHash":