@exodus/ethereum-api 10.1.2 → 10.1.3
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,15 @@
|
|
|
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.3](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@10.1.2...@exodus/ethereum-api@10.1.3) (2026-10-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **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))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [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
16
|
|
|
8
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.3",
|
|
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": "
|
|
68
|
+
"gitHead": "52edb548f19b12c0dab06e436330b9f1363e9055"
|
|
69
69
|
}
|
package/src/get-balances.js
CHANGED
|
@@ -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
|
|
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:
|
|
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,
|
|
@@ -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
|
|
22
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
const nonce = parseServerTxNonce(tx.nonce)
|
|
17
|
+
if (!Number.isSafeInteger(nonce)) return null
|
|
18
|
+
|
|
19
|
+
return `${tx.from}:${nonce}`
|
|
11
20
|
}
|