@exodus/ethereum-lib 1.2.0 → 1.2.1

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": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -21,5 +21,5 @@
21
21
  "peerDependencies": {
22
22
  "@exodus/assets": "8.0.x"
23
23
  },
24
- "gitHead": "2e5d344cb8f52ccd17e37dfa73db49a95a927e96"
24
+ "gitHead": "80487ac0f84b65961f7603bceb1bfa0ff07cc6fa"
25
25
  }
@@ -11,7 +11,8 @@ export default (
11
11
  getFeeSelector,
12
12
  getWalletAccountBalancesSelector,
13
13
  activeWalletAccountSelector,
14
- getPersonalNoteByTxIdSelector
14
+ getPersonalNoteByTxIdSelector,
15
+ assets
15
16
  ) =>
16
17
  createSelector(
17
18
  getFeeDataSelector,
@@ -22,12 +23,13 @@ export default (
22
23
  (getFeeData, getFee, getWalletAccountBalances, activeWalletAccount, getPersonalNoteByTxId) => (
23
24
  tx
24
25
  ) => {
25
- if (!['ethereum', 'ethereumclassic'].includes(tx.coinName)) return BumpType.NONE
26
- if (!tx.pending || !tx.sent || tx.exchange) return BumpType.NONE
26
+ const assetName = tx.coinName
27
+ const asset = assets[assetName]
28
+ if (!['ETHEREUM_ERC20', 'ETHEREUM_LIKE'].includes(asset.assetType)) return BumpType.NONE
29
+ if (!tx.pending || !tx.sent || tx.exchange || !tx.data?.gasLimit) return BumpType.NONE
27
30
  if (getPersonalNoteByTxId(tx.txId)?.dapp) return BumpType.NONE
28
31
 
29
32
  const walletAccountBalances = getWalletAccountBalances(activeWalletAccount)
30
- const assetName = tx.coinName
31
33
  const { gasPrice: currentGasPrice } = getFeeData(assetName)
32
34
  const usedGasPrice = tx.feeAmount.div(tx.data.gasLimit)
33
35
  // new gas price should be at least 20% higher and not less than the current gas price
@@ -35,7 +37,7 @@ export default (
35
37
  const gasPriceToUse = currentGasPrice.gt(bumpedGasPrice) ? currentGasPrice : bumpedGasPrice
36
38
  const replacementFee = gasPriceToUse.mul(tx.data.gasLimit)
37
39
  const extraEthNeeded = replacementFee.sub(tx.feeAmount)
38
- if (walletAccountBalances[assetName].lt(extraEthNeeded)) return BumpType.NONE
40
+ if (walletAccountBalances[asset.baseAsset.name].lt(extraEthNeeded)) return BumpType.NONE
39
41
 
40
42
  return BumpType.RBF
41
43
  }