@exodus/headless 2.0.0 → 2.2.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 +23 -0
- package/README.md +12 -0
- package/package.json +12 -12
- package/src/api/debug.js +17 -6
- package/src/api/index.js +38 -4
- package/src/api/reporting.js +1 -5
- package/src/application.js +1 -1
- package/src/index.js +6 -4
- package/src/ioc.js +13 -6
- package/src/plugins/index.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.1.0...@exodus/headless@2.2.0) (2024-01-09)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add `autoEnableAssetsPlugin` to enabled-assets ([#5272](https://github.com/ExodusMovement/exodus-hydra/issues/5272)) ([92896c4](https://github.com/ExodusMovement/exodus-hydra/commit/92896c47e445c101ed10121614cea43b5b4350b3))
|
|
11
|
+
- **address-provider:** debug node ([#5126](https://github.com/ExodusMovement/exodus-hydra/issues/5126)) ([4ac0312](https://github.com/ExodusMovement/exodus-hydra/commit/4ac0312c7e5a3022a2b0be27f6621e26509fcf08))
|
|
12
|
+
- **nfts:** store nfts and txs in atoms ([#5227](https://github.com/ExodusMovement/exodus-hydra/issues/5227)) ([b94cf12](https://github.com/ExodusMovement/exodus-hydra/commit/b94cf12f2d980afa70f242b863964f0864a2b89e))
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **headless:** missed private function ([#5266](https://github.com/ExodusMovement/exodus-hydra/issues/5266)) ([c44abcb](https://github.com/ExodusMovement/exodus-hydra/commit/c44abcbd3f0fc2e9bffd86484246c891535b66d4))
|
|
17
|
+
- run preprocessors on all nodes ([#5154](https://github.com/ExodusMovement/exodus-hydra/issues/5154)) ([b36b481](https://github.com/ExodusMovement/exodus-hydra/commit/b36b4810af04233acf33911dd6013f7be17ac7b8))
|
|
18
|
+
|
|
19
|
+
## [2.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0...@exodus/headless@2.1.0) (2023-12-18)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- add geolocation debug api ([#5000](https://github.com/ExodusMovement/exodus-hydra/issues/5000)) ([63f7420](https://github.com/ExodusMovement/exodus-hydra/commit/63f7420ac9f2dee98702691d382e6561310f31cc))
|
|
24
|
+
- **debug:** add clear and restart methods ([#5109](https://github.com/ExodusMovement/exodus-hydra/issues/5109)) ([77170cf](https://github.com/ExodusMovement/exodus-hydra/commit/77170cf42c261f18269f0d2de3091f7db752af2e))
|
|
25
|
+
- filesystem feature ([#5058](https://github.com/ExodusMovement/exodus-hydra/issues/5058)) ([1d3d85d](https://github.com/ExodusMovement/exodus-hydra/commit/1d3d85dc2e200954230305a0a6c0e36f35c79db2))
|
|
26
|
+
- **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))
|
|
27
|
+
- **headless:** use debugger preprocessor ([#5088](https://github.com/ExodusMovement/exodus-hydra/issues/5088)) ([7e15717](https://github.com/ExodusMovement/exodus-hydra/commit/7e15717cb18dfa169e668bcdce6cde9a412c321d))
|
|
28
|
+
|
|
6
29
|
## [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
30
|
|
|
8
31
|
**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.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The platform-agnostic Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"@exodus/address-provider": "^9.0.1",
|
|
30
30
|
"@exodus/assets-feature": "^4.0.1",
|
|
31
31
|
"@exodus/atoms": "^7.0.0",
|
|
32
|
-
"@exodus/auto-enable-assets-plugin": "^4.4.0",
|
|
33
32
|
"@exodus/available-assets": "^8.0.0",
|
|
34
|
-
"@exodus/balances": "^12.0
|
|
33
|
+
"@exodus/balances": "^12.4.0",
|
|
35
34
|
"@exodus/basic-utils": "^2.0.0",
|
|
36
35
|
"@exodus/blockchain-metadata": "^15.0.0",
|
|
37
36
|
"@exodus/dependency-injection": "^2.1.0",
|
|
38
|
-
"@exodus/dependency-preprocessors": "^
|
|
39
|
-
"@exodus/enabled-assets": "^9.0
|
|
37
|
+
"@exodus/dependency-preprocessors": "^5.1.0",
|
|
38
|
+
"@exodus/enabled-assets": "^9.1.0",
|
|
40
39
|
"@exodus/feature-flags": "^5.1.0",
|
|
41
40
|
"@exodus/fee-data-monitors": "^3.0.0",
|
|
42
41
|
"@exodus/fetch": "^1.2.1",
|
|
43
|
-
"@exodus/
|
|
42
|
+
"@exodus/filesystem": "^1.1.0",
|
|
43
|
+
"@exodus/geolocation": "^3.1.0",
|
|
44
44
|
"@exodus/hd-key-slip-10": "^2.0.0",
|
|
45
45
|
"@exodus/key-identifier-provider": "^1.4.0",
|
|
46
46
|
"@exodus/keychain": "^4.3.0",
|
|
@@ -76,19 +76,19 @@
|
|
|
76
76
|
"@exodus/ethereum-meta": "^1.0.23",
|
|
77
77
|
"@exodus/exodus-pricing-client": "^1.2.0",
|
|
78
78
|
"@exodus/key-utils": "^3.0.0",
|
|
79
|
-
"@exodus/kyc": "^4.
|
|
79
|
+
"@exodus/kyc": "^4.3.0",
|
|
80
80
|
"@exodus/litecoin-meta": "^1.0.0",
|
|
81
|
-
"@exodus/market-history": "^7.
|
|
81
|
+
"@exodus/market-history": "^7.3.1",
|
|
82
82
|
"@exodus/models": "^10.1.0",
|
|
83
|
-
"@exodus/nfts": "^7.
|
|
83
|
+
"@exodus/nfts": "^7.7.0",
|
|
84
84
|
"@exodus/personal-notes": "^3.6.0",
|
|
85
|
-
"@exodus/referrals": "^8.0
|
|
85
|
+
"@exodus/referrals": "^8.1.0",
|
|
86
86
|
"@exodus/solana-lib": "^1.3.11",
|
|
87
87
|
"@exodus/solana-meta": "^1.0.2",
|
|
88
88
|
"@exodus/storage-encrypted": "^1.1.2",
|
|
89
89
|
"@exodus/storage-memory": "^2.1.1",
|
|
90
90
|
"@exodus/top-movers-monitor": "^3.2.0",
|
|
91
|
-
"@exodus/ui-config": "^3.
|
|
91
|
+
"@exodus/ui-config": "^3.4.0",
|
|
92
92
|
"@exodus/wild-emitter": "^1.0.0",
|
|
93
93
|
"buffer-json": "^2.0.0",
|
|
94
94
|
"deepmerge": "^4.2.2",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"msw": "^2.0.0",
|
|
101
101
|
"p-defer": "^4.0.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "3ef6c31598f798b40afb25582ee920e080f3e007"
|
|
104
104
|
}
|
package/src/api/debug.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
const createApi = ({ ioc }) => {
|
|
2
|
-
|
|
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
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const { unsafeStorage } = ioc.getByType('adapter')
|
|
7
|
+
|
|
8
|
+
const { blockchainMetadata } = ioc.getByType('module')
|
|
9
|
+
|
|
10
|
+
const restart = async () => {
|
|
11
|
+
// TODO: clever way to know what to invalidate
|
|
12
|
+
await blockchainMetadata.clear()
|
|
13
|
+
port.emit('restart', { reason: 'debug' })
|
|
10
14
|
}
|
|
15
|
+
|
|
16
|
+
const clear = async () => {
|
|
17
|
+
await unsafeStorage.namespace('debug').clear()
|
|
18
|
+
await restart()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return Object.assign({}, ...Object.values(apis), { clear, restart })
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
export default createApi
|
package/src/api/index.js
CHANGED
|
@@ -3,13 +3,47 @@ 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
|
+
const { application, passphraseCache } = ioc.getByType('module')
|
|
10
|
+
|
|
11
|
+
const featureApis = Object.assign({}, ...Object.values(apis))
|
|
12
|
+
|
|
13
|
+
const restoreFromCurrentPhrase = async ({ passphrase } = {}) => {
|
|
14
|
+
if (!passphrase && passphraseCache) passphrase = await passphraseCache.get()
|
|
15
|
+
const mnemonic = await application.getMnemonic({ passphrase })
|
|
16
|
+
await application.import({ passphrase, mnemonic })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// TODO: Improve api here. exodus.wallet.create makes sense, but it's confusing it calls application
|
|
20
|
+
featureApis.wallet = {
|
|
21
|
+
...featureApis.wallet,
|
|
22
|
+
start: application.start,
|
|
23
|
+
stop: application.stop,
|
|
24
|
+
load: application.load,
|
|
25
|
+
unload: application.unload,
|
|
26
|
+
create: application.create,
|
|
27
|
+
lock: application.lock,
|
|
28
|
+
unlock: application.unlock,
|
|
29
|
+
import: application.import,
|
|
30
|
+
delete: application.delete,
|
|
31
|
+
getMnemonic: application.getMnemonic,
|
|
32
|
+
setBackedUp: application.setBackedUp,
|
|
33
|
+
changePassphrase: application.changePassphrase,
|
|
34
|
+
changeLockTimer: application.changeLockTimer,
|
|
35
|
+
restartAutoLockTimer: application.restartAutoLockTimer,
|
|
36
|
+
restoreFromCurrentPhrase,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const debugApi = createDebug({ ioc, port, debug })
|
|
40
|
+
|
|
41
|
+
const reportingApi = createReporting({ ioc, config })
|
|
42
|
+
|
|
9
43
|
return {
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
|
|
44
|
+
...featureApis,
|
|
45
|
+
debug: debugApi,
|
|
46
|
+
reporting: reportingApi,
|
|
13
47
|
isMnemonicValid,
|
|
14
48
|
subscribe: port.subscribe.bind(port),
|
|
15
49
|
unsubscribe: port.unsubscribe.bind(port),
|
package/src/api/reporting.js
CHANGED
|
@@ -29,11 +29,7 @@ const createReporting = ({ ioc, config: { exportTimeout = 2000 } }) => {
|
|
|
29
29
|
return zipObject(namespaces, data)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
return {
|
|
33
|
-
reporting: {
|
|
34
|
-
export: getReports,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
32
|
+
return { export: getReports }
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
export default createReporting
|
package/src/application.js
CHANGED
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,10 +25,10 @@ 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
|
-
ioc.use(addressProvider({ config: config.addressProvider }))
|
|
31
|
+
ioc.use(addressProvider({ config: config.addressProvider, debug }))
|
|
31
32
|
ioc.use(assetsFeature())
|
|
32
33
|
ioc.use(availableAssets())
|
|
33
34
|
ioc.use(balances(config.balances))
|
|
@@ -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,14 +49,17 @@ const createIOC = ({ adapters, config }) => {
|
|
|
48
49
|
}),
|
|
49
50
|
optional(),
|
|
50
51
|
devModeAtomsConfig && devModeAtoms(devModeAtomsConfig),
|
|
52
|
+
debuggerPreprocessor({ debug, unsafeStorage }),
|
|
51
53
|
].filter(Boolean)
|
|
52
54
|
|
|
55
|
+
const nodes = createDependencies({ adapters, config })
|
|
56
|
+
|
|
53
57
|
const registerMultiple = (dependencies) => {
|
|
54
|
-
|
|
58
|
+
nodes.push(...dependencies)
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
const register = (dependency) => {
|
|
58
|
-
|
|
62
|
+
nodes.push(dependency)
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
const use = (feature) => {
|
|
@@ -67,9 +71,12 @@ const createIOC = ({ adapters, config }) => {
|
|
|
67
71
|
registerMultiple(feature.definitions)
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
const resolve = () => {
|
|
75
|
+
ioc.registerMultiple(preprocess({ dependencies: nodes, preprocessors }))
|
|
76
|
+
ioc.resolve()
|
|
77
|
+
}
|
|
71
78
|
|
|
72
|
-
return { ...ioc, register, registerMultiple, use }
|
|
79
|
+
return { ...ioc, resolve, register, registerMultiple, use }
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
export default createIOC
|
package/src/plugins/index.js
CHANGED