@exodus/ethereum-api 8.77.4 → 8.78.0
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 +15 -0
- package/package.json +2 -2
- package/src/create-asset-utils.js +10 -6
- package/src/create-asset.js +11 -3
- package/src/eip7702-whitelist.js +62 -0
- package/src/exodus-eth-server/api-coin-nodes.js +2 -116
- package/src/exodus-eth-server/clarity.js +2 -181
- package/src/exodus-eth-server/{eth-like-server-base.js → eth-like-server.js} +206 -1
- package/src/multicall3/index.js +1 -1
- package/src/tx-log/clarity-monitor.js +10 -2
- package/src/tx-log/clarity-truncated-history-monitor.js +1 -1
- package/src/tx-log/ethereum-no-history-monitor.js +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.78.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.77.1...@exodus/ethereum-api@8.78.0) (2026-08-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* source eip7702 delegation whitelist from remote config ([#8356](https://github.com/ExodusMovement/assets/issues/8356)) ([1a0966b](https://github.com/ExodusMovement/assets/commit/1a0966b08befb6e9310993f323c21d003dea2754))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ethereum-api:** detect legacy delegate transactions ([#8357](https://github.com/ExodusMovement/assets/issues/8357)) ([070e529](https://github.com/ExodusMovement/assets/commit/070e5295f21f12695e97e721ff8c0601c553e447))
|
|
17
|
+
* **simulation:** route recipient changes to dedicated field, guard asset-less entries ([#8370](https://github.com/ExodusMovement/assets/issues/8370)) ([c0a082b](https://github.com/ExodusMovement/assets/commit/c0a082b6c80710408337ff9285a19fb657c656be))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
## [8.77.4](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.77.1...@exodus/ethereum-api@8.77.4) (2026-07-14)
|
|
7
22
|
|
|
8
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.78.0",
|
|
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",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"type": "git",
|
|
70
70
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e878130c84c596ee86050984806b0da491e14910"
|
|
73
73
|
}
|
|
@@ -275,7 +275,7 @@ export const createHistoryMonitorFactory = ({
|
|
|
275
275
|
stakingAssetNames,
|
|
276
276
|
rpcBalanceAssetNames,
|
|
277
277
|
wsGatewayUri,
|
|
278
|
-
|
|
278
|
+
eip7702Whitelist,
|
|
279
279
|
getBlackListStatus,
|
|
280
280
|
}) => {
|
|
281
281
|
assert(assetName, 'expected assetName')
|
|
@@ -297,7 +297,7 @@ export const createHistoryMonitorFactory = ({
|
|
|
297
297
|
interval: ms(monitorInterval || '5m'),
|
|
298
298
|
server,
|
|
299
299
|
rpcBalanceAssetNames,
|
|
300
|
-
|
|
300
|
+
eip7702Whitelist,
|
|
301
301
|
getBlackListStatus,
|
|
302
302
|
...args,
|
|
303
303
|
})
|
|
@@ -307,7 +307,7 @@ export const createHistoryMonitorFactory = ({
|
|
|
307
307
|
assetClientInterface,
|
|
308
308
|
interval: ms(monitorInterval || '5m'),
|
|
309
309
|
server,
|
|
310
|
-
|
|
310
|
+
eip7702Whitelist,
|
|
311
311
|
getBlackListStatus,
|
|
312
312
|
...args,
|
|
313
313
|
})
|
|
@@ -317,7 +317,7 @@ export const createHistoryMonitorFactory = ({
|
|
|
317
317
|
assetClientInterface,
|
|
318
318
|
interval: ms(monitorInterval || '15s'),
|
|
319
319
|
server,
|
|
320
|
-
|
|
320
|
+
eip7702Whitelist,
|
|
321
321
|
getBlackListStatus,
|
|
322
322
|
...args,
|
|
323
323
|
})
|
|
@@ -349,7 +349,7 @@ export const createHistoryMonitorFactory = ({
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
export const createSecurityChecks = ({
|
|
352
|
+
export const createSecurityChecks = ({ eip7702Whitelist }) => {
|
|
353
353
|
return ({ accountState }) => {
|
|
354
354
|
// Always return global scam findings before lower-severity checks because
|
|
355
355
|
// global checks can block the app at startup.
|
|
@@ -362,7 +362,11 @@ export const createSecurityChecks = ({ eip7702Supported }) => {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
const delegation = accountState?.eip7702Delegation
|
|
365
|
-
if (
|
|
365
|
+
if (
|
|
366
|
+
eip7702Whitelist.isSupported() &&
|
|
367
|
+
Boolean(delegation?.isDelegated) &&
|
|
368
|
+
!delegation?.isWhitelisted
|
|
369
|
+
) {
|
|
366
370
|
return {
|
|
367
371
|
isSecure: false,
|
|
368
372
|
type: 'LOST_PERMISSIONS',
|
package/src/create-asset.js
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
} from './create-asset-utils.js'
|
|
36
36
|
import { createTokenFactory } from './create-token-factory.js'
|
|
37
37
|
import { createCustomFeesApi } from './custom-fees.js'
|
|
38
|
+
import { createEip7702Whitelist } from './eip7702-whitelist.js'
|
|
38
39
|
import { getEIP7702Delegation, getIsNftContract } from './eth-like-util.js'
|
|
39
40
|
import { createEvmServer } from './exodus-eth-server/index.js'
|
|
40
41
|
import { createFeeData } from './fee-data/index.js'
|
|
@@ -270,6 +271,11 @@ export const createAssetFactory = ({
|
|
|
270
271
|
|
|
271
272
|
const getBlackListStatus = createGetBlackListStatus({ server, address, blacklistChecks })
|
|
272
273
|
|
|
274
|
+
// eip7702Supported is the chain-level feature flag ([] when supported).
|
|
275
|
+
// The whitelist itself is populated from remote config through the
|
|
276
|
+
// history monitor's setServer.
|
|
277
|
+
const eip7702Whitelist = createEip7702Whitelist(eip7702Supported)
|
|
278
|
+
|
|
273
279
|
const accountStateClass =
|
|
274
280
|
CustomAccountState || createEthereumLikeAccountState({ asset: base, assets, extraData })
|
|
275
281
|
|
|
@@ -282,7 +288,7 @@ export const createAssetFactory = ({
|
|
|
282
288
|
stakingAssetNames,
|
|
283
289
|
rpcBalanceAssetNames,
|
|
284
290
|
wsGatewayUri,
|
|
285
|
-
|
|
291
|
+
eip7702Whitelist,
|
|
286
292
|
getBlackListStatus,
|
|
287
293
|
})
|
|
288
294
|
|
|
@@ -318,7 +324,7 @@ export const createAssetFactory = ({
|
|
|
318
324
|
|
|
319
325
|
const { getNonce } = getNonceFactory({ assetClientInterface, useAbsoluteBalanceAndNonce })
|
|
320
326
|
|
|
321
|
-
const securityChecks = createSecurityChecks({
|
|
327
|
+
const securityChecks = createSecurityChecks({ eip7702Whitelist })
|
|
322
328
|
|
|
323
329
|
const web3 = createWeb3API({ asset })
|
|
324
330
|
|
|
@@ -412,7 +418,9 @@ export const createAssetFactory = ({
|
|
|
412
418
|
estimateL1DataFee,
|
|
413
419
|
forceGasLimitEstimation,
|
|
414
420
|
eip7623Supported,
|
|
415
|
-
|
|
421
|
+
// Stable array reference kept up to date with remote config by the
|
|
422
|
+
// history monitor's setServer.
|
|
423
|
+
eip7702Supported: eip7702Whitelist.get(),
|
|
416
424
|
getEIP7702Delegation: (addr) => getEIP7702Delegation({ address: addr, server }),
|
|
417
425
|
getNonce,
|
|
418
426
|
server,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const ADDRESS_REGEX = /^0x[\dA-Fa-f]{40}$/
|
|
2
|
+
|
|
3
|
+
const isValidWhitelistEntry = (entry) =>
|
|
4
|
+
typeof entry?.address === 'string' &&
|
|
5
|
+
ADDRESS_REGEX.test(entry.address) &&
|
|
6
|
+
typeof entry.name === 'string' &&
|
|
7
|
+
entry.name.length > 0
|
|
8
|
+
|
|
9
|
+
export const isValidEip7702Whitelist = (whitelist) =>
|
|
10
|
+
Array.isArray(whitelist) && whitelist.every((entry) => isValidWhitelistEntry(entry))
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Mutable holder for the EIP-7702 delegation whitelist, shared between the
|
|
14
|
+
* history monitors, security checks and the asset itself. The whitelist data
|
|
15
|
+
* comes exclusively from remote config; plugins pass `eip7702Supported: []`
|
|
16
|
+
* as the chain-level feature flag, and the list stays empty until remote
|
|
17
|
+
* config delivers it. Only chains created with an array accept updates.
|
|
18
|
+
*
|
|
19
|
+
* @param {Array<{address: string, name: string}>} [defaultWhitelist] - The
|
|
20
|
+
* in-code value, `[]` for supported chains. A non-array means the chain
|
|
21
|
+
* does not support EIP-7702.
|
|
22
|
+
*/
|
|
23
|
+
export const createEip7702Whitelist = (defaultWhitelist) => {
|
|
24
|
+
const supported = Array.isArray(defaultWhitelist)
|
|
25
|
+
// The array identity is stable across updates (mutated in place), so
|
|
26
|
+
// consumers holding a reference (e.g. asset.eip7702Supported, which gets
|
|
27
|
+
// spread-copied into the wallet's asset registry) observe updates too.
|
|
28
|
+
const current = supported
|
|
29
|
+
? defaultWhitelist.map(({ address, name }) => ({ address, name }))
|
|
30
|
+
: undefined
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
isSupported: () => supported,
|
|
34
|
+
get: () => current,
|
|
35
|
+
/**
|
|
36
|
+
* Replaces the whitelist with the remote-config value. Returns whether the
|
|
37
|
+
* update was applied. Invalid payloads and updates on chains without
|
|
38
|
+
* EIP-7702 support are ignored, keeping the last known good whitelist.
|
|
39
|
+
*/
|
|
40
|
+
update: (remoteWhitelist) => {
|
|
41
|
+
if (!supported) return false
|
|
42
|
+
if (!isValidEip7702Whitelist(remoteWhitelist)) return false
|
|
43
|
+
|
|
44
|
+
current.length = 0
|
|
45
|
+
current.push(...remoteWhitelist.map(({ address, name }) => ({ address, name })))
|
|
46
|
+
return true
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Applies the `eip7702Whitelist` field of a per-asset remote config payload,
|
|
53
|
+
* as delivered to the monitors through `monitor.setServer(remoteConfig)`.
|
|
54
|
+
*/
|
|
55
|
+
export const applyRemoteConfigEip7702Whitelist = ({ eip7702Whitelist, remoteConfig, logger }) => {
|
|
56
|
+
const remoteWhitelist = remoteConfig?.eip7702Whitelist
|
|
57
|
+
if (remoteWhitelist === undefined) return
|
|
58
|
+
|
|
59
|
+
if (!eip7702Whitelist.update(remoteWhitelist)) {
|
|
60
|
+
logger?.warn('ignoring invalid eip7702Whitelist from remote config')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { safeString } from '@exodus/safe-string'
|
|
2
2
|
import lodash from 'lodash'
|
|
3
3
|
|
|
4
|
-
import { fromHexToString } from '../number-utils.js'
|
|
5
4
|
import { errorMessageToSafeHint } from './errors.js'
|
|
6
|
-
import
|
|
5
|
+
import { EthLikeServer } from './eth-like-server.js'
|
|
7
6
|
import { fetchJsonRetry } from './fetch-json.js'
|
|
8
|
-
import { getFallbackGasPriceEstimation } from './utils.js'
|
|
9
7
|
|
|
10
8
|
const { isEmpty } = lodash
|
|
11
9
|
|
|
12
|
-
export default class ApiCoinNodesServer extends
|
|
10
|
+
export default class ApiCoinNodesServer extends EthLikeServer {
|
|
13
11
|
constructor({ baseAssetName, uri }) {
|
|
14
12
|
super()
|
|
15
13
|
this.baseAssetName = baseAssetName
|
|
@@ -59,118 +57,6 @@ export default class ApiCoinNodesServer extends EthLikeServerBase {
|
|
|
59
57
|
return result
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
async isContract(address) {
|
|
63
|
-
const code = await this.getCode(address)
|
|
64
|
-
return code.length > 2
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async balanceOf(address, tokenAddress, tag = 'latest') {
|
|
68
|
-
const request = this.balanceOfRequest(address, tokenAddress, tag)
|
|
69
|
-
const result = await this.sendRequest(request)
|
|
70
|
-
const balance = fromHexToString(result)
|
|
71
|
-
return {
|
|
72
|
-
confirmed: {
|
|
73
|
-
[tokenAddress]: balance,
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async getBalance(...params) {
|
|
79
|
-
const request = this.getBalanceRequest(...params)
|
|
80
|
-
return this.sendRequest(request)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async getBalanceProxied(...params) {
|
|
84
|
-
return this.getBalance(...params)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async gasPrice(...params) {
|
|
88
|
-
const request = this.gasPriceRequest(...params)
|
|
89
|
-
return this.sendRequest(request)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async getGasPriceEstimation() {
|
|
93
|
-
return getFallbackGasPriceEstimation({ server: this })
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// for fee monitor
|
|
97
|
-
getGasPrice = this.gasPrice
|
|
98
|
-
|
|
99
|
-
async getLatestBlock() {
|
|
100
|
-
return this.sendRequest(this.getBlockByNumberRequest('latest', false))
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async getBaseFeePerGas() {
|
|
104
|
-
const response = await this.getLatestBlock()
|
|
105
|
-
if (response.baseFeePerGas) {
|
|
106
|
-
return fromHexToString(response.baseFeePerGas)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async estimateGas(...params) {
|
|
111
|
-
const request = this.estimateGasRequest(...params)
|
|
112
|
-
return this.sendRequest(request)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async sendRawTransaction(...params) {
|
|
116
|
-
const request = this.sendRawTransactionRequest(...params)
|
|
117
|
-
return this.sendRequest(request)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async getCode(...params) {
|
|
121
|
-
const request = this.getCodeRequest(...params)
|
|
122
|
-
return this.sendRequest(request)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async getStorageAt(...params) {
|
|
126
|
-
const request = this.getStorageAtRequest(...params)
|
|
127
|
-
return this.sendRequest(request)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
async getTransactionCount(...params) {
|
|
131
|
-
const request = this.getTransactionCountRequest(...params)
|
|
132
|
-
return this.sendRequest(request)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async getTransactionByHash(...params) {
|
|
136
|
-
const request = this.getTransactionByHashRequest(...params)
|
|
137
|
-
return this.sendRequest(request)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async getTransactionReceipt(...params) {
|
|
141
|
-
const request = this.getTransactionReceiptRequest(...params)
|
|
142
|
-
return this.sendRequest(request)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async ethCall(...params) {
|
|
146
|
-
const request = this.ethCallRequest(...params)
|
|
147
|
-
return this.sendRequest(request)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
async blockNumber(...params) {
|
|
151
|
-
const request = this.blockNumberRequest(...params)
|
|
152
|
-
return this.sendRequest(request)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async getBlockByNumber(...params) {
|
|
156
|
-
const request = this.getBlockByNumberRequest(...params)
|
|
157
|
-
return this.sendRequest(request)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
async simulateRawTransaction(...params) {
|
|
161
|
-
const request = this.simulateRawTransactionRequest(...params)
|
|
162
|
-
return this.sendRequest(request)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async contractStaticCallFrom(contract, functionName, ...params) {
|
|
166
|
-
const request = this.contractStaticCallFromRequest(contract, functionName, ...params)
|
|
167
|
-
return contract[functionName].parse(await this.sendRequest(request))
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async contractStaticCall(contract, functionName, ...params) {
|
|
171
|
-
return this.contractStaticCallFrom(contract, functionName, undefined, ...params)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
60
|
stop() {
|
|
175
61
|
// no web socket to stop!
|
|
176
62
|
}
|
|
@@ -2,14 +2,12 @@ import { safeString } from '@exodus/safe-string'
|
|
|
2
2
|
import { TraceId } from '@exodus/traceparent'
|
|
3
3
|
import io from 'socket.io-client'
|
|
4
4
|
|
|
5
|
-
import { fromHexToString } from '../number-utils.js'
|
|
6
5
|
import { errorMessageToSafeHint } from './errors.js'
|
|
7
|
-
import
|
|
8
|
-
import { getFallbackGasPriceEstimation } from './utils.js'
|
|
6
|
+
import { EthLikeServer } from './eth-like-server.js'
|
|
9
7
|
|
|
10
8
|
export const RPC_REQUEST_TIMEOUT = 'RPC_REQUEST_TIMEOUT'
|
|
11
9
|
|
|
12
|
-
export default class ClarityServer extends
|
|
10
|
+
export default class ClarityServer extends EthLikeServer {
|
|
13
11
|
constructor({ baseAssetName, uri }) {
|
|
14
12
|
super()
|
|
15
13
|
this.baseAssetName = baseAssetName
|
|
@@ -192,10 +190,6 @@ export default class ClarityServer extends EthLikeServerBase {
|
|
|
192
190
|
return fee?.gasPrice
|
|
193
191
|
}
|
|
194
192
|
|
|
195
|
-
async getGasPriceEstimation() {
|
|
196
|
-
return getFallbackGasPriceEstimation({ server: this })
|
|
197
|
-
}
|
|
198
|
-
|
|
199
193
|
async sendRpcRequest(rpcRequest) {
|
|
200
194
|
const rpcSocket = this.connectRpc()
|
|
201
195
|
return new Promise((resolve, reject) => {
|
|
@@ -226,179 +220,6 @@ export default class ClarityServer extends EthLikeServerBase {
|
|
|
226
220
|
return this.handleJsonRPCResponse(response)
|
|
227
221
|
}
|
|
228
222
|
|
|
229
|
-
// Transport: Via getCode → sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
230
|
-
async isContract(address) {
|
|
231
|
-
const code = await this.getCode(address)
|
|
232
|
-
return code.length > 2
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
236
|
-
async proxyToCoinNode(params) {
|
|
237
|
-
const request = this.buildRequest(params)
|
|
238
|
-
return this.sendRequest(request)
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
242
|
-
async balanceOf(address, tokenAddress, tag = 'latest') {
|
|
243
|
-
const request = this.balanceOfRequest(address, tokenAddress, tag)
|
|
244
|
-
const result = await this.sendRequest(request)
|
|
245
|
-
const balance = fromHexToString(result)
|
|
246
|
-
return {
|
|
247
|
-
confirmed: {
|
|
248
|
-
[tokenAddress]: balance,
|
|
249
|
-
},
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
254
|
-
async getBalance(...params) {
|
|
255
|
-
const request = this.getBalanceRequest(...params) // eth_getBalance
|
|
256
|
-
return this.sendRequest(request)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// Transport: Via getBalance → sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
260
|
-
async getBalanceProxied(...params) {
|
|
261
|
-
return this.getBalance(...params) // eth_getBalance
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
265
|
-
async gasPrice(...params) {
|
|
266
|
-
const request = this.gasPriceRequest(...params)
|
|
267
|
-
return this.sendRequest(request)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// Transport: WS only in ClarityServer, HTTP only in ClarityServerV2 (overridden)
|
|
271
|
-
async estimateGas(...params) {
|
|
272
|
-
const request = this.estimateGasRequest(...params)
|
|
273
|
-
return this.sendRequest(request)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Transport: WS only in ClarityServer, HTTP only in ClarityServerV2 (overridden)
|
|
277
|
-
async sendRawTransaction(...params) {
|
|
278
|
-
const request = this.sendRawTransactionRequest(...params)
|
|
279
|
-
return this.sendRequest(request)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
283
|
-
async getCode(...params) {
|
|
284
|
-
const request = this.getCodeRequest(...params)
|
|
285
|
-
return this.sendRequest(request)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
289
|
-
async getStorageAt(...params) {
|
|
290
|
-
const request = this.getStorageAtRequest(...params)
|
|
291
|
-
return this.sendRequest(request)
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// Transport: WS only in ClarityServer, HTTP only in ClarityServerV2 (overridden)
|
|
295
|
-
async getTransactionCount(...params) {
|
|
296
|
-
const request = this.getTransactionCountRequest(...params)
|
|
297
|
-
return this.sendRequest(request)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
301
|
-
async getTransactionByHash(...params) {
|
|
302
|
-
const request = this.getTransactionByHashRequest(...params)
|
|
303
|
-
return this.sendRequest(request)
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
307
|
-
async getTransactionReceipt(...params) {
|
|
308
|
-
const request = this.getTransactionReceiptRequest(...params)
|
|
309
|
-
return this.sendRequest(request)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
313
|
-
async ethCall(...params) {
|
|
314
|
-
const request = this.ethCallRequest(...params)
|
|
315
|
-
return this.sendRequest(request)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
319
|
-
async blockNumber(...params) {
|
|
320
|
-
const request = this.blockNumberRequest(...params)
|
|
321
|
-
return this.sendRequest(request)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Transport: Via getBlockByNumber → sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
325
|
-
async getLatestBlock() {
|
|
326
|
-
return this.getBlockByNumber('latest')
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Transport: Via getLatestBlock → getBlockByNumber → sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
330
|
-
async getBaseFeePerGas() {
|
|
331
|
-
const response = await this.getLatestBlock()
|
|
332
|
-
if (response.baseFeePerGas) {
|
|
333
|
-
return fromHexToString(response.baseFeePerGas)
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
338
|
-
async getBlockByHash(...params) {
|
|
339
|
-
const request = this.getBlockByHashRequest(...params)
|
|
340
|
-
return this.sendRequest(request)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
344
|
-
async getBlockTransactionCountByNumber(...params) {
|
|
345
|
-
const request = this.getBlockTransactionCountByNumberRequest(...params)
|
|
346
|
-
return this.sendRequest(request)
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
350
|
-
async getBlockByNumber(...params) {
|
|
351
|
-
const request = this.getBlockByNumberRequest(...params)
|
|
352
|
-
return this.sendRequest(request)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
356
|
-
async simulateV1(...params) {
|
|
357
|
-
const request = this.simulateV1Request(...params)
|
|
358
|
-
return this.sendRequest(request)
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
362
|
-
async simulateRawTransaction(...params) {
|
|
363
|
-
const request = this.simulateRawTransactionRequest(...params)
|
|
364
|
-
return this.sendRequest(request)
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
368
|
-
async contractStaticCallFrom(contract, functionName, ...params) {
|
|
369
|
-
const request = this.contractStaticCallFromRequest(contract, functionName, ...params)
|
|
370
|
-
return contract[functionName].parse(await this.sendRequest(request))
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
374
|
-
async contractStaticCall(contract, functionName, ...params) {
|
|
375
|
-
return this.contractStaticCallFrom(contract, functionName, undefined, ...params)
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
379
|
-
async getCoinbase() {
|
|
380
|
-
const request = this.coinbaseRequest()
|
|
381
|
-
return this.sendRequest(request)
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
385
|
-
async getCompilers() {
|
|
386
|
-
const request = this.getCompilersRequest()
|
|
387
|
-
return this.sendRequest(request)
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
391
|
-
async getNetVersion() {
|
|
392
|
-
const request = this.getNetVersionRequest()
|
|
393
|
-
return this.sendRequest(request)
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// Transport: Via sendRequest → WS first → HTTP fallback in ClarityServerV2
|
|
397
|
-
async getLogs(...params) {
|
|
398
|
-
const request = this.getLogsRequest(...params)
|
|
399
|
-
return this.sendRequest(request)
|
|
400
|
-
}
|
|
401
|
-
|
|
402
223
|
formatTransactionsNamespace(address) {
|
|
403
224
|
return `${this.baseNamespace}/addresses/${address}/transactions`
|
|
404
225
|
}
|
|
@@ -3,7 +3,10 @@ import SolidityContract from '@exodus/solidity-contract'
|
|
|
3
3
|
import EventEmitter from 'events/events.js'
|
|
4
4
|
import assert from 'minimalistic-assert'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { fromHexToString } from '../number-utils.js'
|
|
7
|
+
import { getFallbackGasPriceEstimation } from './utils.js'
|
|
8
|
+
|
|
9
|
+
export class EthLikeServerBase extends EventEmitter {
|
|
7
10
|
id = 0
|
|
8
11
|
|
|
9
12
|
buildRequest({ method, params = [] }) {
|
|
@@ -38,6 +41,7 @@ export default class EthLikeServerBase extends EventEmitter {
|
|
|
38
41
|
return this.buildRequest({ method: 'eth_sendRawTransaction', params: [hex] })
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
// @deprecated
|
|
41
45
|
coinbaseRequest() {
|
|
42
46
|
return this.buildRequest({ method: 'eth_coinbase' })
|
|
43
47
|
}
|
|
@@ -93,10 +97,24 @@ export default class EthLikeServerBase extends EventEmitter {
|
|
|
93
97
|
})
|
|
94
98
|
}
|
|
95
99
|
|
|
100
|
+
// @deprectated
|
|
96
101
|
getCompilersRequest() {
|
|
97
102
|
return this.buildRequest({ method: 'eth_getCompilers' })
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
// TODO: Expose on Clarity
|
|
106
|
+
// maxPriorityFeePerGasRequest() {
|
|
107
|
+
// return this.buildRequest({ method: 'eth_maxPriorityFeePerGas' })
|
|
108
|
+
// }
|
|
109
|
+
|
|
110
|
+
// TODO: Expose on Clarity
|
|
111
|
+
// feeHistoryRequest(blockCount, newestBlock, rewardPercentiles) {
|
|
112
|
+
// return this.buildRequest({
|
|
113
|
+
// method: 'eth_feeHistory',
|
|
114
|
+
// params: [blockCount, newestBlock, rewardPercentiles],
|
|
115
|
+
// })
|
|
116
|
+
// }
|
|
117
|
+
|
|
100
118
|
simulateV1Request(...params) {
|
|
101
119
|
return this.buildRequest({
|
|
102
120
|
method: 'eth_simulateV1',
|
|
@@ -108,6 +126,7 @@ export default class EthLikeServerBase extends EventEmitter {
|
|
|
108
126
|
return this.buildRequest({ method: 'net_version' })
|
|
109
127
|
}
|
|
110
128
|
|
|
129
|
+
// @deprecated
|
|
111
130
|
simulateRawTransactionRequest(rawTx, applyPending = true) {
|
|
112
131
|
const replaced = rawTx.replace('0x', '')
|
|
113
132
|
return this.buildRequest({
|
|
@@ -134,7 +153,11 @@ export default class EthLikeServerBase extends EventEmitter {
|
|
|
134
153
|
assert(Array.isArray(txs), 'expected array txs')
|
|
135
154
|
return this.buildRequest({ method: 'eth_sendBundle', params: [{ txs }] })
|
|
136
155
|
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const __MISSING_FUNCTION_IMPLEMENTATION__ = () => assert(false)
|
|
137
159
|
|
|
160
|
+
export class EthLikeServer extends EthLikeServerBase {
|
|
138
161
|
/**
|
|
139
162
|
* Validates a JSON-RPC batch response, returning each `result` ordered to
|
|
140
163
|
* match `batch` (correlated by `id`, since responses can arrive out of order).
|
|
@@ -169,4 +192,186 @@ export default class EthLikeServerBase extends EventEmitter {
|
|
|
169
192
|
)
|
|
170
193
|
return batch.map((request) => keyed[`${request.id}`])
|
|
171
194
|
}
|
|
195
|
+
|
|
196
|
+
async getCode(...params) {
|
|
197
|
+
const request = this.getCodeRequest(...params)
|
|
198
|
+
return this.sendRequest(request)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async estimateGas(...params) {
|
|
202
|
+
const request = this.estimateGasRequest(...params)
|
|
203
|
+
return this.sendRequest(request)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async sendRawTransaction(...params) {
|
|
207
|
+
const request = this.sendRawTransactionRequest(...params)
|
|
208
|
+
return this.sendRequest(request)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async getStorageAt(...params) {
|
|
212
|
+
const request = this.getStorageAtRequest(...params)
|
|
213
|
+
return this.sendRequest(request)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async getTransactionCount(...params) {
|
|
217
|
+
const request = this.getTransactionCountRequest(...params)
|
|
218
|
+
return this.sendRequest(request)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async getTransactionByHash(...params) {
|
|
222
|
+
const request = this.getTransactionByHashRequest(...params)
|
|
223
|
+
return this.sendRequest(request)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async getTransactionReceipt(...params) {
|
|
227
|
+
const request = this.getTransactionReceiptRequest(...params)
|
|
228
|
+
return this.sendRequest(request)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async ethCall(...params) {
|
|
232
|
+
const request = this.ethCallRequest(...params)
|
|
233
|
+
return this.sendRequest(request)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async blockNumber(...params) {
|
|
237
|
+
const request = this.blockNumberRequest(...params)
|
|
238
|
+
return this.sendRequest(request)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async getBlockByNumber(...params) {
|
|
242
|
+
const request = this.getBlockByNumberRequest(...params)
|
|
243
|
+
return this.sendRequest(request)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async isContract(address) {
|
|
247
|
+
const code = await this.getCode(address)
|
|
248
|
+
return code.length > 2
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// @deprecated
|
|
252
|
+
async simulateRawTransaction(...params) {
|
|
253
|
+
const request = this.simulateRawTransactionRequest(...params)
|
|
254
|
+
return this.sendRequest(request)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async getBaseFeePerGas() {
|
|
258
|
+
const response = await this.getLatestBlock()
|
|
259
|
+
if (response.baseFeePerGas) {
|
|
260
|
+
return fromHexToString(response.baseFeePerGas)
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async getLatestBlock() {
|
|
265
|
+
return this.getBlockByNumber('latest')
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async gasPrice(...params) {
|
|
269
|
+
const request = this.gasPriceRequest(...params)
|
|
270
|
+
return this.sendRequest(request)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// for fee monitor
|
|
274
|
+
async getGasPrice() {
|
|
275
|
+
return this.gasPrice()
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async getBalance(...params) {
|
|
279
|
+
const request = this.getBalanceRequest(...params)
|
|
280
|
+
return this.sendRequest(request)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async getBalanceProxied(...params) {
|
|
284
|
+
return this.getBalance(...params)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async getBlockByHash(...params) {
|
|
288
|
+
const request = this.getBlockByHashRequest(...params)
|
|
289
|
+
return this.sendRequest(request)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
async getBlockTransactionCountByNumber(...params) {
|
|
293
|
+
const request = this.getBlockTransactionCountByNumberRequest(...params)
|
|
294
|
+
return this.sendRequest(request)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
async getBlockTransactionCountByHash(...params) {
|
|
298
|
+
const request = this.getBlockTransactionCountByHashRequest(...params)
|
|
299
|
+
return this.sendRequest(request)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async simulateV1(...params) {
|
|
303
|
+
const request = this.simulateV1Request(...params)
|
|
304
|
+
return this.sendRequest(request)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// @deprecated
|
|
308
|
+
async getCoinbase() {
|
|
309
|
+
const request = this.coinbaseRequest()
|
|
310
|
+
return this.sendRequest(request)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// @deprecated
|
|
314
|
+
async getCompilers() {
|
|
315
|
+
const request = this.getCompilersRequest()
|
|
316
|
+
return this.sendRequest(request)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// TODO: Expose on Clarity
|
|
320
|
+
// async getMaxPriorityFeePerGas() {
|
|
321
|
+
// const request = this.maxPriorityFeePerGasRequest()
|
|
322
|
+
// return this.sendRequest(request)
|
|
323
|
+
// }
|
|
324
|
+
|
|
325
|
+
// TODO: Expose on Clarity
|
|
326
|
+
// async getFeeHistory(...params) {
|
|
327
|
+
// const request = this.feeHistoryRequest(...params)
|
|
328
|
+
// return this.sendRequest(request)
|
|
329
|
+
// }
|
|
330
|
+
|
|
331
|
+
async getNetVersion() {
|
|
332
|
+
const request = this.getNetVersionRequest()
|
|
333
|
+
return this.sendRequest(request)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async getLogs(...params) {
|
|
337
|
+
const request = this.getLogsRequest(...params)
|
|
338
|
+
return this.sendRequest(request)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
async proxyToCoinNode(params) {
|
|
342
|
+
const request = this.buildRequest(params)
|
|
343
|
+
return this.sendRequest(request)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
async getGasPriceEstimation() {
|
|
347
|
+
return getFallbackGasPriceEstimation({ server: this })
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
async balanceOf(address, tokenAddress, tag = 'latest') {
|
|
351
|
+
const request = this.balanceOfRequest(address, tokenAddress, tag)
|
|
352
|
+
const result = await this.sendRequest(request)
|
|
353
|
+
const balance = fromHexToString(result)
|
|
354
|
+
return {
|
|
355
|
+
confirmed: {
|
|
356
|
+
[tokenAddress]: balance,
|
|
357
|
+
},
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async contractStaticCallFrom(contract, functionName, ...params) {
|
|
362
|
+
const request = this.contractStaticCallFromRequest(contract, functionName, ...params)
|
|
363
|
+
return contract[functionName].parse(await this.sendRequest(request))
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
async contractStaticCall(contract, functionName, ...params) {
|
|
367
|
+
return this.contractStaticCallFrom(contract, functionName, undefined, ...params)
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
sendRequest() {
|
|
371
|
+
return __MISSING_FUNCTION_IMPLEMENTATION__()
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
sendBatchRequest() {
|
|
375
|
+
return __MISSING_FUNCTION_IMPLEMENTATION__()
|
|
376
|
+
}
|
|
172
377
|
}
|
package/src/multicall3/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { bufferToHex } from '@exodus/ethereumjs/util'
|
|
|
4
4
|
import SolidityContract from '@exodus/solidity-contract'
|
|
5
5
|
import assert from 'minimalistic-assert'
|
|
6
6
|
|
|
7
|
-
import EthLikeServerBase from '../exodus-eth-server/eth-like-server
|
|
7
|
+
import { EthLikeServerBase } from '../exodus-eth-server/eth-like-server.js'
|
|
8
8
|
import { BLOCK_TAG_LATEST } from '../tx-send/nonce-utils.js'
|
|
9
9
|
|
|
10
10
|
const assertValidMulticall3BlockTag = (blockTag) =>
|
|
@@ -3,6 +3,7 @@ import { getAssetAddresses } from '@exodus/ethereum-lib'
|
|
|
3
3
|
import lodash from 'lodash'
|
|
4
4
|
import assert from 'minimalistic-assert'
|
|
5
5
|
|
|
6
|
+
import { applyRemoteConfigEip7702Whitelist, createEip7702Whitelist } from '../eip7702-whitelist.js'
|
|
6
7
|
import { executeEthLikeFeeMonitorUpdate } from '../fee-utils.js'
|
|
7
8
|
import {
|
|
8
9
|
filterEffects,
|
|
@@ -29,6 +30,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
29
30
|
config,
|
|
30
31
|
rpcBalanceAssetNames,
|
|
31
32
|
eip7702Supported,
|
|
33
|
+
eip7702Whitelist,
|
|
32
34
|
getBlackListStatus,
|
|
33
35
|
...args
|
|
34
36
|
}) {
|
|
@@ -36,7 +38,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
36
38
|
this.config = { GAS_PRICE_FROM_WEBSOCKET: true, ...config }
|
|
37
39
|
this.server = server
|
|
38
40
|
this.rpcBalanceAssetNames = rpcBalanceAssetNames
|
|
39
|
-
this.
|
|
41
|
+
this.eip7702Whitelist = eip7702Whitelist ?? createEip7702Whitelist(eip7702Supported)
|
|
40
42
|
this.getBlackListStatus = getBlackListStatus
|
|
41
43
|
this.getAllLogItemsByAsset = getAllLogItemsByAsset
|
|
42
44
|
this.deriveDataNeededForTick = getDeriveDataNeededForTick(this.aci)
|
|
@@ -48,6 +50,12 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
setServer(config) {
|
|
53
|
+
applyRemoteConfigEip7702Whitelist({
|
|
54
|
+
eip7702Whitelist: this.eip7702Whitelist,
|
|
55
|
+
remoteConfig: config,
|
|
56
|
+
logger: this.logger,
|
|
57
|
+
})
|
|
58
|
+
|
|
51
59
|
const uri = config?.server || this.server.defaultUri
|
|
52
60
|
|
|
53
61
|
if (uri === this.server.uri) {
|
|
@@ -294,7 +302,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
294
302
|
const eip7702Delegation = await getCurrentEIP7702Delegation({
|
|
295
303
|
server: this.server,
|
|
296
304
|
address: derivedData.ourWalletAddress,
|
|
297
|
-
eip7702Supported: this.
|
|
305
|
+
eip7702Supported: this.eip7702Whitelist.get(),
|
|
298
306
|
currentDelegation: derivedData.currentAccountState?.eip7702Delegation,
|
|
299
307
|
logger: this.logger,
|
|
300
308
|
})
|
|
@@ -32,7 +32,7 @@ export class ClarityTruncatedHistoryMonitor extends ClarityMonitor {
|
|
|
32
32
|
const eip7702Delegation = await getCurrentEIP7702Delegation({
|
|
33
33
|
server: this.server,
|
|
34
34
|
address: derivedData.ourWalletAddress,
|
|
35
|
-
eip7702Supported: this.
|
|
35
|
+
eip7702Supported: this.eip7702Whitelist.get(),
|
|
36
36
|
currentDelegation: derivedData.currentAccountState?.eip7702Delegation,
|
|
37
37
|
logger: this.logger,
|
|
38
38
|
})
|
|
@@ -3,6 +3,7 @@ import { SynchronizedTime } from '@exodus/basic-utils'
|
|
|
3
3
|
import { Tx } from '@exodus/models'
|
|
4
4
|
import lodash from 'lodash'
|
|
5
5
|
|
|
6
|
+
import { applyRemoteConfigEip7702Whitelist, createEip7702Whitelist } from '../eip7702-whitelist.js'
|
|
6
7
|
import { getBatchedRpcBalances } from './monitor-utils/get-batched-rpc-balances.js'
|
|
7
8
|
import { UNCONFIRMED_TX_LIMIT } from './monitor-utils/get-derive-transactions-to-check.js'
|
|
8
9
|
import {
|
|
@@ -18,11 +19,11 @@ const { isEmpty, unionBy, zipObject } = lodash
|
|
|
18
19
|
// The base ethereum monitor no history class handles listening for assets with no history
|
|
19
20
|
|
|
20
21
|
export class EthereumNoHistoryMonitor extends BaseMonitor {
|
|
21
|
-
constructor({ server, config, eip7702Supported, getBlackListStatus, ...args }) {
|
|
22
|
+
constructor({ server, config, eip7702Supported, eip7702Whitelist, getBlackListStatus, ...args }) {
|
|
22
23
|
super(args)
|
|
23
24
|
this.server = server
|
|
24
25
|
this.config = { ...config }
|
|
25
|
-
this.
|
|
26
|
+
this.eip7702Whitelist = eip7702Whitelist ?? createEip7702Whitelist(eip7702Supported)
|
|
26
27
|
this.getBlackListStatus = getBlackListStatus
|
|
27
28
|
this.deriveDataNeededForTick = getDeriveDataNeededForTick(this.aci)
|
|
28
29
|
this.deriveTransactionsToCheck = getDeriveTransactionsToCheck({
|
|
@@ -31,6 +32,12 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
setServer(config) {
|
|
35
|
+
applyRemoteConfigEip7702Whitelist({
|
|
36
|
+
eip7702Whitelist: this.eip7702Whitelist,
|
|
37
|
+
remoteConfig: config,
|
|
38
|
+
logger: this.logger,
|
|
39
|
+
})
|
|
40
|
+
|
|
34
41
|
const uri = config?.server || this.server.defaultUri
|
|
35
42
|
|
|
36
43
|
if (uri === this.server.uri) {
|
|
@@ -173,7 +180,7 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
|
|
|
173
180
|
const eip7702Delegation = await getCurrentEIP7702Delegation({
|
|
174
181
|
server: this.server,
|
|
175
182
|
address: ourWalletAddress,
|
|
176
|
-
eip7702Supported: this.
|
|
183
|
+
eip7702Supported: this.eip7702Whitelist.get(),
|
|
177
184
|
currentDelegation: currentAccountState?.eip7702Delegation,
|
|
178
185
|
logger: this.logger,
|
|
179
186
|
})
|