@exodus/ethereum-api 9.0.0 → 9.0.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,33 @@
|
|
|
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
|
+
## [9.0.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@9.0.1...@exodus/ethereum-api@9.0.2) (2026-10-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ethereum-api:** keep balances on truncated refresh when history fails ([#8739](https://github.com/ExodusMovement/assets/issues/8739)) ([2c8bdb5](https://github.com/ExodusMovement/assets/commit/2c8bdb590ae0f91a93eae377c965dda9bda90a74))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [9.0.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@9.0.0...@exodus/ethereum-api@9.0.1) (2026-10-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### ⚠ BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* **ethereum-lib:** drop magnifier monitor type fallback (#8740)
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **ethereum-api:** drop stale carried token balances on confirmed tx ([#8792](https://github.com/ExodusMovement/assets/issues/8792)) ([34f8dc6](https://github.com/ExodusMovement/assets/commit/34f8dc69f6ee366801c6ee6c60725ce83609b462))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Code Refactoring
|
|
28
|
+
|
|
29
|
+
* **ethereum-lib:** drop magnifier monitor type fallback ([#8740](https://github.com/ExodusMovement/assets/issues/8740)) ([c1ae79d](https://github.com/ExodusMovement/assets/commit/c1ae79dd6cad95294589a1cbdfd0a9b7ec52e7cf))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [9.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.79.1...@exodus/ethereum-api@9.0.0) (2026-09-28)
|
|
7
34
|
|
|
8
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
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",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"type": "git",
|
|
67
67
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0a4fcc493bf35328b970107cfb62f33633bd5bdd"
|
|
70
70
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -69,7 +69,7 @@ export const createAssetFactory = ({
|
|
|
69
69
|
isTestnet = false,
|
|
70
70
|
l1GasOracleAddress, // l1 extra fee for base and optostakingConfiguration = {},
|
|
71
71
|
monitorInterval: defaultMonitorInterval,
|
|
72
|
-
monitorType: defaultMonitorType
|
|
72
|
+
monitorType: defaultMonitorType,
|
|
73
73
|
multicall3Address: defaultMulticall3Address,
|
|
74
74
|
nfts: defaultNfts = false,
|
|
75
75
|
serverUrl: defaultServerUrl,
|
|
@@ -91,6 +91,7 @@ export const createAssetFactory = ({
|
|
|
91
91
|
assert(assetsList, 'assetsList is required')
|
|
92
92
|
assert(providedFeeData || feeDataConfig, 'feeData or feeDataConfig is required')
|
|
93
93
|
assert(defaultServerUrl, 'serverUrl is required')
|
|
94
|
+
assert(defaultMonitorType, 'monitorType is required')
|
|
94
95
|
assert(confirmationsNumber, 'confirmationsNumber is required')
|
|
95
96
|
|
|
96
97
|
const base = assetsList.find((asset) => asset.name === asset.baseAssetName)
|
|
@@ -243,6 +243,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
243
243
|
let hasNewTxs = false
|
|
244
244
|
let historyResponse
|
|
245
245
|
let historyError
|
|
246
|
+
let processedLogItemsByAsset
|
|
246
247
|
|
|
247
248
|
try {
|
|
248
249
|
const response = await this.getHistoryFromServer({ walletAccount, derivedData, refresh })
|
|
@@ -292,6 +293,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
historyResponse = response
|
|
296
|
+
processedLogItemsByAsset = logItemsByAsset
|
|
295
297
|
} catch (error) {
|
|
296
298
|
historyError = error
|
|
297
299
|
}
|
|
@@ -302,6 +304,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
302
304
|
tokens,
|
|
303
305
|
tokensByAddress,
|
|
304
306
|
historyResponse,
|
|
307
|
+
logItemsByAsset: processedLogItemsByAsset,
|
|
305
308
|
refresh,
|
|
306
309
|
})),
|
|
307
310
|
...(historyResponse && { clarityCursor: historyResponse.cursor }),
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { ClarityMonitor } from './clarity-monitor.js'
|
|
2
2
|
import { extractBalanceFromClarityAccountInfo } from './monitor-utils/index.js'
|
|
3
3
|
|
|
4
|
+
const omitTokensWithConfirmedBalanceChange = ({ tokenBalances, logItemsByAsset }) => {
|
|
5
|
+
if (!tokenBalances || !logItemsByAsset) return tokenBalances
|
|
6
|
+
const result = { ...tokenBalances }
|
|
7
|
+
for (const [assetName, txs] of Object.entries(logItemsByAsset)) {
|
|
8
|
+
if (txs.some((tx) => tx.confirmations > 0 && tx.data?.balanceChange)) delete result[assetName]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return result
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Clarity v2 + HTTP `getAllTransactions` with `truncated: true` so the backend can attach
|
|
6
16
|
* `accountInfo` (pre-cursor balance/nonce/token snapshots). Merges that data in
|
|
@@ -16,7 +26,14 @@ export class ClarityTruncatedHistoryMonitor extends ClarityMonitor {
|
|
|
16
26
|
return { accountState: Object.create(null) }
|
|
17
27
|
}
|
|
18
28
|
|
|
19
|
-
async resolveAccountState({
|
|
29
|
+
async resolveAccountState({
|
|
30
|
+
derivedData,
|
|
31
|
+
tokens,
|
|
32
|
+
tokensByAddress,
|
|
33
|
+
historyResponse,
|
|
34
|
+
logItemsByAsset,
|
|
35
|
+
refresh,
|
|
36
|
+
}) {
|
|
20
37
|
let currentAccountState = derivedData.currentAccountState
|
|
21
38
|
let resetBalances
|
|
22
39
|
|
|
@@ -32,7 +49,7 @@ export class ClarityTruncatedHistoryMonitor extends ClarityMonitor {
|
|
|
32
49
|
// truncated), we must ensure older checkpoints cannot
|
|
33
50
|
// be inadvertently relied upon.
|
|
34
51
|
//
|
|
35
|
-
if (refresh) {
|
|
52
|
+
if (refresh && historyResponse) {
|
|
36
53
|
const defaultAccountState = this.asset.api.createAccountState().create()
|
|
37
54
|
resetBalances = {
|
|
38
55
|
balance: defaultAccountState.balance,
|
|
@@ -47,17 +64,21 @@ export class ClarityTruncatedHistoryMonitor extends ClarityMonitor {
|
|
|
47
64
|
tokensByAddress,
|
|
48
65
|
})
|
|
49
66
|
|
|
67
|
+
const prevTokenBalances = omitTokensWithConfirmedBalanceChange({
|
|
68
|
+
tokenBalances: currentAccountState?.tokenBalances,
|
|
69
|
+
logItemsByAsset,
|
|
70
|
+
})
|
|
71
|
+
|
|
50
72
|
const { accountState } = await this.getStateUpdate({
|
|
51
73
|
derivedData,
|
|
52
74
|
tokens,
|
|
53
75
|
currentTokenBalances: {
|
|
54
|
-
...
|
|
76
|
+
...prevTokenBalances,
|
|
55
77
|
...balanceFromAccountInfo.tokenBalances,
|
|
56
78
|
},
|
|
57
79
|
})
|
|
58
80
|
|
|
59
81
|
// Clarity `accountInfo`, then RPC `accountState` (empty here) overlays.
|
|
60
|
-
const prevTokenBalances = currentAccountState?.tokenBalances
|
|
61
82
|
const prevTruncatedAccountState = currentAccountState?.truncatedAccountState
|
|
62
83
|
const newData = {
|
|
63
84
|
...resetBalances,
|