@exodus/ethereum-lib 5.17.0 → 5.17.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.17.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.17.1...@exodus/ethereum-lib@5.17.2) (2025-08-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: add getAssetPendingNonExchangeTxs back (#6354)
13
+
14
+
15
+
16
+ ## [5.17.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.17.0...@exodus/ethereum-lib@5.17.1) (2025-08-19)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+
22
+ * fix: wait 1 minute before allowing acceleration (#6286)
23
+
24
+
25
+
6
26
  ## [5.17.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.16.1...@exodus/ethereum-lib@5.17.0) (2025-08-04)
7
27
 
8
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "5.17.0",
3
+ "version": "5.17.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",
@@ -50,5 +50,5 @@
50
50
  "type": "git",
51
51
  "url": "git+https://github.com/ExodusMovement/assets.git"
52
52
  },
53
- "gitHead": "177b7c95d9818222fa9887f7b5698e363e122e31"
53
+ "gitHead": "6f48374a175ff7ccea7549806d9f6d574d2f8693"
54
54
  }
@@ -24,12 +24,14 @@ export function getAssetPendingNonExchangeTxs(
24
24
  getTxLog,
25
25
  getIsExchangeTx
26
26
  ) {
27
+ const now = Date.now()
27
28
  // check if the tx log even has pending transactions
28
29
  const result = isQueuedPendingTx(
29
30
  { data: { nonce: Number.MAX_SAFE_INTEGER } },
30
31
  baseAssetName,
31
32
  activeWalletAccount,
32
- getTxLog
33
+ getTxLog,
34
+ now
33
35
  )
34
36
  if (!result) return []
35
37
 
@@ -45,7 +47,7 @@ export function getAssetPendingNonExchangeTxs(
45
47
  return pendingNonExchangeTxs
46
48
  }
47
49
 
48
- function isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog) {
50
+ function isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog, now) {
49
51
  const txLog = getTxLog(baseAssetName, activeWalletAccount)
50
52
  if (!txLog || txLog.size === 0) return false
51
53
 
@@ -63,7 +65,7 @@ function isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog) {
63
65
  if (nonce === undefined) continue
64
66
 
65
67
  // ignore nonce of a TX that just replaced an another tx
66
- if (_tx.data.replacedTxId && Date.now() - _tx.date < MINUTE) continue
68
+ if (_tx.data.replacedTxId && now - _tx.date < MINUTE) continue
67
69
  if (_tx.sent && nonce < minPendingNonce) {
68
70
  minPendingNonce = nonce
69
71
  isQueuedPendingTx.minIndex = index
@@ -220,11 +222,12 @@ export const calculateBumpedGasPrice = ({
220
222
  // `gasPrice` of the previous transaction).
221
223
  const prevMaxFeePerGas = calculateTxGasPrice(tx)
222
224
 
223
- if (!eip1559Enabled)
225
+ if (!eip1559Enabled) {
224
226
  return calculateBumpedGasPriceNonEip1559({
225
227
  currentGasPrice,
226
228
  prevMaxFeePerGas,
227
229
  })
230
+ }
228
231
 
229
232
  if (!currentBaseFee) {
230
233
  // NOTE: This can result in differences between predicted and realized fees.
@@ -260,24 +263,40 @@ export const canAccelerateTx = ({
260
263
  getIsEnoughBalanceToAccelerate,
261
264
  getTxLog,
262
265
  getIsExchangeTx,
266
+ now,
263
267
  }) => {
264
268
  const assetName = tx.coinName
265
269
  const baseAsset = assets[assetName].baseAsset
266
270
  const baseAssetName = baseAsset.name
271
+
267
272
  if (!getIsRbfEnabled(assetName)) return wrapResponseToObject({ errorMessage: 'rbf is disabled' })
268
- if (!isEthereumLike(assets[assetName]))
273
+ if (!isEthereumLike(assets[assetName])) {
269
274
  return wrapResponseToObject({ errorMessage: `not an ETH/ERC20/BSC/BEP20 asset supplied` })
270
- if (!tx.pending || !tx.sent)
275
+ }
276
+
277
+ if (!tx.pending || !tx.sent) {
271
278
  return wrapResponseToObject({ errorMessage: 'can not bump a confirmed or received TX' })
272
- if (!tx.data || !(tx.data.gasLimit || tx.data.tipGasPrice))
279
+ }
280
+
281
+ if (!tx.data || !(tx.data.gasLimit || tx.data.tipGasPrice)) {
273
282
  return wrapResponseToObject({ errorMessage: 'data object is missing or corrupted' })
283
+ }
284
+
274
285
  const isExchangeTx = getIsExchangeTx(tx.txId)
275
286
  if (isExchangeTx) return wrapResponseToObject({ errorMessage: 'can not bump an exchange TX' })
287
+
288
+ if (now - tx.date < MINUTE) {
289
+ return wrapResponseToObject({ errorMessage: 'wait before allowing acceleration' })
290
+ }
291
+
276
292
  const personalNote = getPersonalNoteByTxId(tx.txId)
277
- if (personalNote && personalNote.dapp)
293
+ if (personalNote && personalNote.dapp) {
278
294
  return wrapResponseToObject({ errorMessage: 'can not bump a dapp TX' })
279
- if (isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog))
295
+ }
296
+
297
+ if (isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog, now)) {
280
298
  return wrapResponseToObject({ errorMessage: 'there is a stuck TX with lower nonce' })
299
+ }
281
300
 
282
301
  const {
283
302
  gasPrice: currentGasPrice,
@@ -298,8 +317,9 @@ export const canAccelerateTx = ({
298
317
 
299
318
  const extraEthNeeded = replacementFee.sub(tx.feeAmount)
300
319
 
301
- if (!getIsEnoughBalanceToAccelerate(activeWalletAccount, baseAssetName, extraEthNeeded))
320
+ if (!getIsEnoughBalanceToAccelerate(activeWalletAccount, baseAssetName, extraEthNeeded)) {
302
321
  return wrapResponseToObject({ errorMessage: 'insufficient funds' })
322
+ }
303
323
 
304
324
  return wrapResponseToObject({ bumpType: BumpType.RBF })
305
325
  }
@@ -313,7 +333,8 @@ const getCanAccelerateTxFactory = (
313
333
  getIsEnoughBalanceToAccelerateSelector,
314
334
  getTxLogSelector,
315
335
  getIsExchangeTxSelector,
316
- assetsSelector
336
+ assetsSelector,
337
+ timeSelector
317
338
  ) =>
318
339
  createSelector(
319
340
  getFeeDataSelector,
@@ -325,6 +346,7 @@ const getCanAccelerateTxFactory = (
325
346
  getTxLogSelector,
326
347
  getIsExchangeTxSelector,
327
348
  assetsSelector,
349
+ timeSelector,
328
350
  (
329
351
  getFeeData,
330
352
  getFee,
@@ -334,7 +356,8 @@ const getCanAccelerateTxFactory = (
334
356
  getIsEnoughBalanceToAccelerate,
335
357
  getTxLog,
336
358
  getIsExchangeTx,
337
- assets
359
+ assets,
360
+ now
338
361
  ) =>
339
362
  (tx) =>
340
363
  canAccelerateTx({
@@ -348,6 +371,7 @@ const getCanAccelerateTxFactory = (
348
371
  getIsEnoughBalanceToAccelerate,
349
372
  getTxLog,
350
373
  getIsExchangeTx,
374
+ now,
351
375
  })
352
376
  )
353
377
 
@@ -13,7 +13,7 @@ const parseBufferToJsTx = (unsignedTx) => {
13
13
  'Cannot create ethereum js tx when transactionBuffer and other fields are provided!'
14
14
  )
15
15
  assert(chainId, 'chainId must be provided when parsing from transaction buffer!!!')
16
- if (FeeMarketEIP1559Transaction.isEip1559SerializedTx(transactionBuffer))
16
+ if (FeeMarketEIP1559Transaction.isEip1559SerializedTx(transactionBuffer)) {
17
17
  return FeeMarketEIP1559Transaction.fromSerializedTx(transactionBuffer, {
18
18
  common: Common.custom(
19
19
  {
@@ -22,6 +22,8 @@ const parseBufferToJsTx = (unsignedTx) => {
22
22
  { hardfork: Hardfork.London }
23
23
  ),
24
24
  })
25
+ }
26
+
25
27
  return Transaction.fromSerializedTx(transactionBuffer, {
26
28
  common: Common.custom({
27
29
  chainId,
@@ -48,11 +48,12 @@ function resolveToAmount({ asset, data, value, to: rawTo }) {
48
48
 
49
49
  if (_isToken) {
50
50
  const { method, values } = asset.contract.decodeInput(data)
51
- if (method === 'transfer' || method === 'approve')
51
+ if (method === 'transfer' || method === 'approve') {
52
52
  return {
53
53
  to: values[0],
54
54
  amount: asset.currency.baseUnit(values[1]),
55
55
  }
56
+ }
56
57
 
57
58
  return { to: values[0], amount: asset.currency.ZERO }
58
59
  }