@exodus/headless 2.0.0-alpha.25 → 2.0.0-alpha.26

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,12 @@
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
+ ## [2.0.0-alpha.26](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.25...@exodus/headless@2.0.0-alpha.26) (2023-05-30)
7
+
8
+ ### Features
9
+
10
+ - integrate feeMonitors into headless ([#1732](https://github.com/ExodusMovement/exodus-hydra/issues/1732)) ([5a4b9b4](https://github.com/ExodusMovement/exodus-hydra/commit/5a4b9b4e2e7b70ac550775860a3bf5474e21a4d0))
11
+
6
12
  ## [2.0.0-alpha.25](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.24...@exodus/headless@2.0.0-alpha.25) (2023-05-26)
7
13
 
8
14
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.25",
3
+ "version": "2.0.0-alpha.26",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -39,6 +39,7 @@
39
39
  "@exodus/enabled-assets": "^6.0.1",
40
40
  "@exodus/exodus-pricing-client": "^1.1.0",
41
41
  "@exodus/feature-flags": "^2.0.1",
42
+ "@exodus/fee-monitors": "^1.0.0",
42
43
  "@exodus/fetch": "^1.2.1",
43
44
  "@exodus/geolocation": "^2.0.0",
44
45
  "@exodus/key-identifier-provider": "^1.1.3",
@@ -60,6 +61,7 @@
60
61
  "devDependencies": {
61
62
  "@exodus/algorand-lib": "^2.0.1",
62
63
  "@exodus/algorand-meta": "^1.1.4",
64
+ "@exodus/bitcoin-lib": "^2.2.1",
63
65
  "@exodus/bitcoin-meta": "^1.0.0",
64
66
  "@exodus/currency": "^2.2.0",
65
67
  "@exodus/ethereum-lib": "^2.22.2",
@@ -79,5 +81,5 @@
79
81
  "nock": "^13.3.1",
80
82
  "p-defer": "^4.0.0"
81
83
  },
82
- "gitHead": "915212f45e3bf3f938dd1f985448b9714e7ade96"
84
+ "gitHead": "e423fd0fa1cbf41c4af86b6ebe25905cd4cecba0"
83
85
  }
package/src/api.js CHANGED
@@ -17,7 +17,7 @@ const createApi = ({ ioc, port }) => {
17
17
  connectedOrigins,
18
18
  } = ioc.getByType('module')
19
19
 
20
- const { ratesMonitor } = ioc.getByType('monitor')
20
+ const { ratesMonitor, feeMonitors } = ioc.getByType('monitor')
21
21
 
22
22
  const {
23
23
  // ...
@@ -32,6 +32,7 @@ const createApi = ({ ioc, port }) => {
32
32
  kyc.stop()
33
33
  referrals.stop()
34
34
  remoteConfig.stop()
35
+ feeMonitors.stop()
35
36
  }
36
37
 
37
38
  return {
@@ -0,0 +1,21 @@
1
+ import { compute } from '@exodus/atoms'
2
+ import { uniq } from 'lodash'
3
+
4
+ const getEnabledNetworks = (enabledAssetsData, assets) => {
5
+ const enabledAssetNames = Object.keys(enabledAssetsData)
6
+
7
+ return uniq(
8
+ enabledAssetNames.map((assetName) => assets[assetName]?.baseAsset.name).filter(Boolean)
9
+ )
10
+ }
11
+
12
+ const createBaseAssetNamesToMonitorAtom = ({ assetsModule, enabledAssetsAtom }) => {
13
+ const selector = (enabledAssets) => getEnabledNetworks(enabledAssets, assetsModule.getAssets())
14
+ return compute({ atom: enabledAssetsAtom, selector })
15
+ }
16
+
17
+ export default {
18
+ id: 'baseAssetNamesToMonitorAtom',
19
+ factory: createBaseAssetNamesToMonitorAtom,
20
+ dependencies: ['assetsModule', 'enabledAssetsAtom'],
21
+ }
@@ -22,6 +22,7 @@ import {
22
22
  walletAccountsAtomDefinition,
23
23
  } from '@exodus/wallet-accounts/atoms'
24
24
 
25
+ import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
25
26
  import { withType } from './utils'
26
27
 
27
28
  const createAtomDependencies = () =>
@@ -155,6 +156,7 @@ const createAtomDependencies = () =>
155
156
  },
156
157
  ],
157
158
  },
159
+ { definition: baseAssetNamesToMonitorAtomDefinition },
158
160
  ].map(withType('atom'))
159
161
 
160
162
  export default createAtomDependencies
@@ -1,3 +1,4 @@
1
+ import feeMonitorsDefinition from '@exodus/fee-monitors/monitor'
1
2
  import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
2
3
  import marketHistoryMonitorDefinition from '@exodus/market-history/module'
3
4
  import ratesMonitorDefinition from '@exodus/rates-monitor/module'
@@ -33,6 +34,7 @@ const createMonitorDependencies = () =>
33
34
  ],
34
35
  },
35
36
  { definition: ratesMonitorDefinition, writesAtoms: ['ratesAtom'] },
37
+ { definition: feeMonitorsDefinition },
36
38
  ].map(withType('monitor'))
37
39
 
38
40
  export default createMonitorDependencies
package/src/index.js CHANGED
@@ -32,7 +32,8 @@ const createExodus = ({ adapters, config, port }) => {
32
32
  connectedOrigins,
33
33
  } = ioc.getByType('module')
34
34
 
35
- const { geolocationMonitor, marketHistory, ratesMonitor } = ioc.getByType('monitor')
35
+ const { geolocationMonitor, marketHistory, ratesMonitor, feeMonitors } =
36
+ ioc.getByType('monitor')
36
37
 
37
38
  const { featureFlagAtoms } = ioc.getByType('atom-collection')
38
39
 
@@ -47,6 +48,9 @@ const createExodus = ({ adapters, config, port }) => {
47
48
  port.emit('account-states-update', payload)
48
49
  )
49
50
 
51
+ feeMonitors.on('fees-load', () => port.emit('fees-load', feeMonitors.getAllFeeData()))
52
+ feeMonitors.on('fees-update', (payload) => port.emit('fees-update', payload))
53
+
50
54
  remoteConfig.on('sync', ({ current }) => port.emit('remote-config', current))
51
55
 
52
56
  // TODO: migrate to marketHistoryAtom. Will be easier once it's on headless
@@ -72,6 +76,7 @@ const createExodus = ({ adapters, config, port }) => {
72
76
  remoteConfig.sync()
73
77
  marketHistory.start()
74
78
  ratesMonitor.start()
79
+ feeMonitors.start()
75
80
 
76
81
  await assetsModule.load()
77
82
  await connectedOrigins.load()