@exodus/headless 2.0.0-alpha.25 → 2.0.0-alpha.27
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 +12 -0
- package/package.json +5 -2
- package/src/api.js +2 -1
- package/src/atoms/base-asset-names-to-monitor.js +21 -0
- package/src/constants.js +2 -1
- package/src/dependencies/atoms.js +4 -0
- package/src/dependencies/monitors.js +15 -2
- package/src/index.js +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.27](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.26...@exodus/headless@2.0.0-alpha.27) (2023-05-31)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- integrate top-movers monitor into headless ([#1743](https://github.com/ExodusMovement/exodus-hydra/issues/1743)) ([05c4b22](https://github.com/ExodusMovement/exodus-hydra/commit/05c4b22e69e823563d81bfe7b30a2d21574d0c45))
|
|
11
|
+
|
|
12
|
+
## [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)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- integrate feeMonitors into headless ([#1732](https://github.com/ExodusMovement/exodus-hydra/issues/1732)) ([5a4b9b4](https://github.com/ExodusMovement/exodus-hydra/commit/5a4b9b4e2e7b70ac550775860a3bf5474e21a4d0))
|
|
17
|
+
|
|
6
18
|
## [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
19
|
|
|
8
20
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/headless",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.27",
|
|
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",
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"@exodus/personal-notes": "^3.0.1",
|
|
50
51
|
"@exodus/rates-monitor": "^2.0.0",
|
|
51
52
|
"@exodus/referrals": "^5.2.0",
|
|
53
|
+
"@exodus/top-movers-monitor": "^2.0.1",
|
|
52
54
|
"@exodus/wallet": "^6.0.1",
|
|
53
55
|
"@exodus/wallet-accounts": "^8.0.1",
|
|
54
56
|
"@exodus/wallet-compatibility-modes": "^2.0.0",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@exodus/algorand-lib": "^2.0.1",
|
|
62
64
|
"@exodus/algorand-meta": "^1.1.4",
|
|
65
|
+
"@exodus/bitcoin-lib": "^2.2.1",
|
|
63
66
|
"@exodus/bitcoin-meta": "^1.0.0",
|
|
64
67
|
"@exodus/currency": "^2.2.0",
|
|
65
68
|
"@exodus/ethereum-lib": "^2.22.2",
|
|
@@ -79,5 +82,5 @@
|
|
|
79
82
|
"nock": "^13.3.1",
|
|
80
83
|
"p-defer": "^4.0.0"
|
|
81
84
|
},
|
|
82
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "8295106699aff7afd282497ef6cf28b2699c5cb3"
|
|
83
86
|
}
|
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
|
+
}
|
package/src/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const atomsToAttach = [
|
|
2
2
|
'availableAssetNamesAtom',
|
|
3
3
|
'balancesAtom',
|
|
4
|
+
'connectedOriginsAtom',
|
|
4
5
|
'currencyAtom',
|
|
5
6
|
'enabledWalletAccountsAtom',
|
|
6
7
|
'featureFlagsAtom',
|
|
@@ -9,6 +10,6 @@ export const atomsToAttach = [
|
|
|
9
10
|
'languageAtom',
|
|
10
11
|
'personalNotesAtom',
|
|
11
12
|
'referralsAtom',
|
|
13
|
+
'topMoversAtom',
|
|
12
14
|
'walletAccountsAtom',
|
|
13
|
-
'connectedOriginsAtom',
|
|
14
15
|
]
|
|
@@ -17,11 +17,13 @@ import { kycAtomDefinition } from '@exodus/kyc/atoms'
|
|
|
17
17
|
import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
|
|
18
18
|
import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
|
|
19
19
|
import { referralsAtomDefinition } from '@exodus/referrals/atoms'
|
|
20
|
+
import { topMoversAtomDefinition } from '@exodus/top-movers-monitor/atoms'
|
|
20
21
|
import {
|
|
21
22
|
enabledWalletAccountsAtomDefinition,
|
|
22
23
|
walletAccountsAtomDefinition,
|
|
23
24
|
} from '@exodus/wallet-accounts/atoms'
|
|
24
25
|
|
|
26
|
+
import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
|
|
25
27
|
import { withType } from './utils'
|
|
26
28
|
|
|
27
29
|
const createAtomDependencies = () =>
|
|
@@ -155,6 +157,8 @@ const createAtomDependencies = () =>
|
|
|
155
157
|
},
|
|
156
158
|
],
|
|
157
159
|
},
|
|
160
|
+
{ definition: baseAssetNamesToMonitorAtomDefinition },
|
|
161
|
+
{ definition: topMoversAtomDefinition },
|
|
158
162
|
].map(withType('atom'))
|
|
159
163
|
|
|
160
164
|
export default createAtomDependencies
|
|
@@ -1,10 +1,13 @@
|
|
|
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'
|
|
5
|
+
import localTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/local'
|
|
6
|
+
import remoteTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/remote'
|
|
4
7
|
|
|
5
8
|
import { withType } from './utils'
|
|
6
9
|
|
|
7
|
-
const createMonitorDependencies = () =>
|
|
10
|
+
const createMonitorDependencies = ({ config }) =>
|
|
8
11
|
[
|
|
9
12
|
{
|
|
10
13
|
definition: geolocationMonitorDefinition,
|
|
@@ -32,7 +35,17 @@ const createMonitorDependencies = () =>
|
|
|
32
35
|
},
|
|
33
36
|
],
|
|
34
37
|
},
|
|
35
|
-
{ definition:
|
|
38
|
+
{ definition: feeMonitorsDefinition },
|
|
39
|
+
{
|
|
40
|
+
definition: ratesMonitorDefinition,
|
|
41
|
+
writesAtoms: ['ratesAtom'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
definition: config.topMoversMonitor.computeLocally
|
|
45
|
+
? localTopMoversMonitorDefinition
|
|
46
|
+
: remoteTopMoversMonitorDefinition,
|
|
47
|
+
writesAtoms: ['topMoversAtom'],
|
|
48
|
+
},
|
|
36
49
|
].map(withType('monitor'))
|
|
37
50
|
|
|
38
51
|
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 } =
|
|
35
|
+
const { geolocationMonitor, marketHistory, ratesMonitor, feeMonitors, topMoversMonitor } =
|
|
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()
|
|
@@ -87,6 +92,11 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
87
92
|
kyc.load()
|
|
88
93
|
referrals.load()
|
|
89
94
|
})
|
|
95
|
+
|
|
96
|
+
featureFlagAtoms.topMovers?.get().then(({ isOn }) => {
|
|
97
|
+
if (!isOn) return
|
|
98
|
+
topMoversMonitor.start()
|
|
99
|
+
})
|
|
90
100
|
})
|
|
91
101
|
|
|
92
102
|
application.on('unlock', () => {
|