@exodus/headless 2.0.0-alpha.55 → 2.0.0-alpha.57

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,36 @@
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.57](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.56...@exodus/headless@2.0.0-alpha.57) (2023-07-03)
7
+
8
+ ### Features
9
+
10
+ - log errors in application lifecycle hooks ([#2221](https://github.com/ExodusMovement/exodus-hydra/issues/2221)) ([6680b5a](https://github.com/ExodusMovement/exodus-hydra/commit/6680b5a5023376de29a02ac9864c207cc938f3b2))
11
+
12
+ ## [2.0.0-alpha.56](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.55...@exodus/headless@2.0.0-alpha.56) (2023-06-30)
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ - export feature definition from ab-testing (#2161)
17
+ - export feature definition from top-movers (#2165)
18
+ - export feature definition from kyc (#2167)
19
+ - export feature definition from crypto-news (#2163)
20
+ - export feature definition from apy-rates (#2162)
21
+ - export feature definition from address-provider (#2155)
22
+
23
+ ### Features
24
+
25
+ - export feature definition from ab-testing ([#2161](https://github.com/ExodusMovement/exodus-hydra/issues/2161)) ([e773c68](https://github.com/ExodusMovement/exodus-hydra/commit/e773c68ec6581cad508d8b7bd3d096edaa7878ef))
26
+ - export feature definition from address-provider ([#2155](https://github.com/ExodusMovement/exodus-hydra/issues/2155)) ([a4f8da3](https://github.com/ExodusMovement/exodus-hydra/commit/a4f8da39400bac23f3d84afdb56315b5a8a37567))
27
+ - export feature definition from apy-rates ([#2162](https://github.com/ExodusMovement/exodus-hydra/issues/2162)) ([693a953](https://github.com/ExodusMovement/exodus-hydra/commit/693a953cad357b60aabeb66edc95a60bacbaf6b5))
28
+ - export feature definition from crypto-news ([#2163](https://github.com/ExodusMovement/exodus-hydra/issues/2163)) ([fd46794](https://github.com/ExodusMovement/exodus-hydra/commit/fd46794de45fed3ed574fb47efe6f8256dceea4f))
29
+ - export feature definition from kyc ([#2167](https://github.com/ExodusMovement/exodus-hydra/issues/2167)) ([b655a26](https://github.com/ExodusMovement/exodus-hydra/commit/b655a26539decfd3fe4f219505eaace2c26a2e97))
30
+ - export feature definition from top-movers ([#2165](https://github.com/ExodusMovement/exodus-hydra/issues/2165)) ([b9183fa](https://github.com/ExodusMovement/exodus-hydra/commit/b9183fae78b521f0275d2fcab42ea6f1790aca94))
31
+
32
+ ### Bug Fixes
33
+
34
+ - delete backups when restart due to forgot passphrase ([#2144](https://github.com/ExodusMovement/exodus-hydra/issues/2144)) ([ba48906](https://github.com/ExodusMovement/exodus-hydra/commit/ba4890613b08f77986c74a4870fe29870f481233))
35
+
6
36
  ## [2.0.0-alpha.55](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.54...@exodus/headless@2.0.0-alpha.55) (2023-06-28)
7
37
 
8
38
  ### Bug Fixes
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.55",
4
- "description": "The headless Exodus wallet SDK",
5
- "author": "Exodus Movement Inc",
3
+ "version": "2.0.0-alpha.57",
4
+ "description": "The platform-agnostic Exodus wallet SDK",
5
+ "author": "Exodus Movement Inc.",
6
6
  "main": "src/index.js",
7
7
  "repository": {
8
8
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@exodus/ab-testing": "^5.1.2",
30
- "@exodus/address-provider": "^4.1.1",
30
+ "@exodus/address-provider": "^4.2.0",
31
31
  "@exodus/apy-rates": "^2.1.1",
32
- "@exodus/atoms": "^5.2.0",
32
+ "@exodus/atoms": "^5.2.1",
33
33
  "@exodus/auto-enable-assets-plugin": "^4.0.1",
34
34
  "@exodus/available-assets": "^2.0.2",
35
35
  "@exodus/balances": "^6.0.1",
@@ -42,7 +42,7 @@
42
42
  "@exodus/dependency-preprocessors": "^2.8.2",
43
43
  "@exodus/enabled-assets": "^6.0.2",
44
44
  "@exodus/exodus-pricing-client": "^1.2.0",
45
- "@exodus/feature-flags": "^2.1.2",
45
+ "@exodus/feature-flags": "^2.2.0",
46
46
  "@exodus/fee-monitors": "^1.0.0",
47
47
  "@exodus/fetch": "^1.2.1",
48
48
  "@exodus/fusion": "^6.0.0",
@@ -89,5 +89,5 @@
89
89
  "nock": "^13.3.1",
90
90
  "p-defer": "^4.0.0"
91
91
  },
92
- "gitHead": "74bde9d9f5bd441f35b7fe4d5b5098ed294dab44"
92
+ "gitHead": "7afd69339354cbb577cad4bba56442079270e25a"
93
93
  }
@@ -126,7 +126,12 @@ class Application extends ExodusModule {
126
126
  const hooks = this.#hooks[hookName] || []
127
127
 
128
128
  for (let i = 0; i < hooks.length; i++) {
129
- await hooks[i](params)
129
+ try {
130
+ await hooks[i](params)
131
+ } catch (err) {
132
+ this._logger.error(`application lifecycle hook failed: ${hookName}`, hooks[i], params)
133
+ throw err
134
+ }
130
135
  }
131
136
 
132
137
  this.emit(hookName, params)
@@ -158,7 +163,7 @@ class Application extends ExodusModule {
158
163
 
159
164
  const walletExists = await this.#wallet.exists()
160
165
 
161
- const { forceRestart, ...wallet } = opts
166
+ const { forceRestart, forgotPassphrase, ...wallet } = opts
162
167
 
163
168
  await this.#wallet.import(wallet)
164
169
 
@@ -251,9 +256,9 @@ class Application extends ExodusModule {
251
256
  this._logger.log('passphrase changed')
252
257
  }
253
258
 
254
- delete = async () => {
259
+ delete = async ({ forgotPassphrase } = {}) => {
255
260
  await this.#storage.set(DELETE_FLAG, true)
256
- await this.fire(Hook.Restart, { reason: 'delete' })
261
+ await this.fire(Hook.Restart, { reason: 'delete', forgotPassphrase })
257
262
  }
258
263
 
259
264
  changeLockTimer = async ({ ttl }) => {
package/src/index.js CHANGED
@@ -1,29 +1,29 @@
1
+ import abTesting from '@exodus/ab-testing'
2
+ import addressProvider from '@exodus/address-provider'
3
+ import apyRates from '@exodus/apy-rates'
1
4
  import { pick } from '@exodus/basic-utils'
5
+ import cryptoNews from '@exodus/crypto-news-monitor'
6
+ import kyc from '@exodus/kyc'
7
+ import topMovers from '@exodus/top-movers-monitor'
2
8
 
3
9
  import createApi from './api'
4
10
  import attachAtoms from './atoms/attach'
5
11
  import { atomsToAttach } from './constants'
6
12
  import createIOC from './ioc'
7
- import abTesting from './modules/ab-testing'
8
- import addressProvider from './modules/address-provider'
9
- import apyRates from './modules/apy-rates'
10
13
  import balances from './modules/balances'
11
14
  import blockchainMetadata from './modules/blockchain-metadata'
12
15
  import connectedOrigins from './modules/connected-origins'
13
- import cryptoNews from './modules/crypto-news'
14
16
  import enabledAssets from './modules/enabled-assets'
15
17
  import featureFlags from './modules/feature-flags'
16
18
  import fees from './modules/fees'
17
19
  import fiatBalances from './modules/fiat-balances'
18
20
  import geolocation from './modules/geolocation'
19
- import kyc from './modules/kyc'
20
21
  import locale from './modules/locale'
21
22
  import marketHistory from './modules/market-history'
22
23
  import nfts from './modules/nfts'
23
24
  import pricing from './modules/pricing'
24
25
  import rates from './modules/rates'
25
26
  import remoteConfig from './modules/remote-config'
26
- import topMovers from './modules/top-movers'
27
27
  import wallet from './modules/wallet'
28
28
  import walletAccounts from './modules/wallet-accounts'
29
29
  import attachPlugins from './plugins/attach'
@@ -1,13 +0,0 @@
1
- const abTestingApi = ({ abTesting }) => ({
2
- abTesting: {
3
- trackEvent: abTesting.trackEvent,
4
- updateVariant: abTesting.updateVariant,
5
- },
6
- })
7
-
8
- export default {
9
- id: 'abTestingApi',
10
- type: 'api',
11
- factory: abTestingApi,
12
- dependencies: ['abTesting'],
13
- }
@@ -1,26 +0,0 @@
1
- import { abTestingAtomDefinition } from '@exodus/ab-testing/atoms'
2
- import abTestingDefinition from '@exodus/ab-testing/module'
3
-
4
- import abTestingApiDefinition from './api'
5
- import abTestingPluginDefinition from './plugin'
6
-
7
- const abTesting = () => {
8
- return {
9
- id: 'abTesting',
10
- definitions: [
11
- {
12
- definition: abTestingAtomDefinition,
13
- storage: { namespace: 'abTesting' },
14
- aliases: [{ implementationId: 'unsafeStorage', interfaceId: 'storage' }],
15
- },
16
- {
17
- definition: abTestingDefinition,
18
- writesAtoms: ['abTestingAtom'],
19
- },
20
- { definition: abTestingPluginDefinition },
21
- { definition: abTestingApiDefinition },
22
- ],
23
- }
24
- }
25
-
26
- export default abTesting
@@ -1,21 +0,0 @@
1
- const abTestingLifecyclePlugin = ({ abTesting, featureFlagAtoms }) => {
2
- const onStart = async () => {
3
- featureFlagAtoms.abTesting?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- abTesting.load()
6
- })
7
- }
8
-
9
- const onClear = async () => {
10
- await abTesting.clear()
11
- }
12
-
13
- return { onStart, onClear }
14
- }
15
-
16
- export default {
17
- id: 'abTestingLifecyclePlugin',
18
- type: 'plugin',
19
- factory: abTestingLifecyclePlugin,
20
- dependencies: ['abTesting', 'featureFlagAtoms'],
21
- }
@@ -1,14 +0,0 @@
1
- const createAddressProviderApi = ({ addressProvider }) => ({
2
- addressProvider: {
3
- getAddress: addressProvider.getAddress.bind(addressProvider),
4
- getSupportedPurposes: addressProvider.getSupportedPurposes.bind(addressProvider),
5
- getReceiveAddress: addressProvider.getReceiveAddress.bind(addressProvider),
6
- },
7
- })
8
-
9
- export default {
10
- id: 'addressProviderApi',
11
- type: 'api',
12
- factory: createAddressProviderApi,
13
- dependencies: ['addressProvider'],
14
- }
@@ -1,15 +0,0 @@
1
- import createAddressProviderDependencies from '@exodus/address-provider'
2
-
3
- import { withType } from '../../dependencies/utils'
4
- import addressProviderApi from './api'
5
-
6
- const addressProvider = ({ config }) => {
7
- const dependencies = createAddressProviderDependencies(config).map(withType('module'))
8
-
9
- return {
10
- id: 'addressProvider',
11
- definitions: [...dependencies, { definition: addressProviderApi }],
12
- }
13
- }
14
-
15
- export default addressProvider
@@ -1,20 +0,0 @@
1
- import { apyRatesAtomDefinition } from '@exodus/apy-rates/atoms'
2
- import apyRatesMonitorDefinition from '@exodus/apy-rates/monitor'
3
-
4
- import apyRatesPlugin from './plugin'
5
-
6
- const apyRates = () => {
7
- return {
8
- id: 'apyRates',
9
- definitions: [
10
- {
11
- definition: apyRatesMonitorDefinition,
12
- writesAtoms: ['apyRatesAtom'],
13
- },
14
- { definition: apyRatesAtomDefinition },
15
- { definition: apyRatesPlugin },
16
- ],
17
- }
18
- }
19
-
20
- export default apyRates
@@ -1,14 +0,0 @@
1
- const createApyRatesLifecyclePlugin = ({ apyRatesMonitor }) => {
2
- const onUnlock = () => {
3
- apyRatesMonitor.start()
4
- }
5
-
6
- return { onUnlock }
7
- }
8
-
9
- export default {
10
- id: 'apyRatesLifecyclePlugin',
11
- type: 'plugin',
12
- factory: createApyRatesLifecyclePlugin,
13
- dependencies: ['apyRatesMonitor'],
14
- }
@@ -1,20 +0,0 @@
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
@@ -1,17 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
1
- const kycApi = ({ kyc }) => ({
2
- kyc: {
3
- start: kyc.start,
4
- sync: kyc.sync,
5
- requestKycToken: kyc.requestKycToken,
6
- },
7
- })
8
-
9
- export default {
10
- id: 'kycApi',
11
- type: 'api',
12
- factory: kycApi,
13
- dependencies: ['kyc'],
14
- }
@@ -1,19 +0,0 @@
1
- import { kycAtomDefinition } from '@exodus/kyc/atoms'
2
- import kycDefinition from '@exodus/kyc/module'
3
-
4
- import kycApi from './api'
5
- import kycPlugin from './plugin'
6
-
7
- const kyc = () => {
8
- return {
9
- id: 'kyc',
10
- definitions: [
11
- { definition: kycAtomDefinition },
12
- { definition: kycDefinition, writesAtoms: ['kycAtom'] },
13
- { definition: kycPlugin },
14
- { definition: kycApi },
15
- ],
16
- }
17
- }
18
-
19
- export default kyc
@@ -1,21 +0,0 @@
1
- const kycPlugin = ({ kyc, featureFlagAtoms }) => {
2
- const onUnlock = () => {
3
- featureFlagAtoms.referrals?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- kyc.load()
6
- })
7
- }
8
-
9
- const onUnload = () => {
10
- kyc.stop()
11
- }
12
-
13
- return { onUnlock, onUnload }
14
- }
15
-
16
- export default {
17
- id: 'kycLifecyclePlugin',
18
- type: 'plugin',
19
- factory: kycPlugin,
20
- dependencies: ['kyc', 'featureFlagAtoms'],
21
- }
@@ -1,23 +0,0 @@
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
@@ -1,17 +0,0 @@
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
- }