@exodus/headless 2.0.0-alpha.80 → 2.0.0-alpha.84

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 CHANGED
@@ -3,6 +3,39 @@
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.84](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.83...@exodus/headless@2.0.0-alpha.84) (2023-07-24)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - available-assets feature (#2831)
11
+
12
+ ### Features
13
+
14
+ - available-assets feature ([#2831](https://github.com/ExodusMovement/exodus-hydra/issues/2831)) ([ec082db](https://github.com/ExodusMovement/exodus-hydra/commit/ec082db68823ebc75bb1332ac2bc1c26f50dbccd))
15
+
16
+ ## [2.0.0-alpha.83](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.81...@exodus/headless@2.0.0-alpha.83) (2023-07-21)
17
+
18
+ ### ⚠ BREAKING CHANGES
19
+
20
+ - rates-monitor feature (#2829)
21
+ - ship headless without market history (#2827)
22
+
23
+ ### Features
24
+
25
+ - rates-monitor feature ([#2829](https://github.com/ExodusMovement/exodus-hydra/issues/2829)) ([52c3bbf](https://github.com/ExodusMovement/exodus-hydra/commit/52c3bbf4eb01a7ca750735786b6a9699748798dc))
26
+ - ship headless without market history ([#2827](https://github.com/ExodusMovement/exodus-hydra/issues/2827)) ([af70fdc](https://github.com/ExodusMovement/exodus-hydra/commit/af70fdc776612d41467bda953227501dd748b4a9))
27
+
28
+ ## [2.0.0-alpha.82](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.80...@exodus/headless@2.0.0-alpha.82) (2023-07-21)
29
+
30
+ ### ⚠ BREAKING CHANGES
31
+
32
+ - ship headless without market history (#2827)
33
+
34
+ ### Features
35
+
36
+ - attach atoms to load event ([#2814](https://github.com/ExodusMovement/exodus-hydra/issues/2814)) ([cd4605e](https://github.com/ExodusMovement/exodus-hydra/commit/cd4605ed17f48c34f59624c656933226e29f085a))
37
+ - ship headless without market history ([#2827](https://github.com/ExodusMovement/exodus-hydra/issues/2827)) ([af70fdc](https://github.com/ExodusMovement/exodus-hydra/commit/af70fdc776612d41467bda953227501dd748b4a9))
38
+
6
39
  ## [2.0.0-alpha.80](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.79...@exodus/headless@2.0.0-alpha.80) (2023-07-21)
7
40
 
8
41
  **Note:** Version bump only for package @exodus/headless
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.80",
3
+ "version": "2.0.0-alpha.84",
4
4
  "description": "The platform-agnostic Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "main": "src/index.js",
@@ -27,15 +27,15 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@exodus/address-provider": "^6.0.0",
30
- "@exodus/atoms": "^5.2.2",
30
+ "@exodus/atoms": "^5.2.3",
31
31
  "@exodus/auto-enable-assets-plugin": "^4.0.1",
32
- "@exodus/available-assets": "^2.0.2",
32
+ "@exodus/available-assets": "^3.0.0",
33
33
  "@exodus/balances": "^7.0.0",
34
34
  "@exodus/basic-utils": "^2.0.0",
35
35
  "@exodus/blockchain-metadata": "^9.0.0",
36
36
  "@exodus/config": "^7.0.0",
37
37
  "@exodus/dependency-injection": "^2.0.1",
38
- "@exodus/dependency-preprocessors": "^2.8.2",
38
+ "@exodus/dependency-preprocessors": "^2.8.4",
39
39
  "@exodus/enabled-assets": "^6.0.2",
40
40
  "@exodus/exodus-pricing-client": "^1.2.0",
41
41
  "@exodus/feature-flags": "^3.0.0",
@@ -45,9 +45,8 @@
45
45
  "@exodus/geolocation": "^2.1.1",
46
46
  "@exodus/key-identifier-provider": "^1.1.3",
47
47
  "@exodus/keychain": "^4.1.0",
48
- "@exodus/market-history": "^5.0.0",
49
48
  "@exodus/module": "^1.0.0",
50
- "@exodus/rates-monitor": "^2.0.1",
49
+ "@exodus/rates-monitor": "^3.0.0",
51
50
  "@exodus/restore-progress-tracker": "^2.0.4",
52
51
  "@exodus/wallet": "^8.1.0",
53
52
  "@exodus/wallet-accounts": "^10.1.0",
@@ -70,6 +69,7 @@
70
69
  "@exodus/ethereum-lib": "^2.22.2",
71
70
  "@exodus/ethereum-meta": "^1.0.23",
72
71
  "@exodus/kyc": "^4.0.0",
72
+ "@exodus/market-history": "^5.0.1",
73
73
  "@exodus/models": "^8.11.1",
74
74
  "@exodus/nfts": "^4.0.0",
75
75
  "@exodus/personal-notes": "^3.3.0",
@@ -90,5 +90,5 @@
90
90
  "nock": "^13.3.1",
91
91
  "p-defer": "^4.0.0"
92
92
  },
93
- "gitHead": "b4a1dded47c5fd28312d954d77a1ef9fb6177dbd"
93
+ "gitHead": "70c06485ee6ff0f9701a944113df345fef4c9571"
94
94
  }
@@ -7,24 +7,22 @@ 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, logger, atom, atomId, lifecycleEvents }) => {
10
+ const attachAtom = ({ port, application, atom, atomId }) => {
11
11
  let loaded = false
12
12
 
13
- lifecycleEvents.forEach((event) =>
14
- application.on(event, async () => {
15
- loaded = true
16
- await emitAtomValue({ port, atomId, atom })
17
- })
18
- )
13
+ application.on('load', async () => {
14
+ loaded = true
15
+ await emitAtomValue({ port, atomId, atom })
16
+ })
19
17
 
20
18
  atom.observe((value) => {
21
19
  if (loaded) emitAtomValue({ port, atomId, atom, value })
22
20
  })
23
21
  }
24
22
 
25
- const attachAtoms = ({ port, application, logger, atoms, lifecycleEvents = ['start'] }) => {
23
+ const attachAtoms = ({ port, application, atoms }) => {
26
24
  for (const [atomId, atom] of Object.entries(atoms)) {
27
- attachAtom({ port, application, logger, atom, atomId, lifecycleEvents })
25
+ attachAtom({ port, application, atom, atomId })
28
26
  }
29
27
  }
30
28
 
package/src/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import addressProvider from '@exodus/address-provider'
2
+ import availableAssets from '@exodus/available-assets'
2
3
  import balances from '@exodus/balances'
3
4
  import { pick } from '@exodus/basic-utils'
4
5
  import blockchainMetadata from '@exodus/blockchain-metadata'
5
6
  import featureFlags from '@exodus/feature-flags'
6
7
  import geolocation from '@exodus/geolocation'
7
8
  import keychain from '@exodus/keychain'
8
- import marketHistory from '@exodus/market-history'
9
+ import rates from '@exodus/rates-monitor'
9
10
  import restoreProgressTracker from '@exodus/restore-progress-tracker'
10
11
  import wallet from '@exodus/wallet'
11
12
  import walletAccounts from '@exodus/wallet-accounts'
@@ -13,19 +14,16 @@ import walletAccounts from '@exodus/wallet-accounts'
13
14
  import createApi from './api'
14
15
  import attachAtoms from './atoms/attach'
15
16
  import { atomsToAttach } from './constants'
16
- import availableAssets from './features/available-assets'
17
17
  import enabledAssets from './features/enabled-assets'
18
18
  import fees from './features/fees'
19
19
  import locale from './features/locale'
20
20
  import pricing from './features/pricing'
21
- import rates from './features/rates'
22
21
  import remoteConfig from './features/remote-config'
23
22
  import createIOC from './ioc'
24
23
  import attachPlugins from './plugins/attach'
25
24
 
26
25
  const createExodus = ({ adapters, config, port }) => {
27
26
  const ioc = createIOC({ adapters, config })
28
- const { headless: headlessConfig } = config
29
27
 
30
28
  ioc.use(wallet())
31
29
  ioc.use(keychain(config.keychain))
@@ -36,7 +34,6 @@ const createExodus = ({ adapters, config, port }) => {
36
34
  ioc.use(balances())
37
35
  ioc.use(remoteConfig())
38
36
  ioc.use(geolocation())
39
- ioc.use(marketHistory())
40
37
  ioc.use(pricing())
41
38
  ioc.use(fees())
42
39
  ioc.use(rates())
@@ -103,9 +100,7 @@ const createExodus = ({ adapters, config, port }) => {
103
100
  attachAtoms({
104
101
  port,
105
102
  application,
106
- logger: ioc.get('createLogger')('attachAtoms'),
107
103
  atoms: pick(ioc.getByType('atom'), atomsToAttach),
108
- lifecycleEvents: headlessConfig?.attachAtomsLifecycleEvents,
109
104
  })
110
105
 
111
106
  attachPlugins({
@@ -1,15 +0,0 @@
1
- import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
2
- import availableAssetsModuleDefinition from '@exodus/available-assets/module'
3
-
4
- const availableAssets = () => ({
5
- id: 'availableAssets',
6
- definitions: [
7
- {
8
- definition: { type: 'module', ...availableAssetsModuleDefinition },
9
- writesAtoms: ['availableAssetNamesAtom'],
10
- },
11
- { definition: availableAssetNamesAtomDefinition },
12
- ],
13
- })
14
-
15
- export default availableAssets
@@ -1,13 +0,0 @@
1
- const ratesApi = ({ ratesMonitor }) => ({
2
- rates: {
3
- refresh: () => ratesMonitor.update(),
4
- },
5
- })
6
-
7
- // eslint-disable-next-line @exodus/export-default/named
8
- export default {
9
- id: 'ratesApi',
10
- type: 'api',
11
- factory: ratesApi,
12
- dependencies: ['ratesMonitor'],
13
- }
@@ -1,22 +0,0 @@
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
@@ -1,18 +0,0 @@
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
- // eslint-disable-next-line @exodus/export-default/named
13
- export default {
14
- id: 'ratesLifecyclePlugin',
15
- type: 'plugin',
16
- factory: createRatesLifecyclePlugin,
17
- dependencies: ['ratesMonitor', 'port'],
18
- }