@exodus/headless 2.0.0-alpha.39 → 2.0.0-alpha.4

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/src/api.js CHANGED
@@ -1,48 +1,13 @@
1
1
  import { validateMnemonic as isMnemonicValid } from 'bip39'
2
2
 
3
3
  const createApi = ({ ioc, port }) => {
4
- const { assetsModule } = ioc.getByType('adapter')
4
+ const { passphraseCache } = ioc.getByType('adapter')
5
5
 
6
- const {
7
- addressProvider,
8
- application,
9
- blockchainMetadata,
10
- connectedOrigins,
11
- enabledAssets,
12
- kyc,
13
- nfts,
14
- personalNotes,
15
- referrals,
16
- remoteConfig,
17
- wallet,
18
- walletAccounts,
19
- } = ioc.getByType('module')
20
-
21
- const { feeMonitors, ratesMonitor, nftsMonitor } = ioc.getByType('monitor')
22
- // TODO: decide where this belongs
23
- const { passphraseCache } = ioc.getAll()
24
-
25
- const {
26
- // ...
27
- currencyAtom,
28
- enabledWalletAccountsAtom,
29
- languageAtom,
30
- connectedOriginsAtom,
31
- } = ioc.getByType('atom')
32
-
33
- // TODO: do this on 'unload'
34
- const stop = () => {
35
- kyc.stop()
36
- referrals.stop()
37
- remoteConfig.stop()
38
- feeMonitors.stop()
39
- nftsMonitor.stop()
40
- }
6
+ const { application, wallet } = ioc.getByType('module')
41
7
 
42
8
  return {
43
9
  wallet: {
44
10
  exists: () => wallet.exists(),
45
- start: application.start,
46
11
  load: application.load,
47
12
  unload: application.unload,
48
13
  create: application.create,
@@ -62,85 +27,9 @@ const createApi = ({ ioc, port }) => {
62
27
  changeLockTimer: application.changeLockTimer,
63
28
  isLocked: () => wallet.isLocked(),
64
29
  },
65
- walletAccounts: {
66
- create: walletAccounts.create,
67
- update: walletAccounts.update,
68
- disable: walletAccounts.disable,
69
- enable: walletAccounts.enable,
70
- getEnabled: enabledWalletAccountsAtom.get,
71
- },
72
- blockchainMetadata: {
73
- getTxLog: blockchainMetadata.getTxLog,
74
- getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
75
- updateTxs: blockchainMetadata.updateTxs,
76
- overwriteTxs: blockchainMetadata.overwriteTxs,
77
- clearTxs: blockchainMetadata.clearTxs,
78
- removeTxs: blockchainMetadata.removeTxs,
79
- getAccountState: blockchainMetadata.getAccountState,
80
- getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
81
- updateAccountState: blockchainMetadata.updateAccountState,
82
- removeAccountState: blockchainMetadata.removeAccountState,
83
- batch: blockchainMetadata.batch,
84
- },
85
- assets: {
86
- enable: enabledAssets.enable,
87
- disable: enabledAssets.disable,
88
- addAndEnableToken: async (...args) => {
89
- const asset = await assetsModule.addToken(...args)
90
- await enabledAssets.enable([asset.name])
91
- return asset.name
92
- },
93
- },
94
- remoteConfig: {
95
- get: remoteConfig.get,
96
- getAll: remoteConfig.getAll,
97
- },
98
- locale: {
99
- setLanguage: (value) => languageAtom.set(value),
100
- setCurrency: (value) => currencyAtom.set(value),
101
- },
102
- rates: {
103
- refresh: () => ratesMonitor.update(),
104
- },
105
- addressProvider: {
106
- getAddress: addressProvider.getAddress.bind(addressProvider),
107
- getSupportedPurposes: addressProvider.getSupportedPurposes.bind(addressProvider),
108
- getReceiveAddress: addressProvider.getReceiveAddress.bind(addressProvider),
109
- },
110
- kyc: {
111
- start: kyc.start,
112
- sync: kyc.sync,
113
- requestKycToken: kyc.requestKycToken,
114
- },
115
- referrals: {
116
- setReferredBy: referrals.setReferredBy,
117
- referralCodeExists: referrals.referralCodeExists,
118
- },
119
- personalNotes: {
120
- upsert: personalNotes.upsert,
121
- },
122
- nfts: {
123
- upsertConfig: nfts.upsertConfig,
124
- setMonitorInterval: nftsMonitor.setInterval,
125
- },
126
- connectedOrigins: {
127
- get: connectedOriginsAtom.get,
128
- add: connectedOrigins.add,
129
- clear: connectedOrigins.clear,
130
- untrust: connectedOrigins.untrust,
131
- isTrusted: connectedOrigins.isTrusted,
132
- isAutoApprove: connectedOrigins.isAutoApprove,
133
- setFavorite: connectedOrigins.setFavorite,
134
- setAutoApprove: connectedOrigins.setAutoApprove,
135
- connect: connectedOrigins.connect,
136
- disconnect: connectedOrigins.disconnect,
137
- updateConnection: connectedOrigins.updateConnection,
138
- clearConnections: connectedOrigins.clearConnections,
139
- },
140
30
  isMnemonicValid,
141
31
  subscribe: port.subscribe.bind(port),
142
32
  unsubscribe: port.unsubscribe.bind(port),
143
- stop,
144
33
  }
145
34
  }
146
35
 
@@ -17,25 +17,23 @@ const IMPORT_FLAG = 'importFlag'
17
17
  // Set as true on import method is called, and set to false after restore is completed
18
18
  const RESTORE_FLAG = 'restoreFlag'
19
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',
20
+ const HOOKS = 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
+ 'restore-completed': 'restore-completed',
33
+ 'assets-synced': 'assets-synced',
34
+ 'change-passphrase': 'change-passphrase',
35
35
  })
36
36
 
37
- const HOOKS = new Set(Object.values(Hook))
38
-
39
37
  class Application extends ExodusModule {
40
38
  #hooks = {}
41
39
  #wallet = null
@@ -52,7 +50,6 @@ class Application extends ExodusModule {
52
50
  this.#storage = unsafeStorage.namespace('flags')
53
51
 
54
52
  this.#applicationStarted = new Promise((resolve) => (this.#resolveStart = resolve))
55
- this.setMaxListeners(Number.POSITIVE_INFINITY)
56
53
  }
57
54
 
58
55
  start = async () => {
@@ -66,31 +63,12 @@ class Application extends ExodusModule {
66
63
  if (isDeleting || isImporting) {
67
64
  await this.#storage.batchDelete([DELETE_FLAG, IMPORT_FLAG])
68
65
  await this.#passphraseCache.clear()
66
+ await this.fire(HOOKS.clear)
69
67
  }
70
68
 
71
- const walletExists = await this.#wallet.exists()
72
-
73
- if (isImporting || !walletExists) {
74
- await this.fire(Hook.Clear)
75
- }
76
-
77
- if (isImporting) await this.fire(Hook.Import)
78
-
79
- const [hasPassphraseSet, isLocked, isBackedUp, isRestoring] = await Promise.all([
80
- this.#wallet.hasPassphraseSet(),
81
- this.#wallet.isLocked(),
82
- this.#wallet.isBackedUp(),
83
- this.isRestoring(),
84
- ])
85
-
86
- await this.fire(Hook.Start, {
87
- walletExists,
88
- hasPassphraseSet,
89
- isLocked,
90
- isBackedUp,
91
- isRestoring,
92
- })
69
+ if (isImporting) await this.fire(HOOKS.import)
93
70
 
71
+ await this.fire(HOOKS.start)
94
72
  await this.#autoUnlock()
95
73
 
96
74
  const locked = await this.#wallet.isLocked()
@@ -110,7 +88,7 @@ class Application extends ExodusModule {
110
88
  this.isRestoring(),
111
89
  ])
112
90
 
113
- await this.fire(Hook.Load, {
91
+ await this.fire(HOOKS.load, {
114
92
  walletExists,
115
93
  hasPassphraseSet,
116
94
  isLocked,
@@ -121,11 +99,11 @@ class Application extends ExodusModule {
121
99
  unload = async () => {
122
100
  await this.#applicationStarted
123
101
  await this.#passphraseCache.scheduleClear()
124
- await this.fire(Hook.Unload)
102
+ await this.fire(HOOKS.unload)
125
103
  }
126
104
 
127
105
  hook = (hookName, listener) => {
128
- assert(HOOKS.has(hookName), `no such hook: ${hookName}`)
106
+ assert(HOOKS[hookName], `no such hook: ${hookName}`)
129
107
 
130
108
  if (!this.#hooks[hookName]) {
131
109
  this.#hooks[hookName] = []
@@ -135,7 +113,7 @@ class Application extends ExodusModule {
135
113
  }
136
114
 
137
115
  fire = async (hookName, params) => {
138
- assert(HOOKS.has(hookName), `no such hook: ${hookName}`)
116
+ assert(HOOKS[hookName], `no such hook: ${hookName}`)
139
117
  this._logger.debug('firing hooks', hookName)
140
118
 
141
119
  const hooks = this.#hooks[hookName] || []
@@ -153,15 +131,7 @@ class Application extends ExodusModule {
153
131
  await this.#applicationStarted
154
132
  await this.#wallet.create(opts)
155
133
 
156
- const isLocked = await this.#wallet.isLocked()
157
-
158
- await this.fire(Hook.Create, {
159
- hasPassphraseSet: !!opts?.passphrase,
160
- isBackedUp: false,
161
- isLocked,
162
- isRestoring: false,
163
- walletExists: true,
164
- })
134
+ await this.fire(HOOKS.create, { hasPassphraseSet: !!opts?.passphrase })
165
135
  }
166
136
 
167
137
  import = async (opts) => {
@@ -171,28 +141,26 @@ class Application extends ExodusModule {
171
141
 
172
142
  await this.#applicationStarted
173
143
 
174
- const walletExists = await this.#wallet.exists()
175
-
176
- const { forceRestart, ...wallet } = opts
177
-
178
- await this.#wallet.import(wallet)
179
-
180
- if (forceRestart || walletExists) {
144
+ if (await this.#wallet.exists()) {
145
+ await this.#wallet.import(opts)
181
146
  await this.#storage.set(IMPORT_FLAG, true)
182
147
 
183
148
  this.emit('restart', { reason: 'import' })
184
- } else {
185
- await this.fire(Hook.Import)
186
149
 
187
- this._logger.log('wallet imported')
150
+ return
188
151
  }
152
+
153
+ await this.#wallet.import(opts)
154
+ await this.fire(HOOKS.import)
155
+
156
+ this._logger.log('wallet imported')
189
157
  }
190
158
 
191
159
  getMnemonic = async (opts) => this.#wallet.getMnemonic(opts)
192
160
 
193
161
  setBackedUp = async () => {
194
162
  await this.#wallet.setBackedUp()
195
- await this.fire(Hook.Backup)
163
+ await this.fire(HOOKS.backup)
196
164
  }
197
165
 
198
166
  lock = async (opts) => {
@@ -201,7 +169,7 @@ class Application extends ExodusModule {
201
169
  await this.#applicationStarted
202
170
  await this.#wallet.lock(opts)
203
171
  await this.#passphraseCache.clear()
204
- await this.fire(Hook.Lock)
172
+ await this.fire(HOOKS.lock)
205
173
 
206
174
  this._logger.log('locked')
207
175
  }
@@ -210,13 +178,13 @@ class Application extends ExodusModule {
210
178
  const isRestoring = await this.isRestoring()
211
179
 
212
180
  if (isRestoring) {
213
- await this.fire(Hook.Restore)
181
+ await this.fire(HOOKS.restore)
214
182
  await this.#storage.delete(RESTORE_FLAG)
215
183
  await this.setBackedUp()
216
- await this.fire(Hook.RestoreCompleted)
184
+ await this.fire(HOOKS['restore-completed'])
217
185
  }
218
186
 
219
- this.fire(Hook.AssetsSynced)
187
+ this.fire(HOOKS['assets-synced'])
220
188
  }
221
189
 
222
190
  #autoUnlock = async () => {
@@ -229,7 +197,7 @@ class Application extends ExodusModule {
229
197
  this._logger.log('unlocking with cache')
230
198
 
231
199
  await this.#wallet.unlock({ passphrase })
232
- await this.fire(Hook.Unlock)
200
+ await this.fire(HOOKS.unlock)
233
201
 
234
202
  this.#restoreIfNeeded()
235
203
 
@@ -245,8 +213,8 @@ class Application extends ExodusModule {
245
213
  await this.#applicationStarted
246
214
  await this.#wallet.unlock({ passphrase })
247
215
 
248
- await this.fire(Hook.Migrate)
249
- await this.fire(Hook.Unlock)
216
+ await this.fire(HOOKS.migrate)
217
+ await this.fire(HOOKS.unlock)
250
218
 
251
219
  this.#restoreIfNeeded()
252
220
 
@@ -261,7 +229,7 @@ class Application extends ExodusModule {
261
229
  await this.#applicationStarted
262
230
  await this.#wallet.changePassphrase({ currentPassphrase, newPassphrase })
263
231
  await this.#passphraseCache.set(newPassphrase)
264
- await this.fire(Hook.ChangePassphrase)
232
+ await this.fire(HOOKS['change-passphrase'])
265
233
 
266
234
  this._logger.log('passphrase changed')
267
235
  }
@@ -1,34 +1,4 @@
1
- import { apyRatesAtomDefinition } from '@exodus/apy-rates/atoms'
2
- import {
3
- createFusionAtomFactory,
4
- createInMemoryAtom,
5
- createRemoteConfigAtomFactory,
6
- createStorageAtomFactory,
7
- } from '@exodus/atoms'
8
- import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
9
- import { balancesAtomDefinition } from '@exodus/balances/atoms'
10
- import { connectedOriginsAtomDefinition } from '@exodus/connected-origins/atoms'
11
- import { cryptoNewsAtomDefinition } from '@exodus/crypto-news-monitor/atoms'
12
- import {
13
- enabledAndDisabledAssetsAtomDefinition,
14
- enabledAssetsAtomDefinition,
15
- } from '@exodus/enabled-assets/atoms'
16
- import { featureFlagsAtomDefinition } from '@exodus/feature-flags/atoms'
17
- import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
18
- import { kycAtomDefinition } from '@exodus/kyc/atoms'
19
- import { nftsCacheAtomDefinition, nftsConfigsAtomDefinition } from '@exodus/nfts/atoms'
20
- import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
21
- import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
22
- import { referralsAtomDefinition } from '@exodus/referrals/atoms'
23
- import { topMoversAtomDefinition } from '@exodus/top-movers-monitor/atoms'
24
- import {
25
- enabledWalletAccountsAtomDefinition,
26
- walletAccountsAtomDefinition,
27
- } from '@exodus/wallet-accounts/atoms'
28
-
29
- import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
30
- import nonDustBalanceAssetNamesAtomDefinition from '../atoms/non-dust-balance-asset-names-atom'
31
- import restoreAtomDefinition from '../atoms/restore'
1
+ import { createInMemoryAtom } from '@exodus/atoms'
32
2
  import { withType } from './utils'
33
3
 
34
4
  const createAtomDependencies = () =>
@@ -40,145 +10,6 @@ const createAtomDependencies = () =>
40
10
  dependencies: [],
41
11
  },
42
12
  },
43
- {
44
- definition: walletAccountsAtomDefinition,
45
- storage: { namespace: 'walletAccounts' },
46
- },
47
- { definition: enabledWalletAccountsAtomDefinition },
48
- {
49
- definition: enabledAndDisabledAssetsAtomDefinition,
50
- storage: { namespace: 'enabledAssets' },
51
- },
52
- { definition: enabledAssetsAtomDefinition },
53
- { definition: availableAssetNamesAtomDefinition },
54
- {
55
- definition: nonDustBalanceAssetNamesAtomDefinition,
56
- },
57
- {
58
- definition: {
59
- id: 'pricingServerUrlAtom',
60
- factory: ({ config, remoteConfig }) =>
61
- createRemoteConfigAtomFactory({ remoteConfig })({
62
- path: config.pricingServerPath,
63
- defaultValue: config.defaultPricingServerUrl,
64
- }),
65
- dependencies: ['config', 'remoteConfig'],
66
- },
67
- },
68
- {
69
- definition: {
70
- id: 'languageAtom',
71
- factory: ({ storage, config }) =>
72
- createStorageAtomFactory({ storage })({
73
- key: 'language',
74
- defaultValue: config.defaultValue,
75
- isSoleWriter: true,
76
- }),
77
- dependencies: ['storage', 'config'],
78
- },
79
- aliases: [
80
- {
81
- implementationId: 'unsafeStorage',
82
- interfaceId: 'storage',
83
- },
84
- ],
85
- storage: { namespace: 'locale' },
86
- },
87
- {
88
- definition: {
89
- id: 'currencyAtom',
90
- factory: ({ fusion, config }) =>
91
- createFusionAtomFactory({ fusion })({
92
- path: `private.currency`,
93
- defaultValue: config.defaultValue,
94
- }),
95
- dependencies: ['fusion', 'config'],
96
- },
97
- },
98
- // TODO: move to @exodus/market-history
99
- {
100
- definition: {
101
- id: 'marketHistoryClearCacheAtom',
102
- factory: ({ config }) => createInMemoryAtom(config),
103
- dependencies: ['config'],
104
- },
105
- },
106
- // TODO: move to @exodus/market-history
107
- {
108
- definition: {
109
- id: 'remoteConfigClearMarketHistoryCacheAtom',
110
- factory: ({ config, remoteConfig }) =>
111
- createRemoteConfigAtomFactory({ remoteConfig })(config),
112
- dependencies: ['config', 'remoteConfig'],
113
- },
114
- },
115
- // TODO: move to @exodus/market-history
116
- {
117
- definition: {
118
- id: 'marketHistoryRefreshIntervalAtom',
119
- factory: ({ config, remoteConfig }) =>
120
- createRemoteConfigAtomFactory({ remoteConfig })(config),
121
- dependencies: ['config', 'remoteConfig'],
122
- },
123
- },
124
- {
125
- definition: {
126
- id: 'mockConfigAtom',
127
- factory: ({ storage }) =>
128
- createStorageAtomFactory({ storage })({
129
- key: 'mockConfig',
130
- defaultValue: {},
131
- isSoleWriter: true,
132
- }),
133
- dependencies: ['storage'],
134
- },
135
- storage: { namespace: 'mockConfig' },
136
- aliases: [
137
- {
138
- implementationId: 'unsafeStorage',
139
- interfaceId: 'storage',
140
- },
141
- ],
142
- },
143
- { definition: balancesAtomDefinition },
144
- { definition: ratesAtomDefinition },
145
- { definition: geolocationAtomDefinition },
146
- { definition: featureFlagsAtomDefinition },
147
- { definition: kycAtomDefinition },
148
- { definition: referralsAtomDefinition },
149
- {
150
- definition: personalNotesAtomDefinition,
151
- aliases: [
152
- {
153
- implementationId: 'personalNotesStorage',
154
- interfaceId: 'storage',
155
- },
156
- ],
157
- },
158
- {
159
- definition: connectedOriginsAtomDefinition,
160
- storage: { namespace: 'connectedOrigins' },
161
- aliases: [
162
- {
163
- implementationId: 'unsafeStorage',
164
- interfaceId: 'storage',
165
- },
166
- ],
167
- },
168
- { definition: baseAssetNamesToMonitorAtomDefinition },
169
- { definition: topMoversAtomDefinition },
170
- { definition: cryptoNewsAtomDefinition },
171
- { definition: restoreAtomDefinition },
172
- { definition: apyRatesAtomDefinition },
173
- {
174
- definition: nftsCacheAtomDefinition,
175
- storage: { namespace: 'nftsCache' },
176
- },
177
- {
178
- definition: nftsConfigsAtomDefinition,
179
- aliases: [{ implementationId: 'unsafeStorage', interfaceId: 'storage' }],
180
- storage: { namespace: 'nfts-config' },
181
- },
182
13
  ].map(withType('atom'))
183
14
 
184
15
  export default createAtomDependencies
@@ -3,13 +3,10 @@
3
3
 
4
4
  import assert from 'minimalistic-assert'
5
5
 
6
+ import createConfigDependencies from './configs'
6
7
  import createAdapterDependencies from './adapters'
7
- import createAtomCollectionDependencies from './atom-collections'
8
8
  import createAtomDependencies from './atoms'
9
- import createConfigDependencies from './configs'
10
9
  import createModuleDependencies from './modules'
11
- import createMonitorDependencies from './monitors'
12
- import createPluginDependencies from './plugins'
13
10
  import { wrapConstant } from './utils'
14
11
 
15
12
  const adapterKeys = [
@@ -19,9 +16,6 @@ const adapterKeys = [
19
16
  'legacyPrivToPub',
20
17
  'seedStorage',
21
18
  'unsafeStorage',
22
- 'fusion',
23
- 'fetch',
24
- 'freeze',
25
19
  ]
26
20
 
27
21
  const createDependencies = ({ adapters, config }) => {
@@ -35,24 +29,15 @@ const createDependencies = ({ adapters, config }) => {
35
29
 
36
30
  const modules = createModuleDependencies({ adapters, config })
37
31
 
38
- const monitors = createMonitorDependencies({ adapters, config })
39
-
40
32
  const atoms = createAtomDependencies({ adapters, config })
41
33
 
42
- const atomCollections = createAtomCollectionDependencies({ adapters, config })
43
-
44
34
  const adaptersTree = createAdapterDependencies({ adapters, config })
45
35
 
46
- const plugins = createPluginDependencies()
47
-
48
36
  return []
49
37
  .concat(adaptersTree)
50
38
  .concat(configs)
51
39
  .concat(modules)
52
- .concat(monitors)
53
40
  .concat(atoms)
54
- .concat(atomCollections)
55
- .concat(plugins)
56
41
  .concat(wrapConstant({ id: 'logger', type: 'module', value: logger }))
57
42
  }
58
43
 
@@ -1,28 +1,12 @@
1
- import createAddressProviderDependencies from '@exodus/address-provider'
2
- import availableAssetsModuleDefinition from '@exodus/available-assets/module'
3
- import balancesDefinition from '@exodus/balances/module'
4
- import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
5
- import createRemoteConfig from '@exodus/config/remote'
6
- import connectedOriginsDefinition from '@exodus/connected-origins/module'
7
- import enabledAssetsModuleDefinition from '@exodus/enabled-assets/module'
8
- import createExodusPricingClient from '@exodus/exodus-pricing-client'
9
- import featureFlagsDefinition from '@exodus/feature-flags/module'
10
- import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
11
- import keychainDefinition from '@exodus/keychain/module'
12
- import kycDefinition from '@exodus/kyc/module'
13
- import nftsModuleDefinition from '@exodus/nfts/module'
14
- import personalNotesDefinition from '@exodus/personal-notes/module'
15
- import referralsDefinition from '@exodus/referrals/module'
1
+ import { createKeychain } from '@exodus/keychain'
16
2
  import walletDefinition from '@exodus/wallet/module'
17
- import walletAccountsDefinition from '@exodus/wallet-accounts/module'
3
+ import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
18
4
  import walletCompatibilityModesDefinition from '@exodus/wallet-compatibility-modes/module'
19
- import EventEmitter from 'events/'
20
5
 
21
6
  import createApplication from '../application'
22
- import unlockEncryptedStorageDefinition from '../unlock-encrypted-storage'
23
7
  import { withType } from './utils'
24
8
 
25
- const createModuleDependencies = ({ config }) =>
9
+ const createModuleDependencies = () =>
26
10
  [
27
11
  {
28
12
  definition: {
@@ -38,71 +22,18 @@ const createModuleDependencies = ({ config }) =>
38
22
  dependencies: [],
39
23
  },
40
24
  },
41
- {
42
- definition: keychainDefinition,
43
- },
44
- {
45
- definition: walletDefinition,
46
- writesAtoms: ['lockedAtom'],
47
- },
48
- {
49
- definition: walletCompatibilityModesDefinition,
50
- },
51
- { definition: unlockEncryptedStorageDefinition },
52
- { definition: walletAccountsDefinition, writesAtoms: ['walletAccountsAtom'] },
53
- {
54
- definition: blockchainMetadataDefinition,
55
- storage: { namespace: ['blockchain', 'v1'] },
56
- },
57
- { definition: enabledAssetsModuleDefinition, writesAtoms: ['enabledAndDisabledAssetsAtom'] },
58
- {
59
- definition: {
60
- id: 'remoteConfig',
61
- factory: (deps) => {
62
- const eventEmitter = new EventEmitter().setMaxListeners(Number.POSITIVE_INFINITY)
63
- return createRemoteConfig({ eventEmitter, ...deps })
64
- },
65
- dependencies: ['fetch', 'freeze', 'config', 'logger'],
66
- },
67
- },
68
- { definition: availableAssetsModuleDefinition, writesAtoms: ['availableAssetNamesAtom'] },
69
25
  {
70
26
  definition: {
71
- id: 'pricingClient',
72
- factory: createExodusPricingClient,
73
- dependencies: ['fetch', 'pricingServerUrlAtom'],
27
+ id: 'keychain',
28
+ factory: createKeychain,
29
+ dependencies: ['legacyPrivToPub'],
74
30
  },
75
31
  },
76
- { definition: balancesDefinition, writesAtoms: ['balancesAtom'] },
77
- {
78
- definition: featureFlagsDefinition,
79
- writesAtoms: ['featureFlagAtoms'],
80
- },
81
- ...createAddressProviderDependencies(config.addressProvider),
82
- {
83
- definition: kycDefinition,
84
- writesAtoms: ['kycAtom'],
85
- },
86
32
  {
87
- definition: referralsDefinition,
88
- storage: { namespace: 'referrals' },
89
- writesAtoms: ['referralsAtom'],
90
- aliases: [
91
- {
92
- implementationId: 'unsafeStorage',
93
- interfaceId: 'storage',
94
- },
95
- ],
96
- },
97
- {
98
- definition: personalNotesDefinition,
99
- },
100
- {
101
- definition: connectedOriginsDefinition,
102
- writesAtoms: ['connectedOriginsAtom'],
33
+ definition: walletDefinition,
103
34
  },
104
35
  {
105
- definition: nftsModuleDefinition,
36
+ definition: walletCompatibilityModesDefinition,
106
37
  },
107
38
  ].map(withType('module'))
108
39