@exodus/ethereum-lib 5.21.0 → 5.21.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
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.21.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.21.1...@exodus/ethereum-lib@5.21.2) (2026-03-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* fix: queued/invalid Ethereum transactions being offered for RBF acceleration (#7463)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [5.21.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.21.0...@exodus/ethereum-lib@5.21.1) (2026-02-26)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix(ethereum-lib): return null instead of NumberUnit ZERO in calculateExtraEth (#7473)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [5.21.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.20.4...@exodus/ethereum-lib@5.21.0) (2026-01-14)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "5.21.
|
|
3
|
+
"version": "5.21.2",
|
|
4
4
|
"description": "Ethereum utils, such as for cryptography, address encoding/decoding, transaction building, etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"type": "git",
|
|
52
52
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "fe1940f74bc72ad8d7555288baaf2b18eb3542ea"
|
|
55
55
|
}
|
|
@@ -88,9 +88,9 @@ export function getAssetPendingNonExchangeTxs(
|
|
|
88
88
|
|
|
89
89
|
const txLog = getTxLog(baseAssetName, activeWalletAccount)
|
|
90
90
|
const pendingNonExchangeTxs = []
|
|
91
|
-
for (
|
|
92
|
-
|
|
93
|
-
if (_tx.
|
|
91
|
+
for (const _tx of txLog.reverse()) {
|
|
92
|
+
if (_tx.sent && !_tx.pending) break
|
|
93
|
+
if (_tx.sent && !getIsExchangeTx(_tx.txId)) {
|
|
94
94
|
pendingNonExchangeTxs.push(_tx)
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -102,11 +102,6 @@ function isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog, now
|
|
|
102
102
|
const txLog = getTxLog(baseAssetName, activeWalletAccount)
|
|
103
103
|
if (!txLog || txLog.size === 0) return false
|
|
104
104
|
|
|
105
|
-
const txAtMinIndex = txLog.getAt(isQueuedPendingTx.minIndex)
|
|
106
|
-
if (isQueuedPendingTx.minIndex >= 0 && txAtMinIndex && txAtMinIndex.pending) {
|
|
107
|
-
return tx.data && tx.data.nonce > txAtMinIndex.data.nonce
|
|
108
|
-
}
|
|
109
|
-
|
|
110
105
|
let minPendingNonce = Number.MAX_SAFE_INTEGER
|
|
111
106
|
for (let index = 0; index < txLog.size; index++) {
|
|
112
107
|
const _tx = txLog.getAt(index)
|
|
@@ -115,23 +110,14 @@ function isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog, now
|
|
|
115
110
|
const nonce = _tx.data && _tx.data.nonce
|
|
116
111
|
if (nonce === undefined) continue
|
|
117
112
|
|
|
118
|
-
// ignore nonce of a TX that just replaced an another tx
|
|
119
|
-
if (_tx.data.replacedTxId && now - _tx.date < MINUTE) continue
|
|
120
113
|
if (_tx.sent && nonce < minPendingNonce) {
|
|
121
114
|
minPendingNonce = nonce
|
|
122
|
-
isQueuedPendingTx.minIndex = index
|
|
123
115
|
}
|
|
124
116
|
}
|
|
125
117
|
|
|
126
118
|
return tx.data.nonce > minPendingNonce
|
|
127
119
|
}
|
|
128
120
|
|
|
129
|
-
// needs for tests
|
|
130
|
-
export const _refreshCache = () => {
|
|
131
|
-
isQueuedPendingTx.minPendingNonce = null
|
|
132
|
-
isQueuedPendingTx.minIndex = null
|
|
133
|
-
}
|
|
134
|
-
|
|
135
121
|
const wrapResponseToObject = ({ bumpType = BumpType.NONE, errorMessage = null } = {}) => ({
|
|
136
122
|
bumpType,
|
|
137
123
|
errorMessage,
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
const defaultMultiplier = 1.1
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
// if a wallet has <N> ETH, the deposit needed should be the fee * <multiplier> - <N>
|
|
3
|
+
// Returns the extra amount needed beyond balance to cover fee * multiplier, or ZERO if balance already covers it.
|
|
5
4
|
export default function ({ fee, balance, multiplier = defaultMultiplier }) {
|
|
6
5
|
if (typeof multiplier !== 'number' || multiplier < 1) multiplier = defaultMultiplier
|
|
7
6
|
if (balance.gt(fee)) return balance.unitType.ZERO
|
|
8
7
|
|
|
9
|
-
return fee
|
|
10
|
-
.mul(multiplier)
|
|
11
|
-
.sub(balance)
|
|
12
|
-
.toDefault() // ensure correct unit before `toFixed`
|
|
13
|
-
.toFixed(4, 'ceil')
|
|
14
|
-
.toDefaultString({ unit: true })
|
|
8
|
+
return fee.mul(multiplier).sub(balance)
|
|
15
9
|
}
|