@stellar/stellar-base 14.0.1 → 14.0.2

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.
@@ -22689,14 +22689,31 @@ var TransactionBuilder = /*#__PURE__*/function () {
22689
22689
  key: "buildFeeBumpTransaction",
22690
22690
  value: function buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase) {
22691
22691
  var innerOps = innerTx.operations.length;
22692
- var innerBaseFeeRate = new util_bignumber(innerTx.fee).div(innerOps);
22692
+ var minBaseFee = new util_bignumber(BASE_FEE);
22693
+ var innerInclusionFee = new util_bignumber(innerTx.fee).div(innerOps);
22694
+ var resourceFee = new util_bignumber(0);
22695
+
22696
+ // Do we need to do special Soroban fee handling? We only want the fee-bump
22697
+ // requirement to match the inclusion fee, not the inclusion+resource fee.
22698
+ var env = innerTx.toEnvelope();
22699
+ switch (env["switch"]().value) {
22700
+ case src_xdr.EnvelopeType.envelopeTypeTx().value:
22701
+ {
22702
+ var _sorobanData$resource;
22703
+ var sorobanData = env.v1().tx().ext().value();
22704
+ resourceFee = new util_bignumber((_sorobanData$resource = sorobanData === null || sorobanData === void 0 ? void 0 : sorobanData.resourceFee()) !== null && _sorobanData$resource !== void 0 ? _sorobanData$resource : 0);
22705
+ innerInclusionFee = util_bignumber.max(minBaseFee, innerInclusionFee.minus(resourceFee));
22706
+ break;
22707
+ }
22708
+ default:
22709
+ break;
22710
+ }
22693
22711
  var base = new util_bignumber(baseFee);
22694
22712
 
22695
22713
  // The fee rate for fee bump is at least the fee rate of the inner transaction
22696
- if (base.lt(innerBaseFeeRate)) {
22697
- throw new Error("Invalid baseFee, it should be at least ".concat(innerBaseFeeRate, " stroops."));
22714
+ if (base.lt(innerInclusionFee)) {
22715
+ throw new Error("Invalid baseFee, it should be at least ".concat(innerInclusionFee, " stroops."));
22698
22716
  }
22699
- var minBaseFee = new util_bignumber(BASE_FEE);
22700
22717
 
22701
22718
  // The fee rate is at least the minimum fee
22702
22719
  if (base.lt(minBaseFee)) {
@@ -22727,7 +22744,7 @@ var TransactionBuilder = /*#__PURE__*/function () {
22727
22744
  }
22728
22745
  var tx = new src_xdr.FeeBumpTransaction({
22729
22746
  feeSource: feeSourceAccount,
22730
- fee: src_xdr.Int64.fromString(base.times(innerOps + 1).toString()),
22747
+ fee: src_xdr.Int64.fromString(base.times(innerOps + 1).plus(resourceFee).toString()),
22731
22748
  innerTx: src_xdr.FeeBumpTransactionInnerTx.envelopeTypeTx(innerTxEnvelope.v1()),
22732
22749
  ext: new src_xdr.FeeBumpTransactionExt(0)
22733
22750
  });