@exodus/ethereum-api 8.4.0 → 8.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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
+ ## [8.4.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.4.0...@exodus/ethereum-api@8.4.1) (2024-06-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ethereum:** validate unconfirmed txs before dropping them ([#2550](https://github.com/ExodusMovement/assets/issues/2550)) ([5b6b5c8](https://github.com/ExodusMovement/assets/commit/5b6b5c8469c492413a27ebe45a59ad82732fc233))
12
+ * evm tx-send security hardening ([#2543](https://github.com/ExodusMovement/assets/issues/2543)) ([3b476ce](https://github.com/ExodusMovement/assets/commit/3b476ce383a18db0337f86cd9f271ad34b9dbb4d))
13
+
14
+
15
+
6
16
  ## [8.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.3.2...@exodus/ethereum-api@8.4.0) (2024-06-10)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -66,5 +66,5 @@
66
66
  "type": "git",
67
67
  "url": "git+https://github.com/ExodusMovement/assets.git"
68
68
  },
69
- "gitHead": "e33a20671ce835d88a11a5a8dc97e494ba04341f"
69
+ "gitHead": "fca8781b6cb3e3e3148df5885e4f60ddd6746623"
70
70
  }
@@ -75,14 +75,13 @@ export class EthereumMonitor extends BaseMonitor {
75
75
  assetSource: { walletAccount },
76
76
  } = params
77
77
 
78
- const updateTx = (tx, asset, { error, remove }) => {
78
+ const updateTx = (tx, asset, { isTxConfirmed, remove }) => {
79
79
  if (remove) {
80
80
  txsToRemove.push({ tx, assetSource: { asset, walletAccount } })
81
81
  } else {
82
82
  params.logItemsByAsset[asset].push({
83
83
  ...tx,
84
- dropped: true,
85
- error,
84
+ ...(isTxConfirmed ? { confirmations: 1 } : { dropped: true, error: 'Dropped' }),
86
85
  })
87
86
  }
88
87
 
@@ -97,11 +96,11 @@ export class EthereumMonitor extends BaseMonitor {
97
96
  } else if (tokenTxSet && tokenTxSet.has(tx.txId)) {
98
97
  params.logItemsByAsset[assetName].push({
99
98
  ...tokenTxSet.get(tx.txId),
100
- error,
101
- dropped: true,
99
+ ...(isTxConfirmed ? { confirmations: 1 } : { dropped: true, error: 'Dropped' }),
102
100
  })
103
101
  }
104
102
  })
103
+
105
104
  return Promise.all(promises)
106
105
  }
107
106
 
@@ -115,8 +114,17 @@ export class EthereumMonitor extends BaseMonitor {
115
114
  }
116
115
 
117
116
  for (const { tx, assetName } of Object.values(pendingTransactionsToCheck)) {
118
- if (params.refresh) await updateTx(tx, assetName, { remove: true })
119
- else await updateTx(tx, assetName, { error: 'Dropped' })
117
+ if (params.refresh) {
118
+ await updateTx(tx, assetName, { remove: true })
119
+ } else {
120
+ // FIXME: Fetching unconfirmed txs from node helps to avoid
121
+ // flagging on-chain confirmed txs as dropped in the wallet.
122
+ // Once the real bug is found, remove this logic
123
+ const response = await this.server.getTransactionByHash(tx.txId)
124
+ const isTxConfirmed = response?.result?.blockNumber !== null
125
+ this.logger.warn(`tx ${tx.txId} confirmed: ${isTxConfirmed}`)
126
+ await updateTx(tx, assetName, { isTxConfirmed })
127
+ }
120
128
  }
121
129
 
122
130
  return {
@@ -162,7 +162,9 @@ const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
162
162
  gasLimit,
163
163
  replacedTxId: bumpTxId,
164
164
  nonce,
165
- ...(tipGasPrice ? { tipGasPrice: tipGasPrice.toBaseString() } : {}),
165
+ ...(tipGasPrice
166
+ ? { tipGasPrice: tipGasPrice.toBaseString() }
167
+ : Object.create(null)),
166
168
  }
167
169
  : { gasLimit, replacedTxId: bumpTxId, nonce },
168
170
  },