@exodus/headless 2.0.0 → 2.1.0

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,16 @@
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.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0...@exodus/headless@2.1.0) (2023-12-18)
7
+
8
+ ### Features
9
+
10
+ - add geolocation debug api ([#5000](https://github.com/ExodusMovement/exodus-hydra/issues/5000)) ([63f7420](https://github.com/ExodusMovement/exodus-hydra/commit/63f7420ac9f2dee98702691d382e6561310f31cc))
11
+ - **debug:** add clear and restart methods ([#5109](https://github.com/ExodusMovement/exodus-hydra/issues/5109)) ([77170cf](https://github.com/ExodusMovement/exodus-hydra/commit/77170cf42c261f18269f0d2de3091f7db752af2e))
12
+ - filesystem feature ([#5058](https://github.com/ExodusMovement/exodus-hydra/issues/5058)) ([1d3d85d](https://github.com/ExodusMovement/exodus-hydra/commit/1d3d85dc2e200954230305a0a6c0e36f35c79db2))
13
+ - **headless:** pass debug flag instead of using env build ([#5087](https://github.com/ExodusMovement/exodus-hydra/issues/5087)) ([f5be292](https://github.com/ExodusMovement/exodus-hydra/commit/f5be292047781c808173df377eaa43e590350a2e))
14
+ - **headless:** use debugger preprocessor ([#5088](https://github.com/ExodusMovement/exodus-hydra/issues/5088)) ([7e15717](https://github.com/ExodusMovement/exodus-hydra/commit/7e15717cb18dfa169e668bcdce6cde9a412c321d))
15
+
6
16
  ## [2.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.149...@exodus/headless@2.0.0) (2023-12-15)
7
17
 
8
18
  **Note:** Version bump only for package @exodus/headless
package/README.md CHANGED
@@ -195,6 +195,18 @@ An object with additional configuration options for the Exodus instance.
195
195
 
196
196
  Currently not used.
197
197
 
198
+ ## Debugging
199
+
200
+ Some features expose APIs for easy debugging, troubleshooting, and PR testing. You can access these APIs under exodus.debug. To enable them, simply pass debug: true to the headless factory function:
201
+
202
+ ```js
203
+ import createExodus from '@exodus/headless'
204
+
205
+ const exodusContainer = createExodus({ port, adapters, config, debug: true })
206
+
207
+ exodusContainer.debug.geolocation.merge({ countryCode: 'US' })
208
+ ```
209
+
198
210
  ## Headless API
199
211
 
200
212
  ### wallet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "The platform-agnostic Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "main": "src/index.js",
@@ -35,12 +35,13 @@
35
35
  "@exodus/basic-utils": "^2.0.0",
36
36
  "@exodus/blockchain-metadata": "^15.0.0",
37
37
  "@exodus/dependency-injection": "^2.1.0",
38
- "@exodus/dependency-preprocessors": "^4.0.0",
38
+ "@exodus/dependency-preprocessors": "^4.1.0",
39
39
  "@exodus/enabled-assets": "^9.0.1",
40
40
  "@exodus/feature-flags": "^5.1.0",
41
41
  "@exodus/fee-data-monitors": "^3.0.0",
42
42
  "@exodus/fetch": "^1.2.1",
43
- "@exodus/geolocation": "^3.0.0",
43
+ "@exodus/filesystem": "^1.1.0",
44
+ "@exodus/geolocation": "^3.1.0",
44
45
  "@exodus/hd-key-slip-10": "^2.0.0",
45
46
  "@exodus/key-identifier-provider": "^1.4.0",
46
47
  "@exodus/keychain": "^4.3.0",
@@ -80,7 +81,7 @@
80
81
  "@exodus/litecoin-meta": "^1.0.0",
81
82
  "@exodus/market-history": "^7.2.0",
82
83
  "@exodus/models": "^10.1.0",
83
- "@exodus/nfts": "^7.1.2",
84
+ "@exodus/nfts": "^7.1.4",
84
85
  "@exodus/personal-notes": "^3.6.0",
85
86
  "@exodus/referrals": "^8.0.1",
86
87
  "@exodus/solana-lib": "^1.3.11",
@@ -100,5 +101,5 @@
100
101
  "msw": "^2.0.0",
101
102
  "p-defer": "^4.0.0"
102
103
  },
103
- "gitHead": "a4af3e13c365318d2105d7d9c8ccfbfa2aa089a0"
104
+ "gitHead": "19a9d0cdb9f2b1a8dd9b1b4802f95bfafcd46c60"
104
105
  }
package/src/api/debug.js CHANGED
@@ -1,12 +1,20 @@
1
- const createApi = ({ ioc }) => {
2
- const { env } = ioc.getByType('adapter')
3
-
4
- if (!env || env.build !== 'development') return {}
1
+ const createApi = ({ ioc, port, debug }) => {
2
+ if (!debug) return {}
5
3
 
6
4
  const apis = ioc.getByType('debug')
7
5
 
6
+ const { unsafeStorage } = ioc.getByType('adapter')
7
+
8
+ const clear = async () => {
9
+ await unsafeStorage.namespace('debug').clear()
10
+ }
11
+
12
+ const restart = async () => {
13
+ port.emit('restart', { reason: 'debug' })
14
+ }
15
+
8
16
  return {
9
- debug: Object.assign({}, ...Object.values(apis)),
17
+ debug: Object.assign({}, ...Object.values(apis), { clear, restart }),
10
18
  }
11
19
  }
12
20
 
package/src/api/index.js CHANGED
@@ -3,12 +3,12 @@ import { validateMnemonic as isMnemonicValid } from 'bip39'
3
3
  import createDebug from './debug'
4
4
  import createReporting from './reporting'
5
5
 
6
- const createApi = ({ ioc, port, config }) => {
6
+ const createApi = ({ ioc, port, config, debug }) => {
7
7
  const apis = ioc.getByType('api')
8
8
 
9
9
  return {
10
10
  ...Object.assign({}, ...Object.values(apis)),
11
- ...createDebug({ ioc }),
11
+ ...createDebug({ ioc, port, debug }),
12
12
  ...createReporting({ ioc, config }),
13
13
  isMnemonicValid,
14
14
  subscribe: port.subscribe.bind(port),
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ import blockchainMetadata from '@exodus/blockchain-metadata'
6
6
  import enabledAssets from '@exodus/enabled-assets'
7
7
  import featureFlags from '@exodus/feature-flags'
8
8
  import fees from '@exodus/fee-data-monitors'
9
+ import filesystem from '@exodus/filesystem'
9
10
  import geolocation from '@exodus/geolocation'
10
11
  import keychain from '@exodus/keychain'
11
12
  import locale from '@exodus/locale'
@@ -24,8 +25,8 @@ import createIOC from './ioc'
24
25
  import attachMigrations from './migrations/attach'
25
26
  import attachPlugins from './plugins/attach'
26
27
 
27
- const createExodus = ({ adapters, config, port }) => {
28
- const ioc = createIOC({ adapters, config })
28
+ const createExodus = ({ adapters, config, port, debug = false }) => {
29
+ const ioc = createIOC({ adapters, config, debug })
29
30
 
30
31
  ioc.use(addressProvider({ config: config.addressProvider }))
31
32
  ioc.use(assetsFeature())
@@ -35,6 +36,7 @@ const createExodus = ({ adapters, config, port }) => {
35
36
  ioc.use(enabledAssets())
36
37
  ioc.use(featureFlags())
37
38
  ioc.use(fees())
39
+ ioc.use(filesystem())
38
40
  ioc.use(geolocation())
39
41
  ioc.use(keychain(config.keychain))
40
42
  ioc.use(locale())
@@ -119,7 +121,7 @@ const createExodus = ({ adapters, config, port }) => {
119
121
  logger: ioc.get('createLogger')('attachPlugins'),
120
122
  })
121
123
 
122
- return createApi({ ioc, port, config })
124
+ return createApi({ ioc, port, config, debug })
123
125
  }
124
126
 
125
127
  return { ...ioc, resolve }
package/src/ioc.js CHANGED
@@ -2,6 +2,7 @@ import createIocContainer from '@exodus/dependency-injection'
2
2
  import preprocess from '@exodus/dependency-preprocessors'
3
3
  import alias from '@exodus/dependency-preprocessors/src/preprocessors/alias'
4
4
  import configPreprocessor from '@exodus/dependency-preprocessors/src/preprocessors/config'
5
+ import debuggerPreprocessor from '@exodus/dependency-preprocessors/src/preprocessors/debugger'
5
6
  import devModeAtoms from '@exodus/dependency-preprocessors/src/preprocessors/dev-mode-atoms'
6
7
  import logify from '@exodus/dependency-preprocessors/src/preprocessors/logify'
7
8
  import namespaceStorage from '@exodus/dependency-preprocessors/src/preprocessors/namespace-storage'
@@ -12,8 +13,8 @@ import assert from 'minimalistic-assert'
12
13
 
13
14
  import createDependencies from './dependencies'
14
15
 
15
- const createIOC = ({ adapters, config }) => {
16
- const { createLogger, performance = {} } = adapters
16
+ const createIOC = ({ adapters, config, debug }) => {
17
+ const { createLogger, unsafeStorage, performance = {} } = adapters
17
18
  const {
18
19
  readOnlyAtoms: readOnlyAtomsConfig,
19
20
  devModeAtoms: devModeAtomsConfig,
@@ -48,6 +49,7 @@ const createIOC = ({ adapters, config }) => {
48
49
  }),
49
50
  optional(),
50
51
  devModeAtomsConfig && devModeAtoms(devModeAtomsConfig),
52
+ debuggerPreprocessor({ debug, unsafeStorage }),
51
53
  ].filter(Boolean)
52
54
 
53
55
  const registerMultiple = (dependencies) => {