@harmoniclabs/buildooor 0.1.3 → 0.1.4

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.
@@ -17,7 +17,7 @@ export declare class TxBuilder {
17
17
  constructor(protocolParamters?: Readonly<TxBuilderProtocolParams>, genesisInfos?: GenesisInfos);
18
18
  keepRelevant(requestedOutputSet: Value | ValueUnits, initialUTxOSet: ITxBuildInput[], minimumLovelaceRequired?: CanBeUInteger): ITxBuildInput[];
19
19
  private calcLinearFee;
20
- calcMinFee(tx: Tx): bigint;
20
+ calcMinFee(tx: Tx, minimum?: CanBeUInteger | undefined): bigint;
21
21
  getMinimumOutputLovelaces(tx_out: TxOut | CanBeCborString): bigint;
22
22
  addMinLovelacesIfMissing(txOut: TxOut): TxOut;
23
23
  minimizeLovelaces(out: ITxOut): TxOut;
@@ -173,7 +173,7 @@ var TxBuilder = /** @class */ (function () {
173
173
  ) +
174
174
  (0, ints_1.forceBigUInt)(this.protocolParamters.txFeeFixed));
175
175
  };
176
- TxBuilder.prototype.calcMinFee = function (tx) {
176
+ TxBuilder.prototype.calcMinFee = function (tx, minimum) {
177
177
  var _a;
178
178
  var totRefScriptBytes = ((_a = tx.body.refInputs) !== null && _a !== void 0 ? _a : [])
179
179
  .reduce(function (sum, refIn) {
@@ -198,7 +198,10 @@ var TxBuilder = /** @class */ (function () {
198
198
  BigInt(104) * nVkeyWits * minFeeMultiplier +
199
199
  // we add some more bytes for the array tag
200
200
  BigInt(nVkeyWits < 24 ? 1 : (nVkeyWits < 256 ? 2 : 4)) * minFeeMultiplier;
201
- return minFee;
201
+ if (!(0, ints_1.canBeUInteger)(minimum))
202
+ return minFee;
203
+ var min = (0, ints_1.forceBigUInt)(minimum);
204
+ return minFee < min ? min : minFee;
202
205
  };
203
206
  TxBuilder.prototype.getMinimumOutputLovelaces = function (tx_out) {
204
207
  var size = BigInt(0);
@@ -410,7 +413,7 @@ var TxBuilder = /** @class */ (function () {
410
413
  for (var i = 0; i < nRdmrs; i++) {
411
414
  _loop_2(i);
412
415
  }
413
- minFee = this_1.calcMinFee(tx);
416
+ minFee = this_1.calcMinFee(tx, buildArgs.fee);
414
417
  fee = minFee +
415
418
  ((totExBudget.mem * memRational.num) / memRational.den) +
416
419
  ((totExBudget.cpu * cpuRational.num) / cpuRational.den) +
@@ -945,9 +948,7 @@ var TxBuilder = /** @class */ (function () {
945
948
  auxiliaryData: auxData,
946
949
  isScriptValid: isScriptValid
947
950
  });
948
- var minFee = this.calcMinFee(dummyTx);
949
- if (typeof args.fee === "bigint" && args.fee > minFee)
950
- minFee = args.fee;
951
+ var minFee = this.calcMinFee(dummyTx, args.fee);
951
952
  var txOuts = new Array(outs.length + 1);
952
953
  outs.forEach(function (txO, i) { return txOuts[i] = _this.addMinLovelacesIfMissing(txO); });
953
954
  var changeOutput = new cardano_ledger_ts_1.TxOut({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmoniclabs/buildooor",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Cardano transaction builder in typescript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",