UNPKG

@mutants/cardano-tx-builder

Version:

A package that provides utility functions to build and destructure a cardano transaction

14 lines (13 loc) 581 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMinUTxOCost = void 0; const cbor_1 = require("cbor"); const encodeOutputs_1 = require("./encodeOutputs"); const getMinUTxOCost = (utxo, coinsPerUTxOWord = "4310") => { const encodedOutput = (0, cbor_1.encode)((0, encodeOutputs_1.encodeOutput)(utxo)).toString("hex"); if (!utxo.value.assets && !utxo.datumHash && !utxo.datumInlined) { return 0n; } return BigInt((encodedOutput.length / 2 + 160) * parseInt(coinsPerUTxOWord)); }; exports.getMinUTxOCost = getMinUTxOCost;