@exodus/headless 2.0.0-alpha.19 → 2.0.0-alpha.2

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.
@@ -1,25 +0,0 @@
1
- import {
2
- featureFlagAtomsDefinition,
3
- remoteConfigFeatureFlagAtomsDefinition,
4
- } from '@exodus/feature-flags/atoms'
5
-
6
- import { withType } from './utils'
7
-
8
- const createAtomCollectionDependencies = () =>
9
- [
10
- {
11
- definition: remoteConfigFeatureFlagAtomsDefinition,
12
- },
13
- {
14
- definition: featureFlagAtomsDefinition,
15
- storage: { namespace: 'featureFlags' },
16
- aliases: [
17
- {
18
- implementationId: 'unsafeStorage',
19
- interfaceId: 'storage',
20
- },
21
- ],
22
- },
23
- ].map(withType('atom-collection'))
24
-
25
- export default createAtomCollectionDependencies
@@ -1,35 +0,0 @@
1
- import marketHistoryMonitorDefinition from '@exodus/market-history/module'
2
- import ratesMonitorDefinition from '@exodus/rates-monitor/module'
3
-
4
- import { withType } from './utils'
5
- import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
6
-
7
- const createMonitorDependencies = () =>
8
- [
9
- { definition: geolocationMonitorDefinition },
10
- {
11
- definition: 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
- { definition: ratesMonitorDefinition, writesAtoms: ['ratesAtom'] },
33
- ].map(withType('monitor'))
34
-
35
- export default createMonitorDependencies
@@ -1,7 +0,0 @@
1
- import plugins from '../plugins'
2
- import { withType } from './utils'
3
-
4
- const createPluginDependencies = () =>
5
- plugins.map((definition) => ({ definition })).map(withType('plugin'))
6
-
7
- export default createPluginDependencies
@@ -1,19 +0,0 @@
1
- import { kebabCase, memoize } from 'lodash'
2
-
3
- // e.g. onUnlock -> unlock -> onUnlock, onChangePassphrase -> change-passphrase
4
- const getApplicationHookName = memoize((lifecycleMethod) =>
5
- kebabCase(lifecycleMethod.replace(/^on/, ''))
6
- )
7
-
8
- const attachPlugins = ({ plugins, application }) => {
9
- Object.entries(plugins).forEach(([name, lifecycleMethods]) => {
10
- const entries = Object.entries(lifecycleMethods || {})
11
-
12
- for (const [lifecycleMethod, fn] of entries) {
13
- const hookName = getApplicationHookName(lifecycleMethod)
14
- application.hook(hookName, fn)
15
- }
16
- })
17
- }
18
-
19
- export default attachPlugins
@@ -1,3 +0,0 @@
1
- import logLifecyclePlugin from './log-lifecycle'
2
-
3
- export default [logLifecyclePlugin]
@@ -1,25 +0,0 @@
1
- const logLifecycle = {
2
- id: 'logLifecyclePlugin',
3
- type: 'plugin',
4
- factory: ({ logger }) => {
5
- return {
6
- onLock: () => logger.debug('onLock'),
7
- onUnlock: () => logger.debug('onUnlock'),
8
- onClear: () => logger.debug('onClear'),
9
- onImport: () => logger.debug('onImport'),
10
- onMigrate: () => logger.debug('onMigrate'),
11
- onStart: () => logger.debug('onStart'),
12
- onLoad: () => logger.debug('onLoad'),
13
- onUnload: () => logger.debug('onUnload'),
14
- onCreate: () => logger.debug('onCreate'),
15
- onBackup: () => logger.debug('onBackup'),
16
- onRestore: () => logger.debug('onRestore'),
17
- onRestoreCompleted: () => logger.debug('onRestoreCompleted'),
18
- onAssetsSynced: () => logger.debug('onAssetsSynced'),
19
- onChangePassphrase: () => logger.debug('onChangePassphrase'),
20
- }
21
- },
22
- dependencies: ['logger'],
23
- }
24
-
25
- export default logLifecycle
@@ -1,19 +0,0 @@
1
- import { EXODUS_KEY_IDS } from '@exodus/keychain/module'
2
-
3
- const createUnlockEncryptedStorage = ({ keychain }) => {
4
- return async (encryptedStorage) => {
5
- // should the key id be part of a `config` dep?
6
- const sodiumEncryptor = keychain.createSodiumEncryptor(EXODUS_KEY_IDS.WALLET_INFO)
7
-
8
- await encryptedStorage.unlock({
9
- encrypt: (data) => sodiumEncryptor.encryptSecretBox({ data }),
10
- decrypt: (data) => sodiumEncryptor.decryptSecretBox({ data }),
11
- })
12
- }
13
- }
14
-
15
- export default {
16
- id: 'unlockEncryptedStorage',
17
- factory: createUnlockEncryptedStorage,
18
- dependencies: ['keychain'],
19
- }
@@ -1,11 +0,0 @@
1
- export function createLoadWalletAccountsHandler({ port, blockchainMetadata }) {
2
- return async () => {
3
- const [txLogs, accountStates] = await Promise.all([
4
- blockchainMetadata.getLoadedTxLogs(),
5
- blockchainMetadata.getLoadedAccountStates(),
6
- ])
7
-
8
- port.emit('tx-logs', txLogs)
9
- port.emit('account-states', accountStates)
10
- }
11
- }