@exodus/ethereum-lib 2.1.0 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -25,5 +25,5 @@
25
25
  "devDependencies": {
26
26
  "@exodus/models": "^8.5.1"
27
27
  },
28
- "gitHead": "3530b1a7710f3aec0aba47dd761e4911629a96ad"
28
+ "gitHead": "956ac273cee5a8979824a68127a6d400ac711e48"
29
29
  }
@@ -2,7 +2,7 @@ import { FeeData } from '@exodus/asset-lib'
2
2
 
3
3
  export default new FeeData(
4
4
  {
5
- gasPrice: '50 Gwei',
5
+ gasPrice: '75 Gwei',
6
6
  max: '250 Gwei',
7
7
  min: '1 Gwei',
8
8
  },
@@ -8,6 +8,27 @@ const BumpType = {
8
8
  RBF: 2,
9
9
  }
10
10
 
11
+ export function getPendingNonExchangeTxs(activeWalletAccount, getTxLog, getIsExchangeTx) {
12
+ // check if the tx log even has pending transactions
13
+ const result = isQueuedPendingTx(
14
+ { data: { nonce: Number.MAX_SAFE_INTEGER } },
15
+ activeWalletAccount,
16
+ getTxLog
17
+ )
18
+ if (!result) return []
19
+
20
+ const txLog = getTxLog('ethereum', activeWalletAccount)
21
+ const pendingNonExchangeTxs = []
22
+ for (let index = isQueuedPendingTx.minIndex; index < txLog.size; index++) {
23
+ const _tx = txLog.getAt(index)
24
+ if (_tx.pending && _tx.sent && !getIsExchangeTx(_tx.txId)) {
25
+ pendingNonExchangeTxs.push(_tx)
26
+ }
27
+ }
28
+
29
+ return pendingNonExchangeTxs
30
+ }
31
+
11
32
  function isQueuedPendingTx(tx, activeWalletAccount, getTxLog) {
12
33
  const txLog = getTxLog('ethereum', activeWalletAccount)
13
34
  if (!txLog || txLog.size === 0) return false
@@ -56,7 +77,7 @@ export default (
56
77
  getIsRbfEnabledSelector,
57
78
  getIsEnoughBalanceToAccelerateSelector,
58
79
  getTxLogSelector,
59
- getIsFailedOrderByTxIdSelector,
80
+ getIsExchangeTxSelector,
60
81
  assets
61
82
  ) =>
62
83
  createSelector(
@@ -67,7 +88,7 @@ export default (
67
88
  getIsRbfEnabledSelector,
68
89
  getIsEnoughBalanceToAccelerateSelector,
69
90
  getTxLogSelector,
70
- getIsFailedOrderByTxIdSelector,
91
+ getIsExchangeTxSelector,
71
92
  (
72
93
  getFeeData,
73
94
  getFee,
@@ -76,21 +97,15 @@ export default (
76
97
  getIsRbfEnabled,
77
98
  getIsEnoughBalanceToAccelerate,
78
99
  getTxLog,
79
- getIsFailedOrderByTxId
100
+ getIsExchangeTx
80
101
  ) => (tx) => {
81
102
  const assetName = tx.coinName
82
103
  const asset = assets[assetName]
83
104
  if (!getIsRbfEnabled(assetName)) return BumpType.NONE
84
105
  if (!['ETHEREUM_ERC20', 'ETHEREUM_LIKE'].includes(asset.assetType)) return BumpType.NONE
85
- const isFailedExchangeOrder = getIsFailedOrderByTxId(tx.txId)
86
- if (
87
- !tx.pending ||
88
- !tx.sent ||
89
- (tx.exchange && !isFailedExchangeOrder) ||
90
- !tx.data ||
91
- !tx.data.gasLimit
92
- )
93
- return BumpType.NONE
106
+ if (!tx.pending || !tx.sent || !tx.data || !tx.data.gasLimit) return BumpType.NONE
107
+ const isExchangeTx = getIsExchangeTx(tx.txId)
108
+ if (isExchangeTx) return BumpType.NONE
94
109
  const personalNote = getPersonalNoteByTxId(tx.txId)
95
110
  if (personalNote && personalNote.dapp) return BumpType.NONE
96
111
  if (isQueuedPendingTx(tx, activeWalletAccount, getTxLog)) return BumpType.NONE
@@ -1,6 +1,7 @@
1
1
  export {
2
2
  default as getCanAccelerateTxFactory,
3
3
  calculateBumpedGasPrice,
4
+ getPendingNonExchangeTxs,
4
5
  } from './get-can-accelerate-tx-factory'
5
6
 
6
7
  export { default as getIsEnoughBalanceToAccelerateSelectorFactory } from './get-is-enough-balance-to-accelerate-factory'