@harmoniclabs/plu-ts-onchain
Advanced tools
Comparing version 0.3.0-dev10 to 0.3.0-dev11
@@ -43,3 +43,6 @@ "use strict"; | ||
if ((0, isTaggedAsAlias_1.isTaggedAsAlias)(t)) | ||
return _fromData((0, unwrapAlias_1.unwrapAlias)(t)); | ||
return (function (term) { | ||
term = _fromData((0, unwrapAlias_1.unwrapAlias)(t))(term); | ||
return new Term_1.Term(t, term.toIR, Boolean(term.isConstant)); | ||
}); | ||
// unwrap asData before `t extends data` | ||
@@ -46,0 +49,0 @@ if (t[0] === type_system_1.PrimType.AsData) |
@@ -57,4 +57,4 @@ "use strict"; | ||
function addPAliasMethods(aliasTerm) { | ||
var originalType = aliasTerm.type; | ||
aliasTerm = (0, BaseUtilityTerm_1.addBaseUtilityTerm)(aliasTerm); | ||
var originalType = aliasTerm.type; | ||
if (originalType[0] !== types_1.PrimType.Alias) { | ||
@@ -69,6 +69,12 @@ console.error(originalType); | ||
var aliasedType = (0, unwrapAlias_1.unwrapAlias)(originalType); | ||
aliasTerm = addUtilityForType(aliasedType)(aliasTerm); | ||
aliasTerm = (0, addUserMethods_1.addUserMethods)(aliasTerm, originalType[2]); | ||
// intentionally discarding the result | ||
// if we are aliasing a list, adding utility clones the term | ||
// so changes the type | ||
// so we loose the alias and possible methods | ||
// this is really a bug in `addPListMethods` | ||
// but for now this is the workaround | ||
void addUtilityForType(aliasedType)(aliasTerm); | ||
void (0, addUserMethods_1.addUserMethods)(aliasTerm, originalType[2]); | ||
return aliasTerm; | ||
} | ||
exports.addPAliasMethods = addPAliasMethods; |
@@ -106,2 +106,5 @@ "use strict"; | ||
var elemsT = (0, tyArgs_1.getElemsT)(_lst.type); | ||
// this clone is causing problems for aliases | ||
// TODO: remove clone and test | ||
/** @todo remove clone and test */ | ||
var lst = new Term_1.Term((0, type_system_1.list)(elemsT), | ||
@@ -108,0 +111,0 @@ // needs to be wrapped to prevent the garbage collector to collect garbage (lst) |
@@ -44,15 +44,3 @@ "use strict"; | ||
(!(0, obj_utils_1.hasOwn)(struct, thisFieldName)) && Object.defineProperty(struct, thisFieldName, { | ||
value: (0, punsafeConvertType_1.punsafeConvertType)((0, plet_1.plet)((0, fromData_minimal_1._fromData)(thisFieldType)((0, getElemAtTerm_1.getElemAtTerm)(i).$(letted_fieldsListData)), ctorName + "::" + thisFieldName | ||
// (dbn, ir) => { | ||
// if(ctorName + "::" + thisFieldName !== "PScriptContext::purpose") return; | ||
// | ||
// const [ _dbn, term ] = getNormalizedLettedArgs( ir.dbn, ir.value ) ?? [ 0, new IRVar( 0 )] ; | ||
// console.log( | ||
// "PScriptContext::purpose at dbn:", dbn, | ||
// "\nnormalized value:", prettyIRJsonStr( term, 2, { hoisted: false } ), | ||
// "\nnormalized value hash:", toHex( term.hash ), | ||
// "\nnormalized dbn:", _dbn, | ||
// ); | ||
// } | ||
), thisFieldType), | ||
value: (0, punsafeConvertType_1.punsafeConvertType)((0, plet_1.plet)((0, fromData_minimal_1._fromData)(thisFieldType)((0, getElemAtTerm_1.getElemAtTerm)(i).$(letted_fieldsListData)), ctorName + "::" + thisFieldName), thisFieldType), | ||
writable: false, | ||
@@ -59,0 +47,0 @@ enumerable: true, |
{ | ||
"name": "@harmoniclabs/plu-ts-onchain", | ||
"version": "0.3.0-dev10", | ||
"version": "0.3.0-dev11", | ||
"description": "An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12415319