@stellar-expert/tx-meta-effects-parser 5.4.0 → 5.5.0

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 +2 -2
  2. package/src/index.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "author": "team@stellar.expert",
10
10
  "license": "MIT",
11
11
  "peerDependencies": {
12
- "@stellar/stellar-base": "^11.0.0"
12
+ "@stellar/stellar-base": "^12.0.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/core": "^7.22.9",
package/src/index.js CHANGED
@@ -18,9 +18,10 @@ const effectTypes = require('./effect-types')
18
18
  * @param {String|Buffer|xdr.TransactionMeta} [meta] - Base64-encoded tx envelope meta
19
19
  * @param {Boolean} [mapSac] - Whether to create a map SAC->Asset
20
20
  * @param {Boolean} [processSystemEvents] - Emit effects for contract errors and resource stats
21
+ * @param {Number} [protocol] - Specific Stellar protocol version for the executed transaction
21
22
  * @return {ParsedTxOperationsMetadata}
22
23
  */
23
- function parseTxOperationsMeta({network, tx, result, meta, mapSac = false, processSystemEvents = false}) {
24
+ function parseTxOperationsMeta({network, tx, result, meta, mapSac = false, processSystemEvents = false, protocol}) {
24
25
  if (!network)
25
26
  throw new TypeError(`Network passphrase argument is required.`)
26
27
  if (typeof network !== 'string')
@@ -113,7 +114,7 @@ function parseTxOperationsMeta({network, tx, result, meta, mapSac = false, proce
113
114
  effect.source = (before || after).address
114
115
  res.effects.push(effect)
115
116
  }
116
- if (isFeeBump && before.balance !== after.balance) { //fee bump fee calculation bug
117
+ if (isFeeBump && protocol === 20 && before.balance !== after.balance) { //bump fee calculation bug in protocol v20
117
118
  const currentFee = BigInt(feeEffect.charged)
118
119
  const diff = BigInt(after.balance) - BigInt(before.balance)
119
120
  if (diff < currentFee) { // do not allow negative fee