@exodus/headless 2.1.0 → 2.2.1
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 +19 -0
- package/package.json +11 -12
- package/src/api/debug.js +9 -6
- package/src/api/index.js +37 -3
- package/src/api/reporting.js +1 -5
- package/src/application.js +1 -1
- package/src/atoms/available-base-asset-names-to-monitor.js +25 -0
- package/src/atoms/base-asset-names-to-monitor.js +1 -1
- package/src/dependencies/atoms.js +5 -1
- package/src/index.js +1 -1
- package/src/ioc.js +9 -4
- package/src/plugins/index.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.2.0...@exodus/headless@2.2.1) (2024-01-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **nfts:** monitor uses availableAssets ([#5297](https://github.com/ExodusMovement/exodus-hydra/issues/5297)) ([383e51f](https://github.com/ExodusMovement/exodus-hydra/commit/383e51f5717217477e0dfd680d115152a2bdf62d))
|
|
11
|
+
|
|
12
|
+
## [2.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.1.0...@exodus/headless@2.2.0) (2024-01-09)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- add `autoEnableAssetsPlugin` to enabled-assets ([#5272](https://github.com/ExodusMovement/exodus-hydra/issues/5272)) ([92896c4](https://github.com/ExodusMovement/exodus-hydra/commit/92896c47e445c101ed10121614cea43b5b4350b3))
|
|
17
|
+
- **address-provider:** debug node ([#5126](https://github.com/ExodusMovement/exodus-hydra/issues/5126)) ([4ac0312](https://github.com/ExodusMovement/exodus-hydra/commit/4ac0312c7e5a3022a2b0be27f6621e26509fcf08))
|
|
18
|
+
- **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))
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **headless:** missed private function ([#5266](https://github.com/ExodusMovement/exodus-hydra/issues/5266)) ([c44abcb](https://github.com/ExodusMovement/exodus-hydra/commit/c44abcbd3f0fc2e9bffd86484246c891535b66d4))
|
|
23
|
+
- run preprocessors on all nodes ([#5154](https://github.com/ExodusMovement/exodus-hydra/issues/5154)) ([b36b481](https://github.com/ExodusMovement/exodus-hydra/commit/b36b4810af04233acf33911dd6013f7be17ac7b8))
|
|
24
|
+
|
|
6
25
|
## [2.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0...@exodus/headless@2.1.0) (2023-12-18)
|
|
7
26
|
|
|
8
27
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/headless",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "The platform-agnostic Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -29,14 +29,13 @@
|
|
|
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",
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"minimalistic-assert": "^1.0.1"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"@exodus/ab-testing": "^7.
|
|
66
|
+
"@exodus/ab-testing": "^7.3.0",
|
|
68
67
|
"@exodus/algorand-lib": "^2.0.1",
|
|
69
68
|
"@exodus/algorand-meta": "^1.1.4",
|
|
70
69
|
"@exodus/apy-rates": "^3.3.1",
|
|
@@ -77,19 +76,19 @@
|
|
|
77
76
|
"@exodus/ethereum-meta": "^1.0.23",
|
|
78
77
|
"@exodus/exodus-pricing-client": "^1.2.0",
|
|
79
78
|
"@exodus/key-utils": "^3.0.0",
|
|
80
|
-
"@exodus/kyc": "^4.
|
|
79
|
+
"@exodus/kyc": "^4.3.1",
|
|
81
80
|
"@exodus/litecoin-meta": "^1.0.0",
|
|
82
|
-
"@exodus/market-history": "^7.
|
|
81
|
+
"@exodus/market-history": "^7.3.1",
|
|
83
82
|
"@exodus/models": "^10.1.0",
|
|
84
|
-
"@exodus/nfts": "^7.1
|
|
83
|
+
"@exodus/nfts": "^7.10.1",
|
|
85
84
|
"@exodus/personal-notes": "^3.6.0",
|
|
86
|
-
"@exodus/referrals": "^8.
|
|
85
|
+
"@exodus/referrals": "^8.1.1",
|
|
87
86
|
"@exodus/solana-lib": "^1.3.11",
|
|
88
87
|
"@exodus/solana-meta": "^1.0.2",
|
|
89
88
|
"@exodus/storage-encrypted": "^1.1.2",
|
|
90
89
|
"@exodus/storage-memory": "^2.1.1",
|
|
91
90
|
"@exodus/top-movers-monitor": "^3.2.0",
|
|
92
|
-
"@exodus/ui-config": "^3.
|
|
91
|
+
"@exodus/ui-config": "^3.4.0",
|
|
93
92
|
"@exodus/wild-emitter": "^1.0.0",
|
|
94
93
|
"buffer-json": "^2.0.0",
|
|
95
94
|
"deepmerge": "^4.2.2",
|
|
@@ -101,5 +100,5 @@
|
|
|
101
100
|
"msw": "^2.0.0",
|
|
102
101
|
"p-defer": "^4.0.0"
|
|
103
102
|
},
|
|
104
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "cd0ccb9711a5a34b2ba1bee3755dab464e28b298"
|
|
105
104
|
}
|
package/src/api/debug.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
const createApi = ({ ioc, port, debug }) => {
|
|
2
|
-
if (!debug) return
|
|
2
|
+
if (!debug) return
|
|
3
3
|
|
|
4
4
|
const apis = ioc.getByType('debug')
|
|
5
5
|
|
|
6
6
|
const { unsafeStorage } = ioc.getByType('adapter')
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
await unsafeStorage.namespace('debug').clear()
|
|
10
|
-
}
|
|
8
|
+
const { blockchainMetadata } = ioc.getByType('module')
|
|
11
9
|
|
|
12
10
|
const restart = async () => {
|
|
11
|
+
// TODO: clever way to know what to invalidate
|
|
12
|
+
await blockchainMetadata.clear()
|
|
13
13
|
port.emit('restart', { reason: 'debug' })
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const clear = async () => {
|
|
17
|
+
await unsafeStorage.namespace('debug').clear()
|
|
18
|
+
await restart()
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
return Object.assign({}, ...Object.values(apis), { clear, restart })
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export default createApi
|
package/src/api/index.js
CHANGED
|
@@ -6,10 +6,44 @@ import createReporting from './reporting'
|
|
|
6
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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { compute, dedupe } from '@exodus/atoms'
|
|
2
|
+
|
|
3
|
+
import { getNetworks } from './base-asset-names-to-monitor'
|
|
4
|
+
|
|
5
|
+
const createBaseAssetNamesToMonitorAtom = ({ assetsModule, availableAssetNamesAtom }) => {
|
|
6
|
+
const selector = (availableAssetNames) => {
|
|
7
|
+
return getNetworks(availableAssetNames, assetsModule.getAssets())
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return dedupe(
|
|
11
|
+
compute({
|
|
12
|
+
atom: availableAssetNamesAtom,
|
|
13
|
+
selector,
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const availableBaseAssetNamesToMonitorAtom = {
|
|
19
|
+
id: 'availableBaseAssetNamesToMonitorAtom',
|
|
20
|
+
type: 'atom',
|
|
21
|
+
factory: createBaseAssetNamesToMonitorAtom,
|
|
22
|
+
dependencies: ['assetsModule', 'availableAssetNamesAtom'],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default availableBaseAssetNamesToMonitorAtom
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { combine, compute, dedupe } from '@exodus/atoms'
|
|
2
2
|
import { uniq } from 'lodash'
|
|
3
3
|
|
|
4
|
-
const getNetworks = (assetNames, assets) =>
|
|
4
|
+
export const getNetworks = (assetNames, assets) =>
|
|
5
5
|
uniq(
|
|
6
6
|
assetNames
|
|
7
7
|
.map((assetName) => assets[assetName]?.baseAsset.name)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import availableBaseAssetNamesToMonitorAtomDefinition from '../atoms/available-base-asset-names-to-monitor'
|
|
1
2
|
import baseAssetNamesToMonitorAtomDefinition from '../atoms/base-asset-names-to-monitor'
|
|
2
3
|
|
|
3
|
-
const createAtomDependencies = () => [
|
|
4
|
+
const createAtomDependencies = () => [
|
|
5
|
+
{ definition: baseAssetNamesToMonitorAtomDefinition },
|
|
6
|
+
{ definition: availableBaseAssetNamesToMonitorAtomDefinition },
|
|
7
|
+
]
|
|
4
8
|
|
|
5
9
|
export default createAtomDependencies
|
package/src/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import attachPlugins from './plugins/attach'
|
|
|
28
28
|
const createExodus = ({ adapters, config, port, debug = false }) => {
|
|
29
29
|
const ioc = createIOC({ adapters, config, debug })
|
|
30
30
|
|
|
31
|
-
ioc.use(addressProvider({ config: config.addressProvider }))
|
|
31
|
+
ioc.use(addressProvider({ config: config.addressProvider, debug }))
|
|
32
32
|
ioc.use(assetsFeature())
|
|
33
33
|
ioc.use(availableAssets())
|
|
34
34
|
ioc.use(balances(config.balances))
|
package/src/ioc.js
CHANGED
|
@@ -52,12 +52,14 @@ const createIOC = ({ adapters, config, debug }) => {
|
|
|
52
52
|
debuggerPreprocessor({ debug, unsafeStorage }),
|
|
53
53
|
].filter(Boolean)
|
|
54
54
|
|
|
55
|
+
const nodes = createDependencies({ adapters, config })
|
|
56
|
+
|
|
55
57
|
const registerMultiple = (dependencies) => {
|
|
56
|
-
|
|
58
|
+
nodes.push(...dependencies)
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
const register = (dependency) => {
|
|
60
|
-
|
|
62
|
+
nodes.push(dependency)
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
const use = (feature) => {
|
|
@@ -69,9 +71,12 @@ const createIOC = ({ adapters, config, debug }) => {
|
|
|
69
71
|
registerMultiple(feature.definitions)
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
const resolve = () => {
|
|
75
|
+
ioc.registerMultiple(preprocess({ dependencies: nodes, preprocessors }))
|
|
76
|
+
ioc.resolve()
|
|
77
|
+
}
|
|
73
78
|
|
|
74
|
-
return { ...ioc, register, registerMultiple, use }
|
|
79
|
+
return { ...ioc, resolve, register, registerMultiple, use }
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
export default createIOC
|
package/src/plugins/index.js
CHANGED