@stellar-expert/tx-meta-effects-parser 5.0.3 → 5.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -110,8 +110,12 @@ function parseTxOperationsMeta({network, tx, result, meta}) {
110
110
  effect.source = (before || after).address
111
111
  res.effects.push(effect)
112
112
  }
113
- if (before.balance !== after.balance) { //
114
- feeEffect.charged = (BigInt(feeEffect.charged) - BigInt(after.balance) + BigInt(before.balance)).toString()
113
+ if (isFeeBump && before.balance !== after.balance) { //fee bump fee calculation bug
114
+ const currentFee = BigInt(feeEffect.charged)
115
+ const diff = BigInt(after.balance) - BigInt(before.balance)
116
+ if (diff < currentFee) { // do not allow negative fee
117
+ feeEffect.charged = (currentFee - diff).toString()
118
+ }
115
119
  }
116
120
  }
117
121
  const metaValue = meta.value()