@exodus/headless 2.0.0-alpha.118 → 2.0.0-alpha.12

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/README.md CHANGED
@@ -15,7 +15,6 @@ The headless Exodus wallet SDK
15
15
 
16
16
  ```js
17
17
  import createExodus from '@exodus/headless'
18
- import referrals from '@exodus/headless/src/modules/referrals'
19
18
  import Emitter from '@exodus/wild-emitter'
20
19
 
21
20
  // 1. Create port. Acts as an event bus between headless wallet and client
@@ -26,10 +25,10 @@ const adapters = {}
26
25
  const config = {}
27
26
 
28
27
  // 3. Create Exodus container
29
- const exodusContainer = createExodus({ port, adapters, config })
28
+ const container = createExodus({ port, adapters, config })
30
29
 
31
30
  // 4. Register external modules. Does not support overriding modules at the moment.
32
- exodusContainer.register({
31
+ container.register({
33
32
  definition: {
34
33
  id: 'remoteConfig',
35
34
  factory: createRemoteConfig,
@@ -37,22 +36,11 @@ exodusContainer.register({
37
36
  },
38
37
  })
39
38
 
40
- // see an example feature definition:
41
- // https://github.com/ExodusMovement/exodus-hydra/blob/2e8d63426421ffcbec84a9b6fbc83eb913b47eba/modules/headless/src/modules/geolocation/index.js
42
- exodusContainer.use(referrals())
43
- exodusContainer.use(myCustomFeature({ id: 'myCustomFeature', ... }))
44
-
45
39
  // 5. Resolve exodus instance
46
- const exodus = exodusContainer.resolve()
47
-
48
- // 6. Start exodus instance
49
- await exodus.wallet.start()
40
+ const exodus = container.resolve()
50
41
 
51
- // 7. Use it!
42
+ // 6. Use it!
52
43
  await exodus.wallet.create({ passphrase: 'my-super-secure-passphrase' })
53
-
54
- // 8. Use your custom feature API, if any
55
- exodus.myCustomFeature.doThatThingYouDo()
56
44
  ```
57
45
 
58
46
  ## Lifecycle
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.118",
4
- "description": "The platform-agnostic Exodus wallet SDK",
5
- "author": "Exodus Movement Inc.",
3
+ "version": "2.0.0-alpha.12",
4
+ "description": "The headless Exodus wallet SDK",
5
+ "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
10
10
  },
11
- "homepage": "https://github.com/ExodusMovement/exodus-hydra/tree/master/sdks/headless",
11
+ "homepage": "https://github.com/ExodusMovement/exodus-hydra/tree/master/modules/headless",
12
12
  "license": "UNLICENSED",
13
13
  "bugs": {
14
14
  "url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Aheadless"
@@ -17,83 +17,55 @@
17
17
  "src",
18
18
  "README.md",
19
19
  "CHANGELOG.md",
20
- "!**/__tests__/**",
20
+ "!**/__tests__",
21
21
  "!**/*.test.js"
22
22
  ],
23
23
  "scripts": {
24
24
  "lint": "eslint . --ignore-path ../../.gitignore",
25
25
  "lint:fix": "yarn lint --fix",
26
- "test": "jest --runInBand"
26
+ "test": "jest"
27
27
  },
28
28
  "dependencies": {
29
- "@exodus/address-provider": "^7.0.0",
30
- "@exodus/atoms": "^5.6.0",
31
- "@exodus/auto-enable-assets-plugin": "^4.2.1",
32
- "@exodus/available-assets": "^5.1.1",
33
- "@exodus/balances": "^10.0.0",
29
+ "@exodus/atoms": "^2.9.0",
30
+ "@exodus/available-assets": "^2.0.0",
31
+ "@exodus/balances": "^6.0.0",
34
32
  "@exodus/basic-utils": "^2.0.0",
35
- "@exodus/blockchain-metadata": "^12.0.0",
36
- "@exodus/dependency-injection": "^2.0.1",
37
- "@exodus/dependency-preprocessors": "^3.1.1",
38
- "@exodus/enabled-assets": "^8.1.1",
39
- "@exodus/feature-flags": "^4.0.0",
40
- "@exodus/fee-monitors": "^2.1.0",
33
+ "@exodus/blockchain-metadata": "^8.0.1",
34
+ "@exodus/config": "7.0.0",
35
+ "@exodus/dependency-injection": "^1.2.0",
36
+ "@exodus/dependency-preprocessors": "^2.0.2",
37
+ "@exodus/enabled-assets": "^6.0.0",
38
+ "@exodus/exodus-pricing-client": "^1.1.0",
41
39
  "@exodus/fetch": "^1.2.1",
42
- "@exodus/geolocation": "^2.2.0",
43
- "@exodus/hd-key-slip-10": "^2.0.0",
44
40
  "@exodus/key-identifier-provider": "^1.1.3",
45
- "@exodus/keychain": "^4.1.0",
46
- "@exodus/locale": "^2.0.0",
41
+ "@exodus/keychain": "^4.0.0",
42
+ "@exodus/market-history": "^3.1.0",
47
43
  "@exodus/module": "^1.0.0",
48
- "@exodus/pricing": "^1.1.0",
49
- "@exodus/rates-monitor": "^4.0.0",
50
- "@exodus/remote-config": "^2.0.0",
51
- "@exodus/restore-progress-tracker": "^2.0.5",
52
- "@exodus/sodium-crypto": "^3.2.0",
53
- "@exodus/wallet": "^9.3.0",
54
- "@exodus/wallet-accounts": "^12.0.0",
55
- "@exodus/wallet-compatibility-modes": "^3.0.0",
56
- "bip39": "^2.6.0",
44
+ "@exodus/wallet": "^6.0.1",
45
+ "@exodus/wallet-accounts": "^8.0.1",
46
+ "@exodus/wallet-compatibility-modes": "^2.0.0",
47
+ "bip39": "2.6.0",
57
48
  "events": "^3.3.0",
58
- "lodash": "npm:@exodus/lodash@^4.17.21-exodus.2",
49
+ "lodash": "https://registry.yarnpkg.com/@exodus/lodash/-/lodash-4.17.21-exodus.2.tgz",
59
50
  "minimalistic-assert": "^1.0.1"
60
51
  },
61
52
  "devDependencies": {
62
- "@exodus/ab-testing": "^7.0.0",
63
- "@exodus/algorand-lib": "^2.0.1",
64
- "@exodus/algorand-meta": "^1.1.4",
65
- "@exodus/apy-rates": "^3.1.0",
66
- "@exodus/bitcoin-lib": "^2.2.1",
67
53
  "@exodus/bitcoin-meta": "^1.0.0",
68
- "@exodus/connected-origins": "^3.1.1",
69
- "@exodus/crypto-news-monitor": "^3.1.0",
70
54
  "@exodus/currency": "^2.2.0",
71
55
  "@exodus/ethereum-lib": "^2.22.2",
72
56
  "@exodus/ethereum-meta": "^1.0.23",
73
- "@exodus/exodus-pricing-client": "^1.2.0",
74
- "@exodus/key-utils": "^3.0.0",
75
- "@exodus/kyc": "^4.1.0",
76
- "@exodus/market-history": "^7.1.0",
77
57
  "@exodus/models": "^8.11.1",
78
- "@exodus/nfts": "^5.2.0",
79
- "@exodus/personal-notes": "^3.5.0",
80
- "@exodus/referrals": "^8.0.0",
81
58
  "@exodus/solana-lib": "^1.3.11",
82
59
  "@exodus/solana-meta": "^1.0.2",
83
60
  "@exodus/storage-encrypted": "^1.1.2",
84
- "@exodus/storage-memory": "^2.1.1",
85
- "@exodus/top-movers-monitor": "^3.1.0",
86
- "@exodus/ui-config": "^2.0.0",
61
+ "@exodus/storage-memory": "^1.1.0",
87
62
  "@exodus/wild-emitter": "^1.0.0",
88
63
  "buffer-json": "^2.0.0",
89
64
  "deepmerge": "^4.2.2",
90
- "delay": "^5.0.0",
91
- "eslint": "^8.44.0",
92
- "eslint-plugin-simple-import-sort": "^7.0.0",
65
+ "eslint": "^8.33.0",
93
66
  "events": "^3.3.0",
94
67
  "jest": "^29.1.2",
95
- "nock": "^13.3.1",
96
68
  "p-defer": "^4.0.0"
97
69
  },
98
- "gitHead": "fe2afc2446d5f185f09323f7b345430a5861bc22"
70
+ "gitHead": "696729a77e39cd2c973c5021a3cc340f759b76fc"
99
71
  }
package/src/api.js CHANGED
@@ -1,13 +1,84 @@
1
1
  import { validateMnemonic as isMnemonicValid } from 'bip39'
2
2
 
3
- import createReporting from './reporting'
3
+ const createApi = ({ ioc, port }) => {
4
+ const { passphraseCache } = ioc.getByType('adapter')
4
5
 
5
- const createApi = ({ ioc, port, lockedAtom }) => {
6
- const apis = ioc.getByType('api')
6
+ const {
7
+ application,
8
+ assetsModule,
9
+ blockchainMetadata,
10
+ enabledAssets,
11
+ remoteConfig,
12
+ wallet,
13
+ walletAccounts,
14
+ } = ioc.getByType('module')
15
+
16
+ const {
17
+ // ...
18
+ currencyAtom,
19
+ enabledWalletAccountsAtom,
20
+ languageAtom,
21
+ } = ioc.getByType('atom')
7
22
 
8
23
  return {
9
- ...Object.assign({}, ...Object.values(apis)),
10
- ...createReporting({ ioc, lockedAtom }),
24
+ wallet: {
25
+ exists: () => wallet.exists(),
26
+ load: application.load,
27
+ unload: application.unload,
28
+ create: application.create,
29
+ lock: application.lock,
30
+ unlock: application.unlock,
31
+ import: application.import,
32
+ delete: application.delete,
33
+ getMnemonic: application.getMnemonic,
34
+ setBackedUp: application.setBackedUp,
35
+ changePassphrase: application.changePassphrase,
36
+ restoreFromCurrentPhrase: async ({ passphrase } = {}) => {
37
+ if (!passphrase) passphrase = await passphraseCache.get()
38
+ const mnemonic = await application.getMnemonic({ passphrase })
39
+
40
+ await application.import({ passphrase, mnemonic })
41
+ },
42
+ changeLockTimer: application.changeLockTimer,
43
+ isLocked: () => wallet.isLocked(),
44
+ },
45
+ walletAccounts: {
46
+ create: walletAccounts.create,
47
+ update: walletAccounts.update,
48
+ disable: walletAccounts.disable,
49
+ enable: walletAccounts.enable,
50
+ getEnabled: enabledWalletAccountsAtom.get,
51
+ },
52
+ blockchainMetadata: {
53
+ getTxLog: blockchainMetadata.getTxLog,
54
+ getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
55
+ updateTxs: blockchainMetadata.updateTxs,
56
+ overwriteTxs: blockchainMetadata.overwriteTxs,
57
+ clearTxs: blockchainMetadata.clearTxs,
58
+ removeTxs: blockchainMetadata.removeTxs,
59
+ getAccountState: blockchainMetadata.getAccountState,
60
+ getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
61
+ updateAccountState: blockchainMetadata.updateAccountState,
62
+ removeAccountState: blockchainMetadata.removeAccountState,
63
+ batch: blockchainMetadata.batch,
64
+ },
65
+ assets: {
66
+ enable: enabledAssets.enable,
67
+ disable: enabledAssets.disable,
68
+ addAndEnableToken: async (...args) => {
69
+ const asset = await assetsModule.addToken(...args)
70
+ await enabledAssets.enable([asset.name])
71
+ return asset.name
72
+ },
73
+ },
74
+ remoteConfig: {
75
+ get: remoteConfig.get,
76
+ getAll: remoteConfig.getAll,
77
+ },
78
+ locale: {
79
+ setLanguage: (value) => languageAtom.set(value),
80
+ setCurrency: (value) => currencyAtom.set(value),
81
+ },
11
82
  isMnemonicValid,
12
83
  subscribe: port.subscribe.bind(port),
13
84
  unsubscribe: port.unsubscribe.bind(port),
@@ -3,8 +3,6 @@
3
3
  import ExodusModule from '@exodus/module'
4
4
  import assert from 'minimalistic-assert'
5
5
 
6
- import { LifecycleHook as Hook } from './constants'
7
-
8
6
  // Because we are forced to restart wallet after deleting/importing, we need to store certain flags to persist state between executions
9
7
 
10
8
  // Triggers deletetion logic when wallet starts.
@@ -19,6 +17,23 @@ const IMPORT_FLAG = 'importFlag'
19
17
  // Set as true on import method is called, and set to false after restore is completed
20
18
  const RESTORE_FLAG = 'restoreFlag'
21
19
 
20
+ const Hook = Object.freeze({
21
+ Lock: 'lock',
22
+ Unlock: 'unlock',
23
+ Clear: 'clear',
24
+ Import: 'import',
25
+ Migrate: 'migrate',
26
+ Start: 'start',
27
+ Load: 'load',
28
+ Unload: 'unload',
29
+ Create: 'create',
30
+ Backup: 'backup',
31
+ Restore: 'restore',
32
+ RestoreCompleted: 'restore-completed',
33
+ AssetsSynced: 'assets-synced',
34
+ ChangePassphrase: 'change-passphrase',
35
+ })
36
+
22
37
  const HOOKS = new Set(Object.values(Hook))
23
38
 
24
39
  class Application extends ExodusModule {
@@ -61,21 +76,7 @@ class Application extends ExodusModule {
61
76
 
62
77
  if (isImporting) await this.fire(Hook.Import)
63
78
 
64
- const [hasPassphraseSet, isLocked, isBackedUp, isRestoring] = await Promise.all([
65
- this.#wallet.hasPassphraseSet(),
66
- this.#wallet.isLocked(),
67
- this.#wallet.isBackedUp(),
68
- this.isRestoring(),
69
- ])
70
-
71
- await this.fire(Hook.Start, {
72
- walletExists,
73
- hasPassphraseSet,
74
- isLocked,
75
- isBackedUp,
76
- isRestoring,
77
- })
78
-
79
+ await this.fire(Hook.Start)
79
80
  await this.#autoUnlock()
80
81
 
81
82
  const locked = await this.#wallet.isLocked()
@@ -126,17 +127,7 @@ class Application extends ExodusModule {
126
127
  const hooks = this.#hooks[hookName] || []
127
128
 
128
129
  for (let i = 0; i < hooks.length; i++) {
129
- try {
130
- await hooks[i](params)
131
- } catch (err) {
132
- this._logger.error(
133
- `application lifecycle hook failed: ${hookName}`,
134
- hooks[i].name,
135
- params,
136
- err
137
- )
138
- throw err
139
- }
130
+ await hooks[i](params)
140
131
  }
141
132
 
142
133
  this.emit(hookName, params)
@@ -148,15 +139,7 @@ class Application extends ExodusModule {
148
139
  await this.#applicationStarted
149
140
  await this.#wallet.create(opts)
150
141
 
151
- const isLocked = await this.#wallet.isLocked()
152
-
153
- await this.fire(Hook.Create, {
154
- hasPassphraseSet: !!opts?.passphrase,
155
- isBackedUp: false,
156
- isLocked,
157
- isRestoring: false,
158
- walletExists: true,
159
- })
142
+ await this.fire(Hook.Create, { hasPassphraseSet: !!opts?.passphrase })
160
143
  }
161
144
 
162
145
  import = async (opts) => {
@@ -168,14 +151,14 @@ class Application extends ExodusModule {
168
151
 
169
152
  const walletExists = await this.#wallet.exists()
170
153
 
171
- const { forceRestart, forgotPassphrase, ...wallet } = opts
154
+ const { forceRestart, ...wallet } = opts
172
155
 
173
156
  await this.#wallet.import(wallet)
174
157
 
175
158
  if (forceRestart || walletExists) {
176
159
  await this.#storage.set(IMPORT_FLAG, true)
177
160
 
178
- await this.fire(Hook.Restart, { reason: 'import' })
161
+ this.emit('restart', { reason: 'import' })
179
162
  } else {
180
163
  await this.fire(Hook.Import)
181
164
 
@@ -224,8 +207,6 @@ class Application extends ExodusModule {
224
207
  this._logger.log('unlocking with cache')
225
208
 
226
209
  await this.#wallet.unlock({ passphrase })
227
-
228
- await this.fire(Hook.Migrate)
229
210
  await this.fire(Hook.Unlock)
230
211
 
231
212
  this.#restoreIfNeeded()
@@ -263,23 +244,15 @@ class Application extends ExodusModule {
263
244
  this._logger.log('passphrase changed')
264
245
  }
265
246
 
266
- delete = async ({ forgotPassphrase } = {}) => {
247
+ delete = async () => {
267
248
  await this.#storage.set(DELETE_FLAG, true)
268
- await this.fire(Hook.Restart, { reason: 'delete', forgotPassphrase })
269
- }
270
-
271
- stop = async () => {
272
- await this.fire(Hook.Stop)
249
+ this.emit('restart', { reason: 'delete' })
273
250
  }
274
251
 
275
252
  changeLockTimer = async ({ ttl }) => {
276
253
  await this.#passphraseCache.changeTtl(ttl)
277
254
  }
278
255
 
279
- restartAutoLockTimer = async () => {
280
- await this.#passphraseCache.scheduleClear()
281
- }
282
-
283
256
  isRestoring = async () => {
284
257
  return this.#storage.get(RESTORE_FLAG)
285
258
  }
@@ -7,12 +7,23 @@ const emitAtomValue = async (opts) => {
7
7
  export const emitFromAtoms = ({ atoms, port }) =>
8
8
  Object.entries(atoms).forEach(async ([atomId, atom]) => emitAtomValue({ port, atomId, atom }))
9
9
 
10
- const attachAtom = ({ port, application, atom, atomId }) => {
10
+ const attachAtom = ({ port, application, logger, atom, atomId, lifecycleEvents }) => {
11
11
  let loaded = false
12
12
 
13
- application.on('load', async () => {
14
- loaded = true
15
- await emitAtomValue({ port, atomId, atom })
13
+ lifecycleEvents.forEach((event) =>
14
+ application.on(event, async () => {
15
+ loaded = true
16
+ await emitAtomValue({ port, atomId, atom })
17
+ })
18
+ )
19
+
20
+ application.on('clear', async () => {
21
+ try {
22
+ await atom?.set(undefined)
23
+ } catch (error) {
24
+ logger.debug('failed to clear atom', error)
25
+ // noop. atom might not support set
26
+ }
16
27
  })
17
28
 
18
29
  atom.observe((value) => {
@@ -20,9 +31,9 @@ const attachAtom = ({ port, application, atom, atomId }) => {
20
31
  })
21
32
  }
22
33
 
23
- const attachAtoms = ({ port, application, atoms }) => {
34
+ const attachAtoms = ({ port, application, logger, atoms, lifecycleEvents = ['start'] }) => {
24
35
  for (const [atomId, atom] of Object.entries(atoms)) {
25
- attachAtom({ port, application, atom, atomId })
36
+ attachAtom({ port, application, logger, atom, atomId, lifecycleEvents })
26
37
  }
27
38
  }
28
39
 
package/src/constants.js CHANGED
@@ -1,38 +1,8 @@
1
1
  export const atomsToAttach = [
2
- 'abTestingAtom',
3
- 'apyRatesAtom',
4
2
  'availableAssetNamesAtom',
5
- 'balancesAtom',
6
- 'connectedOriginsAtom',
7
- 'cryptoNewsAtom',
8
3
  'currencyAtom',
9
4
  'enabledWalletAccountsAtom',
10
- 'featureFlagsAtom',
11
- 'geolocationAtom',
12
- 'kycAtom',
13
5
  'languageAtom',
14
- 'nftsConfigAtom',
15
- 'personalNotesAtom',
16
- 'referralsAtom',
17
- 'topMoversAtom',
18
6
  'walletAccountsAtom',
7
+ 'balancesAtom',
19
8
  ]
20
-
21
- export const LifecycleHook = Object.freeze({
22
- Lock: 'lock',
23
- Unlock: 'unlock',
24
- Clear: 'clear',
25
- Import: 'import',
26
- Migrate: 'migrate',
27
- Start: 'start',
28
- Stop: 'stop',
29
- Restart: 'restart',
30
- Load: 'load',
31
- Unload: 'unload',
32
- Create: 'create',
33
- Backup: 'backup',
34
- Restore: 'restore',
35
- RestoreCompleted: 'restore-completed',
36
- AssetsSynced: 'assets-synced',
37
- ChangePassphrase: 'change-passphrase',
38
- })
@@ -1,5 +1,109 @@
1
- import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
1
+ import {
2
+ createInMemoryAtom,
3
+ createRemoteConfigAtomFactory,
4
+ createStorageAtomFactory,
5
+ createFusionAtomFactory,
6
+ } from '@exodus/atoms'
7
+ import {
8
+ walletAccountsAtomDefinition,
9
+ enabledWalletAccountsAtomDefinition,
10
+ } from '@exodus/wallet-accounts/atoms'
2
11
 
3
- const createAtomDependencies = () => [{ definition: baseAssetNamesToMonitorAtomDefinition }]
12
+ import {
13
+ enabledAndDisabledAssetsAtomDefinition,
14
+ enabledAssetsAtomDefinition,
15
+ } from '@exodus/enabled-assets/atoms'
16
+
17
+ import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
18
+
19
+ import { withType } from './utils'
20
+ import { balancesAtomDefinition } from '@exodus/balances/atoms'
21
+
22
+ const createAtomDependencies = () =>
23
+ [
24
+ {
25
+ definition: {
26
+ id: 'lockedAtom',
27
+ factory: () => createInMemoryAtom({ defaultValue: true }),
28
+ dependencies: [],
29
+ },
30
+ },
31
+ {
32
+ definition: walletAccountsAtomDefinition,
33
+ storage: { namespace: 'walletAccounts' },
34
+ },
35
+ { definition: enabledWalletAccountsAtomDefinition },
36
+ { definition: enabledAndDisabledAssetsAtomDefinition },
37
+ { definition: enabledAssetsAtomDefinition },
38
+ { definition: availableAssetNamesAtomDefinition },
39
+ {
40
+ definition: {
41
+ id: 'pricingServerUrlAtom',
42
+ factory: ({ config, remoteConfig }) =>
43
+ createRemoteConfigAtomFactory({ remoteConfig })({
44
+ path: config.pricingServerPath,
45
+ defaultValue: config.defaultPricingServerUrl,
46
+ }),
47
+ dependencies: ['config', 'remoteConfig'],
48
+ },
49
+ },
50
+ {
51
+ definition: {
52
+ id: 'languageAtom',
53
+ factory: ({ storage, config }) =>
54
+ createStorageAtomFactory({ storage })({
55
+ key: 'language',
56
+ defaultValue: config.defaultValue,
57
+ isSoleWriter: true,
58
+ }),
59
+ dependencies: ['storage', 'config'],
60
+ },
61
+ aliases: [
62
+ {
63
+ implementationId: 'unsafeStorage',
64
+ interfaceId: 'storage',
65
+ },
66
+ ],
67
+ storage: { namespace: 'locale' },
68
+ },
69
+ {
70
+ definition: {
71
+ id: 'currencyAtom',
72
+ factory: ({ fusion, config }) =>
73
+ createFusionAtomFactory({ fusion })({
74
+ path: `private.currency`,
75
+ defaultValue: config.defaultValue,
76
+ }),
77
+ dependencies: ['fusion', 'config'],
78
+ },
79
+ },
80
+ // TODO: move to @exodus/market-history
81
+ {
82
+ definition: {
83
+ id: 'marketHistoryClearCacheAtom',
84
+ factory: ({ config }) => createInMemoryAtom(config),
85
+ dependencies: ['config'],
86
+ },
87
+ },
88
+ // TODO: move to @exodus/market-history
89
+ {
90
+ definition: {
91
+ id: 'remoteConfigClearMarketHistoryCacheAtom',
92
+ factory: ({ config, remoteConfig }) =>
93
+ createRemoteConfigAtomFactory({ remoteConfig })(config),
94
+ dependencies: ['config', 'remoteConfig'],
95
+ },
96
+ },
97
+ // TODO: move to @exodus/market-history
98
+ {
99
+ definition: {
100
+ id: 'marketHistoryRefreshIntervalAtom',
101
+ factory: ({ config, remoteConfig }) =>
102
+ createRemoteConfigAtomFactory({ remoteConfig })(config),
103
+ dependencies: ['config', 'remoteConfig'],
104
+ },
105
+ },
106
+ { definition: balancesAtomDefinition },
107
+ ].map(withType('atom'))
4
108
 
5
109
  export default createAtomDependencies
@@ -3,12 +3,13 @@
3
3
 
4
4
  import assert from 'minimalistic-assert'
5
5
 
6
+ import createConfigDependencies from './configs'
6
7
  import createAdapterDependencies from './adapters'
7
8
  import createAtomDependencies from './atoms'
8
- import createConfigDependencies from './configs'
9
9
  import createModuleDependencies from './modules'
10
- import createPluginDependencies from './plugins'
10
+ import createMonitorDependencies from './monitors'
11
11
  import { wrapConstant } from './utils'
12
+ import createPluginDependencies from './plugins'
12
13
 
13
14
  const adapterKeys = [
14
15
  // ...
@@ -33,6 +34,8 @@ const createDependencies = ({ adapters, config }) => {
33
34
 
34
35
  const modules = createModuleDependencies({ adapters, config })
35
36
 
37
+ const monitors = createMonitorDependencies({ adapters, config })
38
+
36
39
  const atoms = createAtomDependencies({ adapters, config })
37
40
 
38
41
  const adaptersTree = createAdapterDependencies({ adapters, config })
@@ -43,6 +46,7 @@ const createDependencies = ({ adapters, config }) => {
43
46
  .concat(adaptersTree)
44
47
  .concat(configs)
45
48
  .concat(modules)
49
+ .concat(monitors)
46
50
  .concat(atoms)
47
51
  .concat(plugins)
48
52
  .concat(wrapConstant({ id: 'logger', type: 'module', value: logger }))