@helios-lang/contract-utils 0.3.1 → 0.3.2
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
CHANGED
|
@@ -94,10 +94,10 @@ export function cacheEntryToJsonSafe(entry) {
|
|
|
94
94
|
|
|
95
95
|
if (
|
|
96
96
|
!(
|
|
97
|
-
typeof
|
|
98
|
-
|
|
99
|
-
"redeemer" in
|
|
100
|
-
"program" in
|
|
97
|
+
typeof context == "object" &&
|
|
98
|
+
context !== null &&
|
|
99
|
+
"redeemer" in context &&
|
|
100
|
+
"program" in context
|
|
101
101
|
)
|
|
102
102
|
) {
|
|
103
103
|
throw new Error("invalid context")
|
|
@@ -107,11 +107,11 @@ export function cacheEntryToJsonSafe(entry) {
|
|
|
107
107
|
* @type {Cast<any, any> | undefined}
|
|
108
108
|
*/
|
|
109
109
|
const redeemer = /** @type {any} */ (
|
|
110
|
-
typeof
|
|
111
|
-
|
|
112
|
-
"kind" in
|
|
113
|
-
|
|
114
|
-
?
|
|
110
|
+
typeof context.redeemer == "object" &&
|
|
111
|
+
context.redeemer !== null &&
|
|
112
|
+
"kind" in context.redeemer &&
|
|
113
|
+
context.redeemer.kind == "Cast"
|
|
114
|
+
? context.redeemer
|
|
115
115
|
: undefined
|
|
116
116
|
)
|
|
117
117
|
|
|
@@ -125,14 +125,14 @@ export function cacheEntryToJsonSafe(entry) {
|
|
|
125
125
|
let datum = undefined
|
|
126
126
|
|
|
127
127
|
if (
|
|
128
|
-
"datum" in
|
|
129
|
-
|
|
130
|
-
typeof
|
|
131
|
-
|
|
132
|
-
"kind" in
|
|
133
|
-
|
|
128
|
+
"datum" in context &&
|
|
129
|
+
context.datum &&
|
|
130
|
+
typeof context.datum == "object" &&
|
|
131
|
+
context.datum !== null &&
|
|
132
|
+
"kind" in context.datum &&
|
|
133
|
+
context.datum.kind == "Cast"
|
|
134
134
|
) {
|
|
135
|
-
datum = /** @type {any} */ (
|
|
135
|
+
datum = /** @type {any} */ (context.datum)
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
if (["spending", "mixed"].includes(purpose) && !datum) {
|
|
@@ -142,7 +142,7 @@ export function cacheEntryToJsonSafe(entry) {
|
|
|
142
142
|
/**
|
|
143
143
|
* @type {UplcProgramV1 | UplcProgramV2}
|
|
144
144
|
*/
|
|
145
|
-
const program = /** @type {any} */ (
|
|
145
|
+
const program = /** @type {any} */ (context.program)
|
|
146
146
|
|
|
147
147
|
resValidators[name] = {
|
|
148
148
|
purpose: purpose,
|
|
@@ -250,6 +250,7 @@ export function cacheEntryFromJson(entry) {
|
|
|
250
250
|
let redeemer = makeCast(props.redeemer, props.castConfig)
|
|
251
251
|
|
|
252
252
|
switch (props.purpose) {
|
|
253
|
+
case "mixed": // TODO: de we need a separate ValidatorHash type for this?
|
|
253
254
|
case "spending": {
|
|
254
255
|
res.validators[name] = makeValidatorHash(props.bytes, {
|
|
255
256
|
datum: makeCast(
|
|
@@ -275,15 +276,6 @@ export function cacheEntryFromJson(entry) {
|
|
|
275
276
|
})
|
|
276
277
|
break
|
|
277
278
|
}
|
|
278
|
-
case "mixed": {
|
|
279
|
-
throw new Error("implement ScriptHash type")
|
|
280
|
-
/*res.validators[name] = new ScriptHash(props.bytes, {
|
|
281
|
-
datum: makeCast(expectDefined(props.datum), props.castConfig),
|
|
282
|
-
redeemer: redeemer,
|
|
283
|
-
program: program
|
|
284
|
-
})*/
|
|
285
|
-
break
|
|
286
|
-
}
|
|
287
279
|
default:
|
|
288
280
|
throw new Error("unhandled purpose")
|
|
289
281
|
}
|
|
@@ -283,6 +283,7 @@ export class DagCompiler {
|
|
|
283
283
|
const redeemer = configureCast(validator.$Redeemer, this.config)
|
|
284
284
|
|
|
285
285
|
switch (validator.$purpose) {
|
|
286
|
+
case "mixed": // TODO: do we need a separate ValidatorHash type for this?
|
|
286
287
|
case "spending":
|
|
287
288
|
this.cachedValidators[name] = makeValidatorHash(hash, {
|
|
288
289
|
program,
|
|
@@ -290,14 +291,6 @@ export class DagCompiler {
|
|
|
290
291
|
datum: configureCast(validator.$Datum, this.config)
|
|
291
292
|
})
|
|
292
293
|
break
|
|
293
|
-
case "mixed":
|
|
294
|
-
throw new Error("not yet implemented")
|
|
295
|
-
/*this.cachedValidators[name] = new ScriptHash(hash, {
|
|
296
|
-
program,
|
|
297
|
-
redeemer,
|
|
298
|
-
datum: configureCast(validator.$Datum, this.config)
|
|
299
|
-
})*/
|
|
300
|
-
break
|
|
301
294
|
case "minting":
|
|
302
295
|
this.cachedValidators[name] = makeMintingPolicyHash(hash, {
|
|
303
296
|
program,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheEntry.d.ts","sourceRoot":"","sources":["../../src/context/CacheEntry.js"],"names":[],"mappings":"AAcA;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AACH,4CAHW,UAAU,GACR,cAAc,CAiI1B;AAED;;;GAGG;AACH,0CAHW,cAAc,GACZ,UAAU,
|
|
1
|
+
{"version":3,"file":"CacheEntry.d.ts","sourceRoot":"","sources":["../../src/context/CacheEntry.js"],"names":[],"mappings":"AAcA;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AACH,4CAHW,UAAU,GACR,cAAc,CAiI1B;AAED;;;GAGG;AACH,0CAHW,cAAc,GACZ,UAAU,CA2HtB;yBA9SY;IACR,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,2BAA2B,CAAA;KAAC,CAAA;IACzD,SAAS,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAC,CAAA;CACzC;uCAIS;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG;QACvB,OAAO,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;QACrD,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,oBAAoB,CAAC,EAAE,qBAAqB,CAAA;QAC5C,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,kBAAkB,CAAC,EAAE,qBAAqB,CAAA;QAC1C,aAAa,EAAE,aAAa,CAAA;QAC5B,UAAU,EAAE,UAAU,CAAA;QACtB,KAAK,CAAC,EAAE,UAAU,CAAA;QAClB,QAAQ,EAAE,UAAU,CAAA;KACrB,CAAA;CAAC;sCAIM;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG;QACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,oBAAoB,CAAC,EAAE,qBAAqB,CAAA;QAC5C,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,kBAAkB,CAAC,EAAE,qBAAqB,CAAA;QAC1C,aAAa,EAAE,aAAa,CAAA;KAC7B,CAAA;CAAC;6BAIQ;IACR,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,wBAAwB,CAAA;IACpC,SAAS,EAAE,uBAAuB,CAAA;CACnC;iDA7C6F,aAAa;iCADA,mBAAmB;2CAAnB,mBAAmB;mCAAnB,mBAAmB;gCAChC,aAAa;gCAF/E,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DagCompiler.d.ts","sourceRoot":"","sources":["../../src/context/DagCompiler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DagCompiler.d.ts","sourceRoot":"","sources":["../../src/context/DagCompiler.js"],"names":[],"mappings":"AAoZA;;;GAGG;AACH,iDAHW,eAAe,GACb,MAAM,EAAE,CAsBpB;AA/ZD;;;GAGG;AAEH;;;;GAIG;AACH;;;;;;;GAOG;AAEH;;GAEG;AACH;IA6BI;;;OAGG;IACH,iBAHW,WAAW,UACX,iBAAiB,EAO3B;IArCD;;;;OAIG;IACH,qBAAG;IAEH;;;;OAIG;IACH,wBAAM;IAEN;;;;OAIG;IACH,kCAAgB;IAEhB;;;;OAIG;IACH,iCAAe;IAaf;;;;;;OAMG;IACH,kBANW,eAAe,EAAE,cACjB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,aACxB,OAAO,mBACP;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,GAAG,SAAS,GAClC,iBAAiB,CAgM7B;IAED;;;;;OAKG;IACH,4BAgCC;IAED;;;;;OAKG;IACH,yBA8BC;IAED;;;;;OAKG;IACH,qBAoBC;IAED;;;;;OAKG;IACH,4BAeC;CACJ;gCA/XY,UAAU,GAAG;IACrB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;;;;gCAIS;IACR,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,2BAA2B,CAAA;KAAC,CAAA;IACzD,SAAS,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAC,CAAA;CACzC;qCAdqF,aAAa;8BAD7C,mBAAmB;iCACa,aAAa;gCAAb,aAAa;iDAAb,aAAa;iCAD7C,mBAAmB"}
|