@stellar/stellar-base 14.0.0 → 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.
- package/CHANGELOG.md +344 -296
- package/dist/stellar-base.js +22 -5
- package/dist/stellar-base.min.js +1 -1
- package/lib/transaction_builder.js +22 -5
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
|
@@ -694,14 +694,31 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
694
694
|
key: "buildFeeBumpTransaction",
|
|
695
695
|
value: function buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase) {
|
|
696
696
|
var innerOps = innerTx.operations.length;
|
|
697
|
-
var
|
|
697
|
+
var minBaseFee = new _bignumber["default"](BASE_FEE);
|
|
698
|
+
var innerInclusionFee = new _bignumber["default"](innerTx.fee).div(innerOps);
|
|
699
|
+
var resourceFee = new _bignumber["default"](0);
|
|
700
|
+
|
|
701
|
+
// Do we need to do special Soroban fee handling? We only want the fee-bump
|
|
702
|
+
// requirement to match the inclusion fee, not the inclusion+resource fee.
|
|
703
|
+
var env = innerTx.toEnvelope();
|
|
704
|
+
switch (env["switch"]().value) {
|
|
705
|
+
case _xdr["default"].EnvelopeType.envelopeTypeTx().value:
|
|
706
|
+
{
|
|
707
|
+
var _sorobanData$resource;
|
|
708
|
+
var sorobanData = env.v1().tx().ext().value();
|
|
709
|
+
resourceFee = new _bignumber["default"]((_sorobanData$resource = sorobanData === null || sorobanData === void 0 ? void 0 : sorobanData.resourceFee()) !== null && _sorobanData$resource !== void 0 ? _sorobanData$resource : 0);
|
|
710
|
+
innerInclusionFee = _bignumber["default"].max(minBaseFee, innerInclusionFee.minus(resourceFee));
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
default:
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
698
716
|
var base = new _bignumber["default"](baseFee);
|
|
699
717
|
|
|
700
718
|
// The fee rate for fee bump is at least the fee rate of the inner transaction
|
|
701
|
-
if (base.lt(
|
|
702
|
-
throw new Error("Invalid baseFee, it should be at least ".concat(
|
|
719
|
+
if (base.lt(innerInclusionFee)) {
|
|
720
|
+
throw new Error("Invalid baseFee, it should be at least ".concat(innerInclusionFee, " stroops."));
|
|
703
721
|
}
|
|
704
|
-
var minBaseFee = new _bignumber["default"](BASE_FEE);
|
|
705
722
|
|
|
706
723
|
// The fee rate is at least the minimum fee
|
|
707
724
|
if (base.lt(minBaseFee)) {
|
|
@@ -732,7 +749,7 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
732
749
|
}
|
|
733
750
|
var tx = new _xdr["default"].FeeBumpTransaction({
|
|
734
751
|
feeSource: feeSourceAccount,
|
|
735
|
-
fee: _xdr["default"].Int64.fromString(base.times(innerOps + 1).toString()),
|
|
752
|
+
fee: _xdr["default"].Int64.fromString(base.times(innerOps + 1).plus(resourceFee).toString()),
|
|
736
753
|
innerTx: _xdr["default"].FeeBumpTransactionInnerTx.envelopeTypeTx(innerTxEnvelope.v1()),
|
|
737
754
|
ext: new _xdr["default"].FeeBumpTransactionExt(0)
|
|
738
755
|
});
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED