@exodus/ethereum-api 10.1.2 → 10.1.4

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,24 @@
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
+ ## [10.1.4](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@10.1.3...@exodus/ethereum-api@10.1.4) (2026-10-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ethereum-api:** keep no-history pending txs when the batch RPC fails ([#8992](https://github.com/ExodusMovement/assets/issues/8992)) ([4cfeb8c](https://github.com/ExodusMovement/assets/commit/4cfeb8c67c81d4e00eff5e22e4ed52da939030b5))
12
+
13
+
14
+
15
+ ## [10.1.3](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@10.1.2...@exodus/ethereum-api@10.1.3) (2026-10-17)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **ethereum-api:** parse clarity nonces as decimal in sender nonce key ([#8993](https://github.com/ExodusMovement/assets/issues/8993)) ([c3cc0e8](https://github.com/ExodusMovement/assets/commit/c3cc0e8898bd63c3838f217388d08c5b295696aa))
21
+
22
+
23
+
6
24
  ## [10.1.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@10.1.1...@exodus/ethereum-api@10.1.2) (2026-10-17)
7
25
 
8
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "10.1.2",
3
+ "version": "10.1.4",
4
4
  "description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Ethereum and EVM-based blockchains",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -65,5 +65,5 @@
65
65
  "type": "git",
66
66
  "url": "git+https://github.com/ExodusMovement/assets.git"
67
67
  },
68
- "gitHead": "2efa1324fb981a5c05f2591f1cc6d8b5776ed1fe"
68
+ "gitHead": "c2422cdc47034c6b0e497e95546a8b18885a792b"
69
69
  }
@@ -241,6 +241,27 @@ export const getStakingHistoryBalance = ({ asset, txLog }) => {
241
241
  return stakingHistoryBalance
242
242
  }
243
243
 
244
+ /**
245
+ * Pending stakes debited through `tx.data.txAmount` instead of `tx.coinAmount`.
246
+ * The staking processor zeroes `coinAmount` on stake rows, pending ones included,
247
+ * so neither `getUnconfirmedSentBalance` nor the tx-log mutations see the debit.
248
+ * `getStakingHistoryBalance` only picks it up once the tx confirms.
249
+ */
250
+ const getPendingStakingSent = ({ asset, txLog }) => {
251
+ let pendingStakingSent = asset.currency.ZERO
252
+ for (const tx of txLog) {
253
+ if (tx.failed || !tx.pending || !tx.coinAmount.isZero) continue
254
+
255
+ const { txAmount } = tx.data
256
+ if (!txAmount) continue
257
+
258
+ const amount = asset.currency.defaultUnit(txAmount)
259
+ if (amount.isNegative) pendingStakingSent = pendingStakingSent.add(amount.abs())
260
+ }
261
+
262
+ return pendingStakingSent
263
+ }
264
+
244
265
  const getSpendable = ({ asset, balance, txLog, unconfirmedReceived }) => {
245
266
  const stakingHistoryBalance = getStakingHistoryBalance({ asset, txLog })
246
267
  return balance.add(stakingHistoryBalance).sub(unconfirmedReceived)
@@ -258,7 +279,8 @@ export const getBalancesFactory = ({ monitorType, useAbsoluteBalance, rpcBalance
258
279
  assert(monitorType, 'monitorType is required')
259
280
  return ({ asset, txLog, accountState }) => {
260
281
  const unconfirmedReceived = getUnconfirmedReceivedBalance({ asset, txLog })
261
- const unconfirmedSent = getUnconfirmedSentBalance({ asset, txLog })
282
+ const pendingStakingSent = getPendingStakingSent({ asset, txLog })
283
+ const unconfirmedSent = getUnconfirmedSentBalance({ asset, txLog }).add(pendingStakingSent)
262
284
 
263
285
  const staked = getStaked({ asset, accountState })
264
286
  const staking = getStaking({ asset, accountState })
@@ -299,7 +321,7 @@ export const getBalancesFactory = ({ monitorType, useAbsoluteBalance, rpcBalance
299
321
  balance: getBalanceFromTxLog({ txLog, asset }),
300
322
  txLog,
301
323
  unconfirmedReceived,
302
- })
324
+ }).sub(pendingStakingSent)
303
325
  }
304
326
  }
305
327
 
@@ -1,6 +1,7 @@
1
1
  import NumberUnit from '@exodus/currency'
2
2
  import { getMethodIdFromEthTx, isPendingTxInLog, parseUnsignedTx } from '@exodus/ethereum-lib'
3
3
  import assetsList, { asset as ethereum } from '@exodus/ethereum-meta'
4
+ import { bufferToHex } from '@exodus/ethereumjs/util'
4
5
  import { Tx } from '@exodus/models'
5
6
  import assert from 'minimalistic-assert'
6
7
 
@@ -170,9 +171,10 @@ export async function maticDelegateOptimisticSideEffectTxLogs({
170
171
  feeAmount,
171
172
  feeCoinName: asset.feeAsset.name,
172
173
  selfSend: false,
173
- to: MaticStakingApi.EVERSTAKE_VALIDATOR_CONTRACT_ADDR,
174
+ to: STAKING_MANAGER_CONTRACT,
174
175
  txId: delegateTxId,
175
176
  data: {
177
+ data: bufferToHex(transactionData),
176
178
  gasLimit: estimatedDelegateGasLimit,
177
179
  nonce,
178
180
  tipGasPrice: tipGasPrice ? tipGasPrice.toBaseString() : undefined,
@@ -105,12 +105,12 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
105
105
  }
106
106
 
107
107
  try {
108
- const responses = await this.server.sendBatchRequest(batch)
108
+ const responses = await this.server.sendBatchRequest(batch, { tolerant: true })
109
109
  const txIds = transactions.map(({ tx }) => tx.txId)
110
110
  return zipObject(txIds, responses)
111
111
  } catch (error) {
112
- console.warn({ error })
113
- return []
112
+ this.logger.warn('Batch RPC request failed, skipping pending tx checks', error)
113
+ return null
114
114
  }
115
115
  }
116
116
 
@@ -119,12 +119,15 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
119
119
  const txsToRemove = []
120
120
  const now = SynchronizedTime.now()
121
121
 
122
- if (isEmpty(pendingTransactions)) return { txsToUpdate, txsToRemove }
122
+ if (isEmpty(pendingTransactions) || !pendingTxsFromNode) return { txsToUpdate, txsToRemove }
123
123
 
124
124
  for (const { tx, assetName } of pendingTransactions) {
125
125
  const txFromNode = pendingTxsFromNode[tx.txId]
126
126
  const isConfirmed = Boolean(txFromNode?.blockHash)
127
- if (now - tx.date.getTime() > UNCONFIRMED_TX_LIMIT && !txFromNode) {
127
+ // Only `null` is the node's "unknown tx" verdict. `undefined` is a per-hash RPC error entry
128
+ // (no verdict), and without an indexer nothing would restore a tx removed on it.
129
+ const isUnknownToNode = txFromNode === null && now - tx.date.getTime() > UNCONFIRMED_TX_LIMIT
130
+ if (isUnknownToNode) {
128
131
  txsToRemove.push({
129
132
  tx,
130
133
  assetSource: { asset: assetName, walletAccount },
@@ -18,8 +18,8 @@ export default function checkPendingTransactions({
18
18
  delete recentPendingTransactions[txId]
19
19
 
20
20
  // check if this TX replaces another pending TX
21
- const replacedTx =
22
- pendingTransactionsGroupedByAddressAndNonce[getSenderNonceKey(tx, ourWalletAddress)]
21
+ const senderNonceKey = getSenderNonceKey(tx, ourWalletAddress)
22
+ const replacedTx = senderNonceKey && pendingTransactionsGroupedByAddressAndNonce[senderNonceKey]
23
23
  if (replacedTx && tx.hash !== replacedTx.tx.txId) {
24
24
  // if a pending TX with lower fees comes from the server, don't add it
25
25
  if (
@@ -1,3 +1,11 @@
1
+ const HEX_PREFIX = '0x'
2
+
3
+ // Clarity sends nonces as decimal strings; Magnifier sends 0x-prefixed hex quantities.
4
+ const parseServerTxNonce = (nonce) =>
5
+ typeof nonce === 'string' && nonce.startsWith(HEX_PREFIX)
6
+ ? parseInt(nonce, 16)
7
+ : parseInt(nonce, 10)
8
+
1
9
  export default function getSenderNonceKey(tx, ourWalletAddress) {
2
10
  if (Array.isArray(tx.from)) {
3
11
  // Tx class. we don't define the 'from' address if our wallet was the sender.
@@ -5,7 +13,8 @@ export default function getSenderNonceKey(tx, ourWalletAddress) {
5
13
  return `${from}:${tx.data.nonce}`
6
14
  }
7
15
 
8
- // ethereum tx json object from magnifier
9
- const txnonce = parseInt(tx.nonce, 16)
10
- return `${tx.from}:${txnonce}`
16
+ const nonce = parseServerTxNonce(tx.nonce)
17
+ if (!Number.isSafeInteger(nonce)) return null
18
+
19
+ return `${tx.from}:${nonce}`
11
20
  }