@exodus/ethereum-api 8.29.1 → 8.30.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 +26 -0
- package/package.json +2 -2
- package/src/create-asset.js +25 -2
- package/src/eth-like-util.js +1 -1
- package/src/exodus-eth-server/clarity-v2.js +9 -0
- package/src/exodus-eth-server/index.js +2 -0
- package/src/tx-log/clarity-monitor.js +3 -3
- package/src/tx-log/ethereum-monitor.js +2 -2
- package/src/tx-log/ethereum-no-history-monitor.js +1 -1
- package/src/tx-log/monitor-utils/exclude-unchanged-token-balances.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.30.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.29.2...@exodus/ethereum-api@8.30.0) (2025-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: allow to override monitorType from platforms (#5062)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
* fix: use new server uri from remote config (#5063)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [8.29.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.29.1...@exodus/ethereum-api@8.29.2) (2025-02-11)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
* fix: security hardening (#5035)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
## [8.29.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.29.0...@exodus/ethereum-api@8.29.1) (2025-02-10)
|
|
7
33
|
|
|
8
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.30.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",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"type": "git",
|
|
65
65
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "932693f881fb18c01cd19e8f9849e0faab3a0a1e"
|
|
68
68
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -24,7 +24,7 @@ import ms from 'ms'
|
|
|
24
24
|
import { addressHasHistoryFactory } from './address-has-history.js'
|
|
25
25
|
import { createTokenFactory } from './create-token-factory.js'
|
|
26
26
|
import { createCustomFeesApi } from './custom-fees.js'
|
|
27
|
-
import { createEvmServer } from './exodus-eth-server/index.js'
|
|
27
|
+
import { createEvmServer, ValidMonitorTypes } from './exodus-eth-server/index.js'
|
|
28
28
|
import { createFeeData } from './fee-data-factory.js'
|
|
29
29
|
import { createGetBalanceForAddress } from './get-balance-for-address.js'
|
|
30
30
|
import { getBalancesFactory } from './get-balances.js'
|
|
@@ -97,13 +97,36 @@ export const createAssetFactory = ({
|
|
|
97
97
|
) => {
|
|
98
98
|
const assets = connectAssetsList(assetsList)
|
|
99
99
|
|
|
100
|
-
const {
|
|
100
|
+
const {
|
|
101
|
+
allowMetaMaskCompat,
|
|
102
|
+
supportsStaking,
|
|
103
|
+
nfts,
|
|
104
|
+
customTokens,
|
|
105
|
+
supportsCustomFees,
|
|
106
|
+
monitorType: overrideMonitorType,
|
|
107
|
+
serverUrl: overrideServerUrl,
|
|
108
|
+
monitorInterval: overrideMonitorInterval,
|
|
109
|
+
} = {
|
|
101
110
|
...defaultConfig,
|
|
102
111
|
...config,
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
const asset = assets[base.name]
|
|
106
115
|
|
|
116
|
+
if (overrideMonitorType) {
|
|
117
|
+
if (!ValidMonitorTypes.includes(overrideMonitorType) || !overrideServerUrl) {
|
|
118
|
+
console.warn('Invalid config for overrideMonitorType or overrideServerUrl', {
|
|
119
|
+
monitorType: overrideMonitorType,
|
|
120
|
+
serverUrl: overrideServerUrl,
|
|
121
|
+
})
|
|
122
|
+
} else {
|
|
123
|
+
monitorType = overrideMonitorType
|
|
124
|
+
serverUrl = overrideServerUrl
|
|
125
|
+
monitorInterval = overrideMonitorInterval || monitorInterval
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
monitorType = overrideMonitorType || monitorType
|
|
107
130
|
const server = createEvmServer({ assetName: asset.name, serverUrl, monitorType })
|
|
108
131
|
|
|
109
132
|
const gasLimit = 21e3 // 21 KGas, enough only for sending ether to normal address
|
package/src/eth-like-util.js
CHANGED
|
@@ -119,7 +119,7 @@ export const getIsForwarderContract = memoizeLruCache(
|
|
|
119
119
|
const ERC20 = new SolidityContract(ABI.erc20)
|
|
120
120
|
const ERC20BytesParams = new SolidityContract(ABI.erc20BytesParams)
|
|
121
121
|
const DEFAULT_PARAM_NAMES = ['decimals', 'name', 'symbol']
|
|
122
|
-
const erc20ParamsCache =
|
|
122
|
+
const erc20ParamsCache = Object.create(null)
|
|
123
123
|
|
|
124
124
|
export const getERC20Params = async ({ asset, address, paramNames = DEFAULT_PARAM_NAMES } = {}) => {
|
|
125
125
|
assert(asset, 'getERC20Params(): asset required')
|
|
@@ -32,9 +32,18 @@ async function fetchJsonRetry(url, fetchOptions) {
|
|
|
32
32
|
export default class ClarityServerV2 extends ClarityServer {
|
|
33
33
|
constructor({ baseAssetName, uri }) {
|
|
34
34
|
super({ baseAssetName, uri })
|
|
35
|
+
this.updateBaseApiPath()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
updateBaseApiPath() {
|
|
35
39
|
this.baseApiPath = this.uri + `/api/v2/${this.baseAssetName}`
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
setURI(uri) {
|
|
43
|
+
super.setURI(uri)
|
|
44
|
+
this.updateBaseApiPath()
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
async getAllTransactions({ address, cursor }) {
|
|
39
48
|
let { blockNumber } = this.#decodeCursor(cursor)
|
|
40
49
|
blockNumber = blockNumber.toString()
|
|
@@ -13,6 +13,8 @@ import ApiCoinNodesServer from './api-coin-nodes.js'
|
|
|
13
13
|
import ClarityServer from './clarity.js'
|
|
14
14
|
import ClarityServerV2 from './clarity-v2.js'
|
|
15
15
|
|
|
16
|
+
export const ValidMonitorTypes = ['no-history', 'clarity', 'clarity-v2', 'magnifier']
|
|
17
|
+
|
|
16
18
|
export function createEvmServer({ assetName, serverUrl, monitorType }) {
|
|
17
19
|
assert(assetName, 'assetName is required')
|
|
18
20
|
assert(serverUrl, 'serverUrl is required')
|
|
@@ -176,7 +176,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
176
176
|
|
|
177
177
|
async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
|
|
178
178
|
const asset = this.asset
|
|
179
|
-
const newAccountState =
|
|
179
|
+
const newAccountState = Object.create(null)
|
|
180
180
|
const balances = await this.getBalances({ tokens, ourWalletAddress })
|
|
181
181
|
if (isRpcBalanceAsset(asset)) {
|
|
182
182
|
const balance = balances[asset.name]
|
|
@@ -199,7 +199,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
199
199
|
|
|
200
200
|
async getReceiveAddressesByWalletAccount() {
|
|
201
201
|
const walletAccounts = await this.aci.getWalletAccounts({ assetName: this.asset.name })
|
|
202
|
-
const addressesByAccount =
|
|
202
|
+
const addressesByAccount = Object.create(null)
|
|
203
203
|
for (const walletAccount of walletAccounts) {
|
|
204
204
|
addressesByAccount[walletAccount] = await this.aci.getReceiveAddresses({
|
|
205
205
|
assetName: this.asset.name,
|
|
@@ -220,7 +220,7 @@ export class ClarityMonitor extends BaseMonitor {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
async getBalances({ tokens, ourWalletAddress }) {
|
|
223
|
-
const batch =
|
|
223
|
+
const batch = Object.create(null)
|
|
224
224
|
if (isRpcBalanceAsset(this.asset)) {
|
|
225
225
|
const request = this.server.getBalanceRequest(ourWalletAddress)
|
|
226
226
|
batch[this.asset.name] = request
|
|
@@ -230,7 +230,7 @@ export class EthereumMonitor extends BaseMonitor {
|
|
|
230
230
|
|
|
231
231
|
async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
|
|
232
232
|
const asset = this.asset
|
|
233
|
-
const newAccountState =
|
|
233
|
+
const newAccountState = Object.create(null)
|
|
234
234
|
const server = this.server
|
|
235
235
|
if (isRpcBalanceAsset(asset)) {
|
|
236
236
|
const result = await server.getBalanceProxied(ourWalletAddress)
|
|
@@ -255,7 +255,7 @@ export class EthereumMonitor extends BaseMonitor {
|
|
|
255
255
|
|
|
256
256
|
async getReceiveAddressesByWalletAccount() {
|
|
257
257
|
const walletAccounts = await this.aci.getWalletAccounts({ assetName: this.asset.name })
|
|
258
|
-
const addressesByAccount =
|
|
258
|
+
const addressesByAccount = Object.create(null)
|
|
259
259
|
for (const walletAccount of walletAccounts) {
|
|
260
260
|
addressesByAccount[walletAccount] = await this.aci.getReceiveAddresses({
|
|
261
261
|
assetName: this.asset.name,
|
|
@@ -63,7 +63,7 @@ export class EthereumNoHistoryMonitor extends BaseMonitor {
|
|
|
63
63
|
|
|
64
64
|
async getNewAccountState({ tokens, currentTokenBalances, ourWalletAddress }) {
|
|
65
65
|
const asset = this.asset
|
|
66
|
-
const newAccountState =
|
|
66
|
+
const newAccountState = Object.create(null)
|
|
67
67
|
const balances = await this.getBalances({ tokens, ourWalletAddress })
|
|
68
68
|
const balance = balances[asset.name]
|
|
69
69
|
newAccountState.balance = asset.currency.baseUnit(balance)
|