@helios-lang/contract-utils 0.1.28 → 0.1.30
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 +3 -3
- package/src/codegen/TypeSchema.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helios-lang/contract-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
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",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@helios-lang/cli-utils": "^0.1.2",
|
|
39
39
|
"@helios-lang/codec-utils": "^0.1.27",
|
|
40
40
|
"@helios-lang/compiler-utils": "^0.1.21",
|
|
41
|
-
"@helios-lang/ledger": "^0.1.
|
|
41
|
+
"@helios-lang/ledger": "^0.1.33",
|
|
42
42
|
"@helios-lang/type-utils": "^0.1.8",
|
|
43
|
-
"@helios-lang/uplc": "^0.1.
|
|
43
|
+
"@helios-lang/uplc": "^0.1.24"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/cast/Cast.js
CHANGED
|
@@ -2,11 +2,11 @@ import { decodeUtf8, encodeUtf8 } from "@helios-lang/codec-utils"
|
|
|
2
2
|
import {
|
|
3
3
|
Address,
|
|
4
4
|
AssetClass,
|
|
5
|
-
Credential,
|
|
6
5
|
DatumHash,
|
|
7
6
|
MintingPolicyHash,
|
|
8
7
|
PubKeyHash,
|
|
9
8
|
ScriptHash,
|
|
9
|
+
SpendingCredential,
|
|
10
10
|
StakingCredential,
|
|
11
11
|
StakingHash,
|
|
12
12
|
StakingValidatorHash,
|
|
@@ -92,7 +92,7 @@ function schemaToUplc(schema, x) {
|
|
|
92
92
|
return new ByteArrayData(x)
|
|
93
93
|
case "Credential":
|
|
94
94
|
case "PaymentCredential":
|
|
95
|
-
return
|
|
95
|
+
return SpendingCredential.fromAlike(x).toUplcData()
|
|
96
96
|
case "Data":
|
|
97
97
|
return x
|
|
98
98
|
case "DatumHash":
|
|
@@ -206,7 +206,7 @@ function uplcToSchema(schema, data) {
|
|
|
206
206
|
case "ByteArray":
|
|
207
207
|
return ByteArrayData.expect(data).bytes
|
|
208
208
|
case "Credential":
|
|
209
|
-
return
|
|
209
|
+
return SpendingCredential.fromUplcData(data)
|
|
210
210
|
case "Data":
|
|
211
211
|
return data
|
|
212
212
|
case "DCert":
|
|
@@ -114,10 +114,10 @@ export function genTypes(schema) {
|
|
|
114
114
|
}
|
|
115
115
|
} else if ("listItemType" in schema) {
|
|
116
116
|
const [c, p] = genTypes(schema.listItemType)
|
|
117
|
-
return [
|
|
117
|
+
return [`(${c})[]`, `(${p})[]`]
|
|
118
118
|
} else if ("optionSomeType" in schema) {
|
|
119
119
|
const [c, p] = genTypes(schema.optionSomeType)
|
|
120
|
-
return [
|
|
120
|
+
return [`(${c}) | null`, `(${p}) | null | undefined`]
|
|
121
121
|
} else if ("mapKeyType" in schema) {
|
|
122
122
|
const [ck, pk] = genTypes(schema.mapKeyType)
|
|
123
123
|
const [cv, pv] = genTypes(schema.mapValueType)
|