@exodus/ethereum-lib 2.0.5 → 2.0.7

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.5",
3
+ "version": "2.0.7",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -16,6 +16,7 @@
16
16
  "base-x": "^3.0.2",
17
17
  "ethereumjs-tx": "^1.3.7",
18
18
  "ethereumjs-util": "^5.2.0",
19
+ "ms": "^2.1.1",
19
20
  "reselect": "~3.0.1"
20
21
  },
21
22
  "peerDependencies": {
@@ -24,5 +25,5 @@
24
25
  "devDependencies": {
25
26
  "@exodus/models": "^8.5.1"
26
27
  },
27
- "gitHead": "52af7a402c4716883165bfbd1c9b685fd707b3ea"
28
+ "gitHead": "42fbfc6f7d7af50691c871b363150d904d4e59fd"
28
29
  }
@@ -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)