@exodus/ethereum-lib 2.0.5 → 2.0.6
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": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Exodus Movement, Inc.",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@exodus/models": "^8.5.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "38a0f167883abb62d45459bcd747f38a6c5a3b0d"
|
|
28
28
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createSelector } from 'reselect'
|
|
2
|
+
import ms from 'ms'
|
|
2
3
|
|
|
4
|
+
const MINUTE = ms('1m')
|
|
3
5
|
const BumpType = {
|
|
4
6
|
NONE: 0,
|
|
5
7
|
CPFP: 1,
|
|
@@ -15,6 +17,8 @@ function isQueuedPendingTx(tx, activeWalletAccount, getTxLog) {
|
|
|
15
17
|
for (let index = 0; index < txLog.size; index++) {
|
|
16
18
|
const _tx = txLog.getAt(index)
|
|
17
19
|
if (!_tx.pending) continue
|
|
20
|
+
// ignore nonce of a TX that just replaced an another tx
|
|
21
|
+
if (_tx.data?.replacedTxId && Date.now() - _tx.date < MINUTE) continue
|
|
18
22
|
if (_tx.sent && _tx.data?.nonce < minPendingNonce) {
|
|
19
23
|
minPendingNonce = _tx.data.nonce
|
|
20
24
|
isQueuedPendingTx.minIndex = index
|
|
@@ -24,6 +28,12 @@ function isQueuedPendingTx(tx, activeWalletAccount, getTxLog) {
|
|
|
24
28
|
return tx.data.nonce > minPendingNonce
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
// needs for tests
|
|
32
|
+
export const _refreshCache = () => {
|
|
33
|
+
isQueuedPendingTx.minPendingNonce = null
|
|
34
|
+
isQueuedPendingTx.minIndex = null
|
|
35
|
+
}
|
|
36
|
+
|
|
27
37
|
export const calculateBumpedGasPrice = (tx, currentGasPrice) => {
|
|
28
38
|
const usedGasPrice = tx.feeAmount.div(tx.data.gasLimit)
|
|
29
39
|
const bumpedGasPrice = usedGasPrice.mul(12).div(10)
|