UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

23 lines (22 loc) 917 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._punsafeConvertType = void 0; var isWellFormedType_1 = require("../../type_system/kinds/isWellFormedType.js"); var Term_1 = require("../../Term/index.js"); function _punsafeConvertType(psome, toType) { if (!(0, isWellFormedType_1.isWellFormedType)(toType)) throw new Error(""); var converted = new Term_1.Term(toType, psome.toIR, Boolean(psome.isConstant) // isConstant ); Object.keys(psome).forEach(function (k) { var _a; // do not overwrite `type` and `toUPLC` properties if (k === "type" || k === "toUPLC" || k === "toIR") return; Object.defineProperty(converted, k, (_a = Object.getOwnPropertyDescriptor(psome, k)) !== null && _a !== void 0 ? _a : {}); }); return converted; } exports._punsafeConvertType = _punsafeConvertType;