UNPKG

@harmoniclabs/plu-ts-onchain

Version:

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

54 lines (53 loc) 4.25 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.addPIntMethods = void 0; var obj_utils_1 = require("@harmoniclabs/obj-utils"); var int_1 = require("../../builtins/int/index.js"); var intBinOpToBool_1 = require("../../builtins/int/intBinOpToBool.js"); var padd_1 = require("../../builtins/int/padd.js"); var BaseUtilityTerm_1 = require("./BaseUtilityTerm.js"); var getterOnly = { set: function () { }, configurable: false, enumerable: true }; function addPIntMethods(term) { term = (0, BaseUtilityTerm_1.addBaseUtilityTerm)(term); (0, obj_utils_1.definePropertyIfNotPresent)(term, "padd", __assign({ get: function () { return padd_1.padd.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "add", function (other) { return padd_1.padd.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "psub", __assign({ get: function () { return int_1.psub.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "sub", function (other) { return int_1.psub.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pmult", __assign({ get: function () { return int_1.pmult.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "mult", function (other) { return int_1.pmult.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pdiv", __assign({ get: function () { return int_1.pdiv.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "div", function (other) { return int_1.pdiv.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pquot", __assign({ get: function () { return int_1.pquot.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "quot", function (other) { return int_1.pquot.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "premainder", __assign({ get: function () { return int_1.prem.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "remainder", function (other) { return int_1.prem.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pmod", __assign({ get: function () { return int_1.pmod.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "mod", function (other) { return int_1.pmod.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "peq", __assign({ get: function () { return intBinOpToBool_1.peqInt.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "eq", function (other) { return intBinOpToBool_1.peqInt.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "plt", __assign({ get: function () { return intBinOpToBool_1.plessInt.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "lt", function (other) { return intBinOpToBool_1.plessInt.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pltEq", __assign({ get: function () { return intBinOpToBool_1.plessEqInt.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "ltEq", function (other) { return intBinOpToBool_1.plessEqInt.$(term).$(other); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pgt", __assign({ get: function () { return intBinOpToBool_1.pgreaterInt.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "gt", function (other) { return intBinOpToBool_1.plessInt.$(other).$(term); }); (0, obj_utils_1.definePropertyIfNotPresent)(term, "pgtEq", __assign({ get: function () { return intBinOpToBool_1.pgreaterEqInt.$(term); } }, getterOnly)); (0, obj_utils_1.defineReadOnlyProperty)(term, "gtEq", function (other) { return intBinOpToBool_1.plessEqInt.$(other).$(term); }); return term; } exports.addPIntMethods = addPIntMethods;