@exodus/ethereum-api 8.11.0 → 8.13.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,30 @@
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.13.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.12.0...@exodus/ethereum-api@8.13.0) (2024-08-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * add webSocketEnabled flag support for eth-monitor ([#3084](https://github.com/ExodusMovement/assets/issues/3084)) ([e9c684b](https://github.com/ExodusMovement/assets/commit/e9c684bd12798ab6aae067063e5e594d96f3ebeb))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * dynamic evm naming ([#3074](https://github.com/ExodusMovement/assets/issues/3074)) ([da046a7](https://github.com/ExodusMovement/assets/commit/da046a73ef05e763c4ffda601c5b04d1c53fa8f0))
17
+ * **ethereum-api:** fix endless ws reconnection loop ([#3072](https://github.com/ExodusMovement/assets/issues/3072)) ([74da0f6](https://github.com/ExodusMovement/assets/commit/74da0f6ba1ebae49cf81993b6944b2814381a618))
18
+
19
+
20
+
21
+ ## [8.12.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.11.0...@exodus/ethereum-api@8.12.0) (2024-07-29)
22
+
23
+
24
+ ### Features
25
+
26
+ * new ethereum naming ([#3028](https://github.com/ExodusMovement/assets/issues/3028)) ([31652d5](https://github.com/ExodusMovement/assets/commit/31652d566b70863f2d0c247254be0942f3c3fedd))
27
+
28
+
29
+
6
30
  ## [8.11.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.10.1...@exodus/ethereum-api@8.11.0) (2024-07-26)
7
31
 
8
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.11.0",
3
+ "version": "8.13.0",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -65,5 +65,5 @@
65
65
  "type": "git",
66
66
  "url": "git+https://github.com/ExodusMovement/assets.git"
67
67
  },
68
- "gitHead": "70583d4d7487eb844193b87a148c4308bf2dcd27"
68
+ "gitHead": "53f08ad71e1b8bb5a84b6cdf82c0177031497460"
69
69
  }
@@ -13,17 +13,18 @@ export const createAssetPluginFactory = (config) => {
13
13
  assert(config.meta.explorerUrl, 'meta.explorerUrl is required')
14
14
 
15
15
  const chainId = config.chainId
16
- const { explorerUrl, ...meta } = config.meta
17
- const name = `evm_${chainId}`
18
- const ticker = `EVM${chainId}`
19
- const tokenType = `EVM_${chainId}_TOKEN`
16
+ const { explorerUrl, decimals, ...meta } = config.meta
17
+ const chainIdHex = '0x' + chainId.toString(16)
18
+ const name = `evm${chainIdHex}`.toLowerCase()
19
+ const ticker = name.toUpperCase()
20
+ const tokenType = `EVM_${chainIdHex}_TOKEN`.toUpperCase()
20
21
 
21
22
  const units = {
22
23
  wei: 0,
23
24
  Kwei: 3,
24
25
  Mwei: 6,
25
26
  Gwei: 9,
26
- [ticker]: config.decimals || 18,
27
+ [ticker]: decimals || 18,
27
28
  }
28
29
 
29
30
  const currency = UnitType.create(units)
@@ -139,8 +140,10 @@ export const fromAddEthereumChainParameterToFactoryParams = (params) => {
139
140
  chainId,
140
141
  meta: {
141
142
  explorerUrl: params.blockExplorerUrls[0],
142
- displayName: params.chainName,
143
- displayTicker: params.nativeCurrency.name || params.nativeCurrency.symbol,
143
+ displayNetworkName: params.chainName,
144
+ displayName: params.nativeCurrency.name || params.nativeCurrency.symbol,
145
+ displayTicker: params.nativeCurrency.symbol,
146
+ decimals: params.nativeCurrency.decimals,
144
147
  primaryColor: color,
145
148
  gradientColors: [color, color],
146
149
  gradientCoords: {
@@ -64,9 +64,7 @@ export function create(defaultURL, ensAssetName) {
64
64
  },
65
65
 
66
66
  stop() {
67
- if (ws.isCreated()) {
68
- ws.close()
69
- }
67
+ ws.close()
70
68
  },
71
69
 
72
70
  ws,
@@ -22,7 +22,7 @@ import {
22
22
  // formatting, and populating-to-state all ETH/ETC/ERC20 transactions.
23
23
 
24
24
  export class EthereumMonitor extends BaseMonitor {
25
- constructor({ server, config, ...args }) {
25
+ constructor({ server, config, webSocketEnabled = true, ...args }) {
26
26
  super(args)
27
27
  this.server = server
28
28
  this.config = { GAS_PRICE_FROM_WEBSOCKET: true, ...config }
@@ -34,6 +34,7 @@ export class EthereumMonitor extends BaseMonitor {
34
34
  this.addHook('before-start', (...args) => this.beforeStart(...args))
35
35
  this.addHook('after-stop', (...args) => this.afterStop(...args))
36
36
  this.subscribedToGasPriceMap = new Map()
37
+ this._webSocketEnabled = webSocketEnabled
37
38
  }
38
39
 
39
40
  setServer(config = {}) {
@@ -253,6 +254,8 @@ export class EthereumMonitor extends BaseMonitor {
253
254
  }
254
255
 
255
256
  async _subscribeToWSNotifications() {
257
+ if (this._webSocketEnabled === false) return
258
+
256
259
  const addressesByWalletAccount = await this.getReceiveAddressesByWalletAccount()
257
260
  subscribeToWSNotifications({
258
261
  addressesByWalletAccount,
@@ -276,6 +279,12 @@ export class EthereumMonitor extends BaseMonitor {
276
279
  }
277
280
 
278
281
  async beforeStart() {
282
+ await this._enableWSUpdates()
283
+ }
284
+
285
+ async _enableWSUpdates() {
286
+ if (this._webSocketEnabled === false) return
287
+
279
288
  const addressesByWalletAccount = await this.getReceiveAddressesByWalletAccount()
280
289
  enableWSUpdates({
281
290
  interval: this.interval,