@helios-lang/contract-utils 0.1.25 → 0.1.26
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 +2 -2
- package/src/cast/Cast.js +6 -8
- package/types/cast/Cast.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.1.
|
|
3
|
+
"version": "0.1.26",
|
|
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,6 +40,6 @@
|
|
|
40
40
|
"@helios-lang/compiler-utils": "^0.1.21",
|
|
41
41
|
"@helios-lang/ledger": "^0.1.21",
|
|
42
42
|
"@helios-lang/type-utils": "^0.1.8",
|
|
43
|
-
"@helios-lang/uplc": "^0.1.
|
|
43
|
+
"@helios-lang/uplc": "^0.1.23"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/cast/Cast.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { decodeUtf8, encodeUtf8 } from "@helios-lang/codec-utils"
|
|
2
|
-
import { REAL_PRECISION } from "@helios-lang/compiler-utils"
|
|
3
|
-
import { None } from "@helios-lang/type-utils"
|
|
4
2
|
import {
|
|
5
3
|
Address,
|
|
6
4
|
AssetClass,
|
|
@@ -19,6 +17,7 @@ import {
|
|
|
19
17
|
ValidatorHash,
|
|
20
18
|
Value
|
|
21
19
|
} from "@helios-lang/ledger"
|
|
20
|
+
import { None } from "@helios-lang/type-utils"
|
|
22
21
|
import {
|
|
23
22
|
ByteArrayData,
|
|
24
23
|
ConstrData,
|
|
@@ -27,8 +26,10 @@ import {
|
|
|
27
26
|
MapData,
|
|
28
27
|
decodeBoolData,
|
|
29
28
|
decodeOptionData,
|
|
29
|
+
decodeRealData,
|
|
30
30
|
encodeBoolData,
|
|
31
|
-
encodeOptionData
|
|
31
|
+
encodeOptionData,
|
|
32
|
+
encodeRealData
|
|
32
33
|
} from "@helios-lang/uplc"
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -103,7 +104,7 @@ function schemaToUplc(schema, x) {
|
|
|
103
104
|
case "PubKeyHash":
|
|
104
105
|
return PubKeyHash.fromAlike(x).toUplcData()
|
|
105
106
|
case "Real":
|
|
106
|
-
return
|
|
107
|
+
return encodeRealData(x)
|
|
107
108
|
case "ScriptHash":
|
|
108
109
|
return ScriptHash.fromAlike(x).toUplcData()
|
|
109
110
|
case "StakingCredential":
|
|
@@ -217,10 +218,7 @@ function uplcToSchema(schema, data) {
|
|
|
217
218
|
case "PubKeyHash":
|
|
218
219
|
return PubKeyHash.fromUplcData(data)
|
|
219
220
|
case "Real":
|
|
220
|
-
return (
|
|
221
|
-
Number(IntData.expect(data).value) /
|
|
222
|
-
Math.pow(10, REAL_PRECISION)
|
|
223
|
-
)
|
|
221
|
+
return decodeRealData(data)
|
|
224
222
|
case "ScriptHash":
|
|
225
223
|
return ScriptHash.fromUplcData(data)
|
|
226
224
|
case "StakingCredential":
|
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":"
|
|
1
|
+
{"version":3,"file":"Cast.d.ts","sourceRoot":"","sources":["../../src/cast/Cast.js"],"names":[],"mappings":"AAkCA;;;GAGG;AAEH;;;GAGG;AACH;IAOI;;OAEG;IACH,oBAFW,UAAU,EAIpB;IAXD;;;OAGG;IACH,iBAFU,UAAU,CAEd;IASN;;;OAGG;IACH,mBAHW,QAAQ,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,cAHW,WAAW,GACT,QAAQ,CAIpB;CACJ;uBArCY,OAAO,mBAAmB,EAAE,QAAQ;yBACpC,OAAO,qBAAqB,EAAE,UAAU"}
|