@stellar-expert/tx-meta-effects-parser 5.0.2 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "5.0.2",
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()
@@ -47,7 +47,7 @@ function xdrParseAccountAddress(accountId, muxedAccountsSupported = false) {
47
47
  throw new TxMetaEffectParserError(`Unsupported account type: ${accountId.arm()}`)
48
48
  }
49
49
  }
50
- if (accountId instanceof Buffer) {
50
+ if (accountId instanceof Uint8Array) {
51
51
  return StrKey.encodeEd25519PublicKey(accountId)
52
52
  }
53
53
  throw new TypeError(`Failed to identify and parse account address: ${accountId}`)