@exodus/headless 2.0.0-alpha.147 → 2.0.0-alpha.149
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 +14 -0
- package/package.json +9 -8
- package/src/api/debug.js +13 -0
- package/src/{api.js → api/index.js} +4 -2
- package/src/{reporting.js → api/reporting.js} +6 -3
- package/src/application.js +6 -1
- package/src/index.js +5 -5
- package/src/ioc.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.149](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.148...@exodus/headless@2.0.0-alpha.149) (2023-12-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add debug apis (dev only) ([#4992](https://github.com/ExodusMovement/exodus-hydra/issues/4992)) ([022c0aa](https://github.com/ExodusMovement/exodus-hydra/commit/022c0aabb66bc99243fdeb78e8d8eb47413974c8))
|
|
11
|
+
|
|
12
|
+
## [2.0.0-alpha.148](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.147...@exodus/headless@2.0.0-alpha.148) (2023-12-12)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- add startup-counter feature ([#4870](https://github.com/ExodusMovement/exodus-hydra/issues/4870)) ([e2a1c18](https://github.com/ExodusMovement/exodus-hydra/commit/e2a1c18922de3cddf69fb7840712fc2bfdac687a))
|
|
17
|
+
- allow force restore ([#4953](https://github.com/ExodusMovement/exodus-hydra/issues/4953)) ([10d5e06](https://github.com/ExodusMovement/exodus-hydra/commit/10d5e06b00830fcdfe3c66698bbd729fbd8b3efe))
|
|
18
|
+
- assign feature id as namespace ([#4962](https://github.com/ExodusMovement/exodus-hydra/issues/4962)) ([8af7ce4](https://github.com/ExodusMovement/exodus-hydra/commit/8af7ce4dbcc058d01966be85dc1aa53a4a65a488))
|
|
19
|
+
|
|
6
20
|
## [2.0.0-alpha.147](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.146...@exodus/headless@2.0.0-alpha.147) (2023-12-04)
|
|
7
21
|
|
|
8
22
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/headless",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.149",
|
|
4
4
|
"description": "The platform-agnostic Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@exodus/address-provider": "^9.0.1",
|
|
30
30
|
"@exodus/assets-feature": "^4.0.0",
|
|
31
|
-
"@exodus/atoms": "^
|
|
31
|
+
"@exodus/atoms": "^7.0.0",
|
|
32
32
|
"@exodus/auto-enable-assets-plugin": "^4.4.0",
|
|
33
33
|
"@exodus/available-assets": "^8.0.0",
|
|
34
|
-
"@exodus/balances": "^12.0.
|
|
34
|
+
"@exodus/balances": "^12.0.1",
|
|
35
35
|
"@exodus/basic-utils": "^2.0.0",
|
|
36
36
|
"@exodus/blockchain-metadata": "^15.0.0",
|
|
37
|
-
"@exodus/dependency-injection": "^2.0
|
|
38
|
-
"@exodus/dependency-preprocessors": "^
|
|
37
|
+
"@exodus/dependency-injection": "^2.1.0",
|
|
38
|
+
"@exodus/dependency-preprocessors": "^4.0.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",
|
|
@@ -52,9 +52,10 @@
|
|
|
52
52
|
"@exodus/remote-config": "^2.3.0",
|
|
53
53
|
"@exodus/restore-progress-tracker": "^3.0.0",
|
|
54
54
|
"@exodus/sodium-crypto": "^3.2.0",
|
|
55
|
+
"@exodus/startup-counter": "^1.0.0",
|
|
55
56
|
"@exodus/tx-signer": "^1.1.0",
|
|
56
57
|
"@exodus/wallet": "^10.3.0",
|
|
57
|
-
"@exodus/wallet-accounts": "^
|
|
58
|
+
"@exodus/wallet-accounts": "^15.0.0",
|
|
58
59
|
"@exodus/wallet-compatibility-modes": "^3.2.0",
|
|
59
60
|
"bip39": "^2.6.0",
|
|
60
61
|
"events": "^3.3.0",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"@exodus/key-utils": "^3.0.0",
|
|
78
79
|
"@exodus/kyc": "^4.2.0",
|
|
79
80
|
"@exodus/litecoin-meta": "^1.0.0",
|
|
80
|
-
"@exodus/market-history": "^7.
|
|
81
|
+
"@exodus/market-history": "^7.2.0",
|
|
81
82
|
"@exodus/models": "^10.1.0",
|
|
82
83
|
"@exodus/nfts": "^7.1.2",
|
|
83
84
|
"@exodus/personal-notes": "^3.6.0",
|
|
@@ -99,5 +100,5 @@
|
|
|
99
100
|
"msw": "^2.0.0",
|
|
100
101
|
"p-defer": "^4.0.0"
|
|
101
102
|
},
|
|
102
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "20d96231a08ff6a8cad77f5c7ef8f9b62627656f"
|
|
103
104
|
}
|
package/src/api/debug.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const createApi = ({ ioc }) => {
|
|
2
|
+
const { env } = ioc.getByType('adapter')
|
|
3
|
+
|
|
4
|
+
if (!env || env.build !== 'development') return {}
|
|
5
|
+
|
|
6
|
+
const apis = ioc.getByType('debug')
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
debug: Object.assign({}, ...Object.values(apis)),
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default createApi
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { validateMnemonic as isMnemonicValid } from 'bip39'
|
|
2
2
|
|
|
3
|
+
import createDebug from './debug'
|
|
3
4
|
import createReporting from './reporting'
|
|
4
5
|
|
|
5
|
-
const createApi = ({ ioc, port,
|
|
6
|
+
const createApi = ({ ioc, port, config }) => {
|
|
6
7
|
const apis = ioc.getByType('api')
|
|
7
8
|
|
|
8
9
|
return {
|
|
9
10
|
...Object.assign({}, ...Object.values(apis)),
|
|
10
|
-
...
|
|
11
|
+
...createDebug({ ioc }),
|
|
12
|
+
...createReporting({ ioc, config }),
|
|
11
13
|
isMnemonicValid,
|
|
12
14
|
subscribe: port.subscribe.bind(port),
|
|
13
15
|
unsubscribe: port.unsubscribe.bind(port),
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { zipObject } from 'lodash'
|
|
2
2
|
|
|
3
|
-
import { rejectAfter } from '
|
|
3
|
+
import { rejectAfter } from '../utils/promises'
|
|
4
|
+
|
|
5
|
+
const createReporting = ({ ioc, config: { exportTimeout = 2000 } }) => {
|
|
6
|
+
const nodes = ioc.getByType('report')
|
|
7
|
+
|
|
8
|
+
const { lockedAtom } = ioc.getByType('atom')
|
|
4
9
|
|
|
5
|
-
const createReporting = ({ ioc, lockedAtom, config: { exportTimeout = 2000 } }) => {
|
|
6
10
|
const getReports = async () => {
|
|
7
11
|
if (await lockedAtom.get()) throw new Error('Unable to export when locked')
|
|
8
12
|
|
|
9
|
-
const nodes = ioc.getByType('report')
|
|
10
13
|
const reports = Object.values(nodes)
|
|
11
14
|
|
|
12
15
|
const timeoutPromise = rejectAfter(
|
package/src/application.js
CHANGED
|
@@ -184,6 +184,7 @@ class Application extends ExodusModule {
|
|
|
184
184
|
const { forceRestart, forgotPassphrase, ...wallet } = opts
|
|
185
185
|
|
|
186
186
|
await this.#wallet.import(wallet)
|
|
187
|
+
await this.fire(Hook.Backup)
|
|
187
188
|
|
|
188
189
|
if (forceRestart || walletExists) {
|
|
189
190
|
await this.#storage.set(IMPORT_FLAG, true)
|
|
@@ -220,13 +221,17 @@ class Application extends ExodusModule {
|
|
|
220
221
|
if (isRestoring) {
|
|
221
222
|
await this.fire(Hook.Restore)
|
|
222
223
|
await this.#storage.delete(RESTORE_FLAG)
|
|
223
|
-
await this.setBackedUp()
|
|
224
224
|
await this.fire(Hook.RestoreCompleted)
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
this.fire(Hook.AssetsSynced)
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
restore = async () => {
|
|
231
|
+
await this.#storage.set(RESTORE_FLAG, true)
|
|
232
|
+
await this.restoreIfNeeded()
|
|
233
|
+
}
|
|
234
|
+
|
|
230
235
|
#autoUnlock = async () => {
|
|
231
236
|
const walletLocked = await this.#wallet.isLocked()
|
|
232
237
|
const passphrase = await this.#passphraseCache.get()
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import publicKeyStore from '@exodus/public-key-store'
|
|
|
14
14
|
import rates from '@exodus/rates-monitor'
|
|
15
15
|
import remoteConfig from '@exodus/remote-config'
|
|
16
16
|
import restoreProgressTracker from '@exodus/restore-progress-tracker'
|
|
17
|
+
import startupCounter from '@exodus/startup-counter'
|
|
17
18
|
import transactionSigner from '@exodus/tx-signer'
|
|
18
19
|
import wallet from '@exodus/wallet'
|
|
19
20
|
import walletAccounts from '@exodus/wallet-accounts'
|
|
@@ -26,8 +27,8 @@ import attachPlugins from './plugins/attach'
|
|
|
26
27
|
const createExodus = ({ adapters, config, port }) => {
|
|
27
28
|
const ioc = createIOC({ adapters, config })
|
|
28
29
|
|
|
29
|
-
ioc.use(assetsFeature())
|
|
30
30
|
ioc.use(addressProvider({ config: config.addressProvider }))
|
|
31
|
+
ioc.use(assetsFeature())
|
|
31
32
|
ioc.use(availableAssets())
|
|
32
33
|
ioc.use(balances(config.balances))
|
|
33
34
|
ioc.use(blockchainMetadata())
|
|
@@ -39,10 +40,11 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
39
40
|
ioc.use(locale())
|
|
40
41
|
ioc.use(pricing())
|
|
41
42
|
ioc.use(publicKeyStore())
|
|
42
|
-
ioc.use(transactionSigner())
|
|
43
43
|
ioc.use(rates())
|
|
44
44
|
ioc.use(remoteConfig())
|
|
45
45
|
ioc.use(restoreProgressTracker())
|
|
46
|
+
ioc.use(startupCounter())
|
|
47
|
+
ioc.use(transactionSigner())
|
|
46
48
|
ioc.use(wallet())
|
|
47
49
|
ioc.use(walletAccounts())
|
|
48
50
|
|
|
@@ -53,8 +55,6 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
53
55
|
|
|
54
56
|
const { storage, migrateableStorage } = ioc.getByType('adapter')
|
|
55
57
|
|
|
56
|
-
const { lockedAtom } = ioc.getByType('atom')
|
|
57
|
-
|
|
58
58
|
const { application, wallet, unlockEncryptedStorage } = ioc.getByType('module')
|
|
59
59
|
|
|
60
60
|
const { migrations } = ioc.getAll()
|
|
@@ -119,7 +119,7 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
119
119
|
logger: ioc.get('createLogger')('attachPlugins'),
|
|
120
120
|
})
|
|
121
121
|
|
|
122
|
-
return createApi({ ioc, port, config
|
|
122
|
+
return createApi({ ioc, port, config })
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
return { ...ioc, resolve }
|
package/src/ioc.js
CHANGED
|
@@ -58,12 +58,13 @@ const createIOC = ({ adapters, config }) => {
|
|
|
58
58
|
registerMultiple([dependency])
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const use = (
|
|
62
|
-
for (const { definition } of
|
|
61
|
+
const use = (feature) => {
|
|
62
|
+
for (const { definition } of feature.definitions) {
|
|
63
63
|
assert(definition.type, `ioc.use: "${definition.id}" is missing type field`)
|
|
64
|
+
definition.namespace = feature.id
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
registerMultiple(
|
|
67
|
+
registerMultiple(feature.definitions)
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
registerMultiple(createDependencies({ adapters, config }))
|