@exodus/ethereum-api 8.29.2 → 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 CHANGED
@@ -3,6 +3,22 @@
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
+
6
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)
7
23
 
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.29.2",
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": "d9dacbc9ccadf109a2a2b10e97c35c46759e803e"
67
+ "gitHead": "932693f881fb18c01cd19e8f9849e0faab3a0a1e"
68
68
  }
@@ -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 { allowMetaMaskCompat, supportsStaking, nfts, customTokens, supportsCustomFees } = {
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
@@ -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')