@exodus/headless 2.0.0-alpha.43 → 2.0.0-alpha.45
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 +13 -0
- package/package.json +2 -2
- package/src/api.js +3 -33
- package/src/dependencies/atoms.js +0 -44
- package/src/dependencies/modules.js +0 -21
- package/src/dependencies/monitors.js +0 -46
- package/src/index.js +21 -68
- package/src/ioc.js +5 -0
- package/src/modules/blockchain-metadata/api.js +22 -0
- package/src/modules/blockchain-metadata/index.js +20 -0
- package/src/modules/blockchain-metadata/plugin.js +30 -0
- package/src/modules/crypto-news/index.js +20 -0
- package/src/modules/crypto-news/plugin.js +17 -0
- package/src/modules/geolocation/index.js +20 -0
- package/src/modules/geolocation/plugin.js +14 -0
- package/src/modules/market-history/index.js +66 -0
- package/src/modules/market-history/plugin.js +21 -0
- package/src/modules/personal-notes/api.js +12 -0
- package/src/modules/personal-notes/index.js +28 -0
- package/src/modules/personal-notes/plugin.js +15 -0
- package/src/modules/rates/api.js +12 -0
- package/src/modules/rates/index.js +22 -0
- package/src/modules/rates/plugin.js +17 -0
- package/src/modules/remote-config/api.js +13 -0
- package/src/modules/remote-config/index.js +28 -0
- package/src/modules/remote-config/plugin.js +20 -0
- package/src/modules/top-movers/index.js +23 -0
- package/src/modules/top-movers/plugin.js +17 -0
- /package/src/{utils/blockchain-metadata.js → modules/blockchain-metadata/utils.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.45](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.44...@exodus/headless@2.0.0-alpha.45) (2023-06-18)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- use(geolocation, marketHistory, topMovers, rates) ([#1992](https://github.com/ExodusMovement/exodus-hydra/issues/1992)) ([2e8d634](https://github.com/ExodusMovement/exodus-hydra/commit/2e8d63426421ffcbec84a9b6fbc83eb913b47eba))
|
|
11
|
+
|
|
12
|
+
## [2.0.0-alpha.44](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.43...@exodus/headless@2.0.0-alpha.44) (2023-06-18)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- use(personalNotes, blockchainMetadata, remoteConfig, cryptoNews) ([#1991](https://github.com/ExodusMovement/exodus-hydra/issues/1991)) ([ccaaa4a](https://github.com/ExodusMovement/exodus-hydra/commit/ccaaa4ac44f8bed9de99418c394c40478eaeae69))
|
|
17
|
+
- validate type field on ioc.use() ([#1974](https://github.com/ExodusMovement/exodus-hydra/issues/1974)) ([b234c82](https://github.com/ExodusMovement/exodus-hydra/commit/b234c82a6f0550d34273590250b307a965b11295))
|
|
18
|
+
|
|
6
19
|
## [2.0.0-alpha.43](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.42...@exodus/headless@2.0.0-alpha.43) (2023-06-16)
|
|
7
20
|
|
|
8
21
|
### 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.45",
|
|
4
4
|
"description": "The headless Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"nock": "^13.3.1",
|
|
89
89
|
"p-defer": "^4.0.0"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "af48f92eb9e4b7758b6f145181c4c45a24cf5b65"
|
|
92
92
|
}
|
package/src/api.js
CHANGED
|
@@ -5,17 +5,10 @@ const createApi = ({ ioc, port }) => {
|
|
|
5
5
|
|
|
6
6
|
const { assetsModule } = ioc.getByType('adapter')
|
|
7
7
|
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
application,
|
|
11
|
-
blockchainMetadata,
|
|
12
|
-
enabledAssets,
|
|
13
|
-
personalNotes,
|
|
14
|
-
remoteConfig,
|
|
15
|
-
wallet,
|
|
16
|
-
} = ioc.getByType('module')
|
|
8
|
+
const { addressProvider, application, enabledAssets, remoteConfig, wallet } =
|
|
9
|
+
ioc.getByType('module')
|
|
17
10
|
|
|
18
|
-
const { feeMonitors,
|
|
11
|
+
const { feeMonitors, nftsMonitor } = ioc.getByType('monitor')
|
|
19
12
|
|
|
20
13
|
// TODO: decide where this belongs
|
|
21
14
|
const { passphraseCache } = ioc.getAll()
|
|
@@ -51,19 +44,6 @@ const createApi = ({ ioc, port }) => {
|
|
|
51
44
|
changeLockTimer: application.changeLockTimer,
|
|
52
45
|
isLocked: () => wallet.isLocked(),
|
|
53
46
|
},
|
|
54
|
-
blockchainMetadata: {
|
|
55
|
-
getTxLog: blockchainMetadata.getTxLog,
|
|
56
|
-
getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
|
|
57
|
-
updateTxs: blockchainMetadata.updateTxs,
|
|
58
|
-
overwriteTxs: blockchainMetadata.overwriteTxs,
|
|
59
|
-
clearTxs: blockchainMetadata.clearTxs,
|
|
60
|
-
removeTxs: blockchainMetadata.removeTxs,
|
|
61
|
-
getAccountState: blockchainMetadata.getAccountState,
|
|
62
|
-
getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
|
|
63
|
-
updateAccountState: blockchainMetadata.updateAccountState,
|
|
64
|
-
removeAccountState: blockchainMetadata.removeAccountState,
|
|
65
|
-
batch: blockchainMetadata.batch,
|
|
66
|
-
},
|
|
67
47
|
assets: {
|
|
68
48
|
enable: enabledAssets.enable,
|
|
69
49
|
disable: enabledAssets.disable,
|
|
@@ -73,21 +53,11 @@ const createApi = ({ ioc, port }) => {
|
|
|
73
53
|
return asset.name
|
|
74
54
|
},
|
|
75
55
|
},
|
|
76
|
-
remoteConfig: {
|
|
77
|
-
get: remoteConfig.get,
|
|
78
|
-
getAll: remoteConfig.getAll,
|
|
79
|
-
},
|
|
80
|
-
rates: {
|
|
81
|
-
refresh: () => ratesMonitor.update(),
|
|
82
|
-
},
|
|
83
56
|
addressProvider: {
|
|
84
57
|
getAddress: addressProvider.getAddress.bind(addressProvider),
|
|
85
58
|
getSupportedPurposes: addressProvider.getSupportedPurposes.bind(addressProvider),
|
|
86
59
|
getReceiveAddress: addressProvider.getReceiveAddress.bind(addressProvider),
|
|
87
60
|
},
|
|
88
|
-
personalNotes: {
|
|
89
|
-
upsert: personalNotes.upsert,
|
|
90
|
-
},
|
|
91
61
|
isMnemonicValid,
|
|
92
62
|
subscribe: port.subscribe.bind(port),
|
|
93
63
|
unsubscribe: port.unsubscribe.bind(port),
|
|
@@ -6,16 +6,11 @@ import {
|
|
|
6
6
|
} from '@exodus/atoms'
|
|
7
7
|
import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
|
|
8
8
|
import { balancesAtomDefinition } from '@exodus/balances/atoms'
|
|
9
|
-
import { cryptoNewsAtomDefinition } from '@exodus/crypto-news-monitor/atoms'
|
|
10
9
|
import {
|
|
11
10
|
enabledAndDisabledAssetsAtomDefinition,
|
|
12
11
|
enabledAssetsAtomDefinition,
|
|
13
12
|
} from '@exodus/enabled-assets/atoms'
|
|
14
13
|
import { featureFlagsAtomDefinition } from '@exodus/feature-flags/atoms'
|
|
15
|
-
import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
|
|
16
|
-
import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
|
|
17
|
-
import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
|
|
18
|
-
import { topMoversAtomDefinition } from '@exodus/top-movers-monitor/atoms'
|
|
19
14
|
|
|
20
15
|
import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
|
|
21
16
|
import nonDustBalanceAssetNamesAtomDefinition from '../atoms/non-dust-balance-asset-names-atom'
|
|
@@ -51,32 +46,6 @@ const createAtomDependencies = () =>
|
|
|
51
46
|
dependencies: ['config', 'remoteConfig'],
|
|
52
47
|
},
|
|
53
48
|
},
|
|
54
|
-
// TODO: move to @exodus/market-history
|
|
55
|
-
{
|
|
56
|
-
definition: {
|
|
57
|
-
id: 'marketHistoryClearCacheAtom',
|
|
58
|
-
factory: ({ config }) => createInMemoryAtom(config),
|
|
59
|
-
dependencies: ['config'],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
// TODO: move to @exodus/market-history
|
|
63
|
-
{
|
|
64
|
-
definition: {
|
|
65
|
-
id: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
66
|
-
factory: ({ config, remoteConfig }) =>
|
|
67
|
-
createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
68
|
-
dependencies: ['config', 'remoteConfig'],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
// TODO: move to @exodus/market-history
|
|
72
|
-
{
|
|
73
|
-
definition: {
|
|
74
|
-
id: 'marketHistoryRefreshIntervalAtom',
|
|
75
|
-
factory: ({ config, remoteConfig }) =>
|
|
76
|
-
createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
77
|
-
dependencies: ['config', 'remoteConfig'],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
49
|
{
|
|
81
50
|
definition: {
|
|
82
51
|
id: 'mockConfigAtom',
|
|
@@ -97,21 +66,8 @@ const createAtomDependencies = () =>
|
|
|
97
66
|
],
|
|
98
67
|
},
|
|
99
68
|
{ definition: balancesAtomDefinition },
|
|
100
|
-
{ definition: ratesAtomDefinition },
|
|
101
|
-
{ definition: geolocationAtomDefinition },
|
|
102
69
|
{ definition: featureFlagsAtomDefinition },
|
|
103
|
-
{
|
|
104
|
-
definition: personalNotesAtomDefinition,
|
|
105
|
-
aliases: [
|
|
106
|
-
{
|
|
107
|
-
implementationId: 'personalNotesStorage',
|
|
108
|
-
interfaceId: 'storage',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
70
|
{ definition: baseAssetNamesToMonitorAtomDefinition },
|
|
113
|
-
{ definition: topMoversAtomDefinition },
|
|
114
|
-
{ definition: cryptoNewsAtomDefinition },
|
|
115
71
|
{ definition: restoreAtomDefinition },
|
|
116
72
|
{ definition: apyRatesAtomDefinition },
|
|
117
73
|
].map(withType('atom'))
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import createAddressProviderDependencies from '@exodus/address-provider'
|
|
2
2
|
import availableAssetsModuleDefinition from '@exodus/available-assets/module'
|
|
3
3
|
import balancesDefinition from '@exodus/balances/module'
|
|
4
|
-
import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
|
|
5
|
-
import createRemoteConfig from '@exodus/config/remote'
|
|
6
4
|
import enabledAssetsModuleDefinition from '@exodus/enabled-assets/module'
|
|
7
5
|
import createExodusPricingClient from '@exodus/exodus-pricing-client'
|
|
8
6
|
import featureFlagsDefinition from '@exodus/feature-flags/module'
|
|
9
7
|
import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
|
|
10
8
|
import keychainDefinition from '@exodus/keychain/module'
|
|
11
|
-
import personalNotesDefinition from '@exodus/personal-notes/module'
|
|
12
9
|
import walletDefinition from '@exodus/wallet/module'
|
|
13
10
|
import walletCompatibilityModesDefinition from '@exodus/wallet-compatibility-modes/module'
|
|
14
|
-
import EventEmitter from 'events/'
|
|
15
11
|
|
|
16
12
|
import createApplication from '../application'
|
|
17
13
|
import unlockEncryptedStorageDefinition from '../unlock-encrypted-storage'
|
|
@@ -44,21 +40,7 @@ const createModuleDependencies = ({ config }) =>
|
|
|
44
40
|
definition: walletCompatibilityModesDefinition,
|
|
45
41
|
},
|
|
46
42
|
{ definition: unlockEncryptedStorageDefinition },
|
|
47
|
-
{
|
|
48
|
-
definition: blockchainMetadataDefinition,
|
|
49
|
-
storage: { namespace: ['blockchain', 'v1'] },
|
|
50
|
-
},
|
|
51
43
|
{ definition: enabledAssetsModuleDefinition, writesAtoms: ['enabledAndDisabledAssetsAtom'] },
|
|
52
|
-
{
|
|
53
|
-
definition: {
|
|
54
|
-
id: 'remoteConfig',
|
|
55
|
-
factory: (deps) => {
|
|
56
|
-
const eventEmitter = new EventEmitter().setMaxListeners(Number.POSITIVE_INFINITY)
|
|
57
|
-
return createRemoteConfig({ eventEmitter, ...deps })
|
|
58
|
-
},
|
|
59
|
-
dependencies: ['fetch', 'freeze', 'config', 'logger'],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
44
|
{ definition: availableAssetsModuleDefinition, writesAtoms: ['availableAssetNamesAtom'] },
|
|
63
45
|
{
|
|
64
46
|
definition: {
|
|
@@ -73,9 +55,6 @@ const createModuleDependencies = ({ config }) =>
|
|
|
73
55
|
writesAtoms: ['featureFlagAtoms'],
|
|
74
56
|
},
|
|
75
57
|
...createAddressProviderDependencies(config.addressProvider),
|
|
76
|
-
{
|
|
77
|
-
definition: personalNotesDefinition,
|
|
78
|
-
},
|
|
79
58
|
].map(withType('module'))
|
|
80
59
|
|
|
81
60
|
export default createModuleDependencies
|
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
import apyRatesMonitorDefinition from '@exodus/apy-rates/monitor'
|
|
2
|
-
import cryptoNewsMonitorDefinition from '@exodus/crypto-news-monitor/monitor'
|
|
3
2
|
import feeMonitorsDefinition from '@exodus/fee-monitors/monitor'
|
|
4
|
-
import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
|
|
5
|
-
import marketHistoryMonitorDefinition from '@exodus/market-history/module'
|
|
6
|
-
import ratesMonitorDefinition from '@exodus/rates-monitor/module'
|
|
7
|
-
import localTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/local'
|
|
8
|
-
import remoteTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/remote'
|
|
9
3
|
|
|
10
4
|
import { withType } from './utils'
|
|
11
5
|
|
|
12
6
|
const createMonitorDependencies = ({ config }) =>
|
|
13
7
|
[
|
|
14
|
-
{
|
|
15
|
-
definition: geolocationMonitorDefinition,
|
|
16
|
-
writesAtoms: ['geolocationAtom'],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
definition: marketHistoryMonitorDefinition,
|
|
20
|
-
storage: { namespace: 'marketHistory' },
|
|
21
|
-
aliases: [
|
|
22
|
-
{
|
|
23
|
-
implementationId: 'unsafeStorage',
|
|
24
|
-
interfaceId: 'storage',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
implementationId: 'marketHistoryClearCacheAtom',
|
|
28
|
-
interfaceId: 'clearCacheAtom',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
implementationId: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
32
|
-
interfaceId: 'remoteConfigClearCacheAtom',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
implementationId: 'marketHistoryRefreshIntervalAtom',
|
|
36
|
-
interfaceId: 'remoteConfigRefreshIntervalAtom',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
8
|
{ definition: feeMonitorsDefinition },
|
|
41
|
-
{
|
|
42
|
-
definition: ratesMonitorDefinition,
|
|
43
|
-
writesAtoms: ['ratesAtom'],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
definition: config.topMoversMonitor.computeLocally
|
|
47
|
-
? localTopMoversMonitorDefinition
|
|
48
|
-
: remoteTopMoversMonitorDefinition,
|
|
49
|
-
writesAtoms: ['topMoversAtom'],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
definition: cryptoNewsMonitorDefinition,
|
|
53
|
-
writesAtoms: ['cryptoNewsAtom'],
|
|
54
|
-
},
|
|
55
9
|
{
|
|
56
10
|
definition: apyRatesMonitorDefinition,
|
|
57
11
|
writesAtoms: ['apyRatesAtom'],
|
package/src/index.js
CHANGED
|
@@ -5,26 +5,41 @@ import attachAtoms from './atoms/attach'
|
|
|
5
5
|
import { atomsToAttach } from './constants'
|
|
6
6
|
import createIOC from './ioc'
|
|
7
7
|
import abTesting from './modules/ab-testing'
|
|
8
|
+
import blockchainMetadata from './modules/blockchain-metadata'
|
|
8
9
|
import connectedOrigins from './modules/connected-origins'
|
|
10
|
+
import cryptoNews from './modules/crypto-news'
|
|
11
|
+
import geolocation from './modules/geolocation'
|
|
9
12
|
import kyc from './modules/kyc'
|
|
10
13
|
import locale from './modules/locale'
|
|
14
|
+
import marketHistory from './modules/market-history'
|
|
11
15
|
import nfts from './modules/nfts'
|
|
16
|
+
import personalNotes from './modules/personal-notes'
|
|
17
|
+
import rates from './modules/rates'
|
|
12
18
|
import referrals from './modules/referrals'
|
|
19
|
+
import remoteConfig from './modules/remote-config'
|
|
20
|
+
import topMovers from './modules/top-movers'
|
|
13
21
|
import walletAccounts from './modules/wallet-accounts'
|
|
14
22
|
import attachPlugins from './plugins/attach'
|
|
15
|
-
import { createLoadWalletAccountsHandler } from './utils/blockchain-metadata'
|
|
16
23
|
|
|
17
24
|
const createExodus = ({ adapters, config, port }) => {
|
|
18
25
|
const ioc = createIOC({ adapters, config })
|
|
19
|
-
const { headless: headlessConfig } = config
|
|
26
|
+
const { headless: headlessConfig, topMoversMonitor } = config
|
|
20
27
|
|
|
21
28
|
ioc.use(walletAccounts())
|
|
29
|
+
ioc.use(blockchainMetadata())
|
|
30
|
+
ioc.use(remoteConfig())
|
|
31
|
+
ioc.use(geolocation())
|
|
32
|
+
ioc.use(marketHistory())
|
|
33
|
+
ioc.use(rates())
|
|
22
34
|
ioc.use(locale())
|
|
23
35
|
ioc.use(nfts())
|
|
24
36
|
ioc.use(kyc())
|
|
25
37
|
ioc.use(referrals())
|
|
26
38
|
ioc.use(connectedOrigins())
|
|
27
39
|
ioc.use(abTesting())
|
|
40
|
+
ioc.use(personalNotes())
|
|
41
|
+
ioc.use(cryptoNews())
|
|
42
|
+
ioc.use(topMovers({ config: topMoversMonitor }))
|
|
28
43
|
|
|
29
44
|
ioc.register({ definition: { id: 'port', type: 'port', factory: () => port } })
|
|
30
45
|
|
|
@@ -33,57 +48,16 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
33
48
|
|
|
34
49
|
const { assetsModule, storage } = ioc.getByType('adapter')
|
|
35
50
|
|
|
36
|
-
const {
|
|
37
|
-
|
|
38
|
-
blockchainMetadata,
|
|
39
|
-
enabledAssets,
|
|
40
|
-
featureFlags,
|
|
41
|
-
personalNotes,
|
|
42
|
-
remoteConfig,
|
|
43
|
-
unlockEncryptedStorage,
|
|
44
|
-
} = ioc.getByType('module')
|
|
45
|
-
|
|
46
|
-
const {
|
|
47
|
-
apyRatesMonitor,
|
|
48
|
-
cryptoNewsMonitor,
|
|
49
|
-
feeMonitors,
|
|
50
|
-
geolocationMonitor,
|
|
51
|
-
marketHistory,
|
|
52
|
-
ratesMonitor,
|
|
53
|
-
topMoversMonitor,
|
|
54
|
-
} = ioc.getByType('monitor')
|
|
55
|
-
|
|
56
|
-
const { featureFlagAtoms } = ioc.getByType('atom-collection')
|
|
57
|
-
|
|
58
|
-
const handleLoadWalletAccounts = createLoadWalletAccountsHandler({
|
|
59
|
-
blockchainMetadata,
|
|
60
|
-
port,
|
|
61
|
-
})
|
|
51
|
+
const { application, enabledAssets, featureFlags, unlockEncryptedStorage } =
|
|
52
|
+
ioc.getByType('module')
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
blockchainMetadata.on('tx-logs-update', (payload) => port.emit('tx-logs-update', payload))
|
|
65
|
-
blockchainMetadata.on('account-states-update', (payload) =>
|
|
66
|
-
port.emit('account-states-update', payload)
|
|
67
|
-
)
|
|
54
|
+
const { apyRatesMonitor, feeMonitors } = ioc.getByType('monitor')
|
|
68
55
|
|
|
69
56
|
feeMonitors.on('fees-load', () => port.emit('fees-load', feeMonitors.getAllFeeData()))
|
|
70
57
|
feeMonitors.on('fees-update', (payload) => port.emit('fees-update', payload))
|
|
71
58
|
|
|
72
|
-
remoteConfig.on('sync', ({ current }) => port.emit('remote-config', current))
|
|
73
|
-
|
|
74
|
-
// TODO: migrate to marketHistoryAtom. Will be easier once it's on headless
|
|
75
|
-
marketHistory.on('market-history', (payload) => port.emit('market-history', payload))
|
|
76
|
-
marketHistory.on('market-history-new-assets', (payload) =>
|
|
77
|
-
port.emit('market-history-new-assets', payload)
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
// TODO: migrate to ratesAtom. Will be easier once it's on headless
|
|
81
|
-
ratesMonitor.on('rates', (payload) => port.emit('rates', payload))
|
|
82
|
-
|
|
83
59
|
application.hook('start', (payload) => {
|
|
84
|
-
remoteConfig.load()
|
|
85
60
|
featureFlags.load()
|
|
86
|
-
geolocationMonitor.start()
|
|
87
61
|
|
|
88
62
|
port.emit('start', payload)
|
|
89
63
|
})
|
|
@@ -91,28 +65,11 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
91
65
|
application.hook('unlock', async () => {
|
|
92
66
|
if (typeof storage.unlock === 'function') unlockEncryptedStorage(storage)
|
|
93
67
|
|
|
94
|
-
remoteConfig.sync()
|
|
95
|
-
marketHistory.start()
|
|
96
|
-
ratesMonitor.start()
|
|
97
68
|
feeMonitors.start()
|
|
98
69
|
apyRatesMonitor.start()
|
|
99
70
|
|
|
100
71
|
await assetsModule.load()
|
|
101
|
-
await
|
|
102
|
-
//
|
|
103
|
-
blockchainMetadata.load(),
|
|
104
|
-
enabledAssets.load(),
|
|
105
|
-
])
|
|
106
|
-
|
|
107
|
-
featureFlagAtoms.topMovers?.get().then(({ isOn }) => {
|
|
108
|
-
if (!isOn) return
|
|
109
|
-
topMoversMonitor.start()
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
featureFlagAtoms.cryptoNews?.get().then(({ isOn }) => {
|
|
113
|
-
if (!isOn) return
|
|
114
|
-
cryptoNewsMonitor.start()
|
|
115
|
-
})
|
|
72
|
+
await enabledAssets.load()
|
|
116
73
|
})
|
|
117
74
|
|
|
118
75
|
application.on('unlock', () => {
|
|
@@ -123,13 +80,9 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
123
80
|
await Promise.all([
|
|
124
81
|
//
|
|
125
82
|
assetsModule.clear(),
|
|
126
|
-
blockchainMetadata.clear(),
|
|
127
83
|
enabledAssets.clear(),
|
|
128
84
|
featureFlags.clear(),
|
|
129
85
|
])
|
|
130
|
-
|
|
131
|
-
// TEMP: dont wait to clear as encrypted storage is not yet unlocked
|
|
132
|
-
personalNotes.clear()
|
|
133
86
|
})
|
|
134
87
|
|
|
135
88
|
application.on('clear', () => {
|
package/src/ioc.js
CHANGED
|
@@ -7,6 +7,7 @@ import namespaceConfig from '@exodus/dependency-preprocessors/src/preprocessors/
|
|
|
7
7
|
import namespaceStorage from '@exodus/dependency-preprocessors/src/preprocessors/namespace-storage'
|
|
8
8
|
import optional from '@exodus/dependency-preprocessors/src/preprocessors/optional'
|
|
9
9
|
import readOnlyAtoms from '@exodus/dependency-preprocessors/src/preprocessors/read-only-atoms'
|
|
10
|
+
import assert from 'minimalistic-assert'
|
|
10
11
|
|
|
11
12
|
import createDependencies from './dependencies'
|
|
12
13
|
|
|
@@ -40,6 +41,10 @@ const createIOC = ({ adapters, config }) => {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const use = (module) => {
|
|
44
|
+
for (const { definition } of module.definitions) {
|
|
45
|
+
assert(definition.type, `ioc.use: "${definition.id}" is missing type field`)
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
registerMultiple(module.definitions)
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const createBlockchainMetadataApi = ({ blockchainMetadata }) => ({
|
|
2
|
+
blockchainMetadata: {
|
|
3
|
+
getTxLog: blockchainMetadata.getTxLog,
|
|
4
|
+
getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
|
|
5
|
+
updateTxs: blockchainMetadata.updateTxs,
|
|
6
|
+
overwriteTxs: blockchainMetadata.overwriteTxs,
|
|
7
|
+
clearTxs: blockchainMetadata.clearTxs,
|
|
8
|
+
removeTxs: blockchainMetadata.removeTxs,
|
|
9
|
+
getAccountState: blockchainMetadata.getAccountState,
|
|
10
|
+
getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
|
|
11
|
+
updateAccountState: blockchainMetadata.updateAccountState,
|
|
12
|
+
removeAccountState: blockchainMetadata.removeAccountState,
|
|
13
|
+
batch: blockchainMetadata.batch,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
id: 'createBlockchainMetadataApi',
|
|
19
|
+
type: 'api',
|
|
20
|
+
factory: createBlockchainMetadataApi,
|
|
21
|
+
dependencies: ['blockchainMetadata'],
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
|
|
2
|
+
|
|
3
|
+
import blockchainMetadataApiDefinition from './api'
|
|
4
|
+
import blockchainMetadataPluginDefinition from './plugin'
|
|
5
|
+
|
|
6
|
+
const blockchainMetadata = () => {
|
|
7
|
+
return {
|
|
8
|
+
id: 'blockchainMetadata',
|
|
9
|
+
definitions: [
|
|
10
|
+
{
|
|
11
|
+
definition: blockchainMetadataDefinition,
|
|
12
|
+
storage: { namespace: ['blockchain', 'v1'] },
|
|
13
|
+
},
|
|
14
|
+
{ definition: blockchainMetadataPluginDefinition },
|
|
15
|
+
{ definition: blockchainMetadataApiDefinition },
|
|
16
|
+
],
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default blockchainMetadata
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createLoadWalletAccountsHandler } from './utils'
|
|
2
|
+
|
|
3
|
+
const blockchainLifecyclePlugin = ({ blockchainMetadata, port }) => {
|
|
4
|
+
const handleLoadWalletAccounts = createLoadWalletAccountsHandler({ blockchainMetadata, port })
|
|
5
|
+
|
|
6
|
+
blockchainMetadata.on('load-wallet-accounts', handleLoadWalletAccounts)
|
|
7
|
+
|
|
8
|
+
blockchainMetadata.on('tx-logs-update', (payload) => port.emit('tx-logs-update', payload))
|
|
9
|
+
|
|
10
|
+
blockchainMetadata.on('account-states-update', (payload) =>
|
|
11
|
+
port.emit('account-states-update', payload)
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
const onUnlock = async () => {
|
|
15
|
+
await blockchainMetadata.load()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const onClear = async () => {
|
|
19
|
+
await blockchainMetadata.clear()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return { onUnlock, onClear }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
id: 'blockchainLifecyclePlugin',
|
|
27
|
+
type: 'plugin',
|
|
28
|
+
factory: blockchainLifecyclePlugin,
|
|
29
|
+
dependencies: ['blockchainMetadata', 'port'],
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cryptoNewsAtomDefinition } from '@exodus/crypto-news-monitor/atoms'
|
|
2
|
+
import cryptoNewsMonitorDefinition from '@exodus/crypto-news-monitor/monitor'
|
|
3
|
+
|
|
4
|
+
import cryptoNewsPluginDefinition from './plugin'
|
|
5
|
+
|
|
6
|
+
const cryptoNews = () => {
|
|
7
|
+
return {
|
|
8
|
+
id: 'cryptoNews',
|
|
9
|
+
definitions: [
|
|
10
|
+
{ definition: cryptoNewsAtomDefinition },
|
|
11
|
+
{
|
|
12
|
+
definition: cryptoNewsMonitorDefinition,
|
|
13
|
+
writesAtoms: ['cryptoNewsAtom'],
|
|
14
|
+
},
|
|
15
|
+
{ definition: cryptoNewsPluginDefinition },
|
|
16
|
+
],
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default cryptoNews
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const cryptoNewsPlugin = ({ cryptoNewsMonitor, featureFlagAtoms }) => {
|
|
2
|
+
const onUnlock = () => {
|
|
3
|
+
featureFlagAtoms.cryptoNews?.get().then(({ isOn }) => {
|
|
4
|
+
if (!isOn) return
|
|
5
|
+
cryptoNewsMonitor.start()
|
|
6
|
+
})
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return { onUnlock }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
id: 'cryptoNewsLifecyclePlugin',
|
|
14
|
+
type: 'plugin',
|
|
15
|
+
factory: cryptoNewsPlugin,
|
|
16
|
+
dependencies: ['cryptoNewsMonitor', 'featureFlagAtoms'],
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
|
|
2
|
+
import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
|
|
3
|
+
|
|
4
|
+
import geolocationPluginDefinition from './plugin'
|
|
5
|
+
|
|
6
|
+
const geolocation = () => {
|
|
7
|
+
return {
|
|
8
|
+
id: 'geolocation',
|
|
9
|
+
definitions: [
|
|
10
|
+
{ definition: geolocationAtomDefinition },
|
|
11
|
+
{
|
|
12
|
+
definition: geolocationMonitorDefinition,
|
|
13
|
+
writesAtoms: ['geolocationAtom'],
|
|
14
|
+
},
|
|
15
|
+
{ definition: geolocationPluginDefinition },
|
|
16
|
+
],
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default geolocation
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const createGeolocationLifecyclePlugin = ({ geolocationMonitor }) => {
|
|
2
|
+
const onStart = async () => {
|
|
3
|
+
geolocationMonitor.start()
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return { onStart }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
id: 'geolocationLifecyclePlugin',
|
|
11
|
+
type: 'plugin',
|
|
12
|
+
factory: createGeolocationLifecyclePlugin,
|
|
13
|
+
dependencies: ['geolocationMonitor'],
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createInMemoryAtom, createRemoteConfigAtomFactory } from '@exodus/atoms'
|
|
2
|
+
import marketHistoryMonitorDefinition from '@exodus/market-history/module'
|
|
3
|
+
|
|
4
|
+
import marketHistoryPluginDefinition from './plugin'
|
|
5
|
+
|
|
6
|
+
const marketHistory = () => {
|
|
7
|
+
return {
|
|
8
|
+
id: 'marketHistory',
|
|
9
|
+
definitions: [
|
|
10
|
+
{
|
|
11
|
+
definition: { type: 'monitor', ...marketHistoryMonitorDefinition },
|
|
12
|
+
storage: { namespace: 'marketHistory' },
|
|
13
|
+
aliases: [
|
|
14
|
+
{
|
|
15
|
+
implementationId: 'unsafeStorage',
|
|
16
|
+
interfaceId: 'storage',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
implementationId: 'marketHistoryClearCacheAtom',
|
|
20
|
+
interfaceId: 'clearCacheAtom',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
implementationId: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
24
|
+
interfaceId: 'remoteConfigClearCacheAtom',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
implementationId: 'marketHistoryRefreshIntervalAtom',
|
|
28
|
+
interfaceId: 'remoteConfigRefreshIntervalAtom',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
// TODO: move to @exodus/market-history
|
|
33
|
+
{
|
|
34
|
+
definition: {
|
|
35
|
+
id: 'marketHistoryClearCacheAtom',
|
|
36
|
+
type: 'atom',
|
|
37
|
+
factory: ({ config }) => createInMemoryAtom(config),
|
|
38
|
+
dependencies: ['config'],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
// TODO: move to @exodus/market-history
|
|
42
|
+
{
|
|
43
|
+
definition: {
|
|
44
|
+
id: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
45
|
+
type: 'atom',
|
|
46
|
+
factory: ({ config, remoteConfig }) =>
|
|
47
|
+
createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
48
|
+
dependencies: ['config', 'remoteConfig'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
// TODO: move to @exodus/market-history
|
|
52
|
+
{
|
|
53
|
+
definition: {
|
|
54
|
+
id: 'marketHistoryRefreshIntervalAtom',
|
|
55
|
+
type: 'atom',
|
|
56
|
+
factory: ({ config, remoteConfig }) =>
|
|
57
|
+
createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
58
|
+
dependencies: ['config', 'remoteConfig'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{ definition: marketHistoryPluginDefinition },
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default marketHistory
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const createMarketHistoryLifecyclePlugin = ({ marketHistory, port }) => {
|
|
2
|
+
// TODO: migrate to marketHistoryAtom. Will be easier once it's on headless
|
|
3
|
+
marketHistory.on('market-history', (payload) => port.emit('market-history', payload))
|
|
4
|
+
|
|
5
|
+
marketHistory.on('market-history-new-assets', (payload) =>
|
|
6
|
+
port.emit('market-history-new-assets', payload)
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
const onUnlock = () => {
|
|
10
|
+
marketHistory.start()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return { onUnlock }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
id: 'marketHistoryLifecyclePlugin',
|
|
18
|
+
type: 'plugin',
|
|
19
|
+
factory: createMarketHistoryLifecyclePlugin,
|
|
20
|
+
dependencies: ['marketHistory', 'port'],
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const createPersonalNotesApi = ({ personalNotes }) => ({
|
|
2
|
+
personalNotes: {
|
|
3
|
+
upsert: personalNotes.upsert,
|
|
4
|
+
},
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
id: 'createPersonalNotesApi',
|
|
9
|
+
type: 'api',
|
|
10
|
+
factory: createPersonalNotesApi,
|
|
11
|
+
dependencies: ['personalNotes'],
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
|
|
2
|
+
import personalNotesDefinition from '@exodus/personal-notes/module'
|
|
3
|
+
|
|
4
|
+
import personalNotesApiDefinition from './api'
|
|
5
|
+
import personalNotesPluginDefinition from './plugin'
|
|
6
|
+
|
|
7
|
+
// TODO: Add type to module definitions
|
|
8
|
+
const personalNotes = () => {
|
|
9
|
+
return {
|
|
10
|
+
id: 'personalNotes',
|
|
11
|
+
definitions: [
|
|
12
|
+
{
|
|
13
|
+
definition: { type: 'atom', ...personalNotesAtomDefinition },
|
|
14
|
+
aliases: [
|
|
15
|
+
{
|
|
16
|
+
implementationId: 'personalNotesStorage',
|
|
17
|
+
interfaceId: 'storage',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{ definition: { type: 'module', ...personalNotesDefinition } },
|
|
22
|
+
{ definition: personalNotesPluginDefinition },
|
|
23
|
+
{ definition: personalNotesApiDefinition },
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default personalNotes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const personalNotesLifecyclePlugin = ({ personalNotes }) => {
|
|
2
|
+
// TEMP: dont wait to clear as encrypted storage is not yet unlocked
|
|
3
|
+
const onClear = () => {
|
|
4
|
+
personalNotes.clear()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return { onClear }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
id: 'personalNotesLifecyclePlugin',
|
|
12
|
+
type: 'plugin',
|
|
13
|
+
factory: personalNotesLifecyclePlugin,
|
|
14
|
+
dependencies: ['personalNotes'],
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
|
|
2
|
+
import ratesMonitorDefinition from '@exodus/rates-monitor/module'
|
|
3
|
+
|
|
4
|
+
import ratesApi from './api'
|
|
5
|
+
import ratesPlugin from './plugin'
|
|
6
|
+
|
|
7
|
+
const rates = () => {
|
|
8
|
+
return {
|
|
9
|
+
id: 'rates',
|
|
10
|
+
definitions: [
|
|
11
|
+
{ definition: { type: 'atom', ...ratesAtomDefinition } },
|
|
12
|
+
{
|
|
13
|
+
definition: { type: 'monitor', ...ratesMonitorDefinition },
|
|
14
|
+
writesAtoms: ['ratesAtom'],
|
|
15
|
+
},
|
|
16
|
+
{ definition: ratesPlugin },
|
|
17
|
+
{ definition: ratesApi },
|
|
18
|
+
],
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default rates
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const createRatesLifecyclePlugin = ({ ratesMonitor, port }) => {
|
|
2
|
+
// TODO: migrate to ratesAtom. Will be easier once it's on headless
|
|
3
|
+
ratesMonitor.on('rates', (payload) => port.emit('rates', payload))
|
|
4
|
+
|
|
5
|
+
const onUnlock = () => {
|
|
6
|
+
ratesMonitor.start()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return { onUnlock }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
id: 'ratesLifecyclePlugin',
|
|
14
|
+
type: 'plugin',
|
|
15
|
+
factory: createRatesLifecyclePlugin,
|
|
16
|
+
dependencies: ['ratesMonitor', 'port'],
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const createRemoteConfigApi = ({ remoteConfig }) => ({
|
|
2
|
+
remoteConfig: {
|
|
3
|
+
get: remoteConfig.get,
|
|
4
|
+
getAll: remoteConfig.getAll,
|
|
5
|
+
},
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
id: 'createRemoteConfigApi',
|
|
10
|
+
type: 'api',
|
|
11
|
+
factory: createRemoteConfigApi,
|
|
12
|
+
dependencies: ['remoteConfig'],
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import createRemoteConfig from '@exodus/config/remote'
|
|
2
|
+
import EventEmitter from 'events/'
|
|
3
|
+
|
|
4
|
+
import remoteConfigApiDefinition from './api'
|
|
5
|
+
import remoteConfigPluginDefinition from './plugin'
|
|
6
|
+
|
|
7
|
+
const remoteConfig = () => {
|
|
8
|
+
return {
|
|
9
|
+
id: 'remoteConfig',
|
|
10
|
+
definitions: [
|
|
11
|
+
{
|
|
12
|
+
definition: {
|
|
13
|
+
id: 'remoteConfig',
|
|
14
|
+
type: 'module',
|
|
15
|
+
factory: (deps) => {
|
|
16
|
+
const eventEmitter = new EventEmitter().setMaxListeners(Number.POSITIVE_INFINITY)
|
|
17
|
+
return createRemoteConfig({ eventEmitter, ...deps })
|
|
18
|
+
},
|
|
19
|
+
dependencies: ['fetch', 'freeze', 'config', 'logger'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{ definition: remoteConfigPluginDefinition },
|
|
23
|
+
{ definition: remoteConfigApiDefinition },
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default remoteConfig
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const remoteConfigLifecyclePlugin = ({ remoteConfig, port }) => {
|
|
2
|
+
remoteConfig.on('sync', ({ current }) => port.emit('remote-config', current))
|
|
3
|
+
|
|
4
|
+
const onStart = () => {
|
|
5
|
+
remoteConfig.load()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const onUnlock = () => {
|
|
9
|
+
remoteConfig.sync()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return { onUnlock, onStart }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
id: 'remoteConfigLifecyclePlugin',
|
|
17
|
+
type: 'plugin',
|
|
18
|
+
factory: remoteConfigLifecyclePlugin,
|
|
19
|
+
dependencies: ['remoteConfig', 'port'],
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { topMoversAtomDefinition } from '@exodus/top-movers-monitor/atoms'
|
|
2
|
+
import localTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/local'
|
|
3
|
+
import remoteTopMoversMonitorDefinition from '@exodus/top-movers-monitor/monitor/remote'
|
|
4
|
+
|
|
5
|
+
import topMoversPlugin from './plugin'
|
|
6
|
+
|
|
7
|
+
const topMovers = ({ config }) => {
|
|
8
|
+
return {
|
|
9
|
+
id: 'topMovers',
|
|
10
|
+
definitions: [
|
|
11
|
+
{ definition: topMoversAtomDefinition },
|
|
12
|
+
{
|
|
13
|
+
definition: config.computeLocally
|
|
14
|
+
? localTopMoversMonitorDefinition
|
|
15
|
+
: remoteTopMoversMonitorDefinition,
|
|
16
|
+
writesAtoms: ['topMoversAtom'],
|
|
17
|
+
},
|
|
18
|
+
{ definition: topMoversPlugin },
|
|
19
|
+
],
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default topMovers
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const createTopMoversLifecyclePlugin = ({ topMoversMonitor, featureFlagAtoms }) => {
|
|
2
|
+
const onUnlock = () => {
|
|
3
|
+
featureFlagAtoms.topMovers?.get().then(({ isOn }) => {
|
|
4
|
+
if (!isOn) return
|
|
5
|
+
topMoversMonitor.start()
|
|
6
|
+
})
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return { onUnlock }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
id: 'topMoversLifecyclePlugin',
|
|
14
|
+
type: 'plugin',
|
|
15
|
+
factory: createTopMoversLifecyclePlugin,
|
|
16
|
+
dependencies: ['topMoversMonitor', 'featureFlagAtoms'],
|
|
17
|
+
}
|
|
File without changes
|