@exodus/headless 2.0.0-alpha.138 → 2.0.0-alpha.139

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.0.0-alpha.139](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.138...@exodus/headless@2.0.0-alpha.139) (2023-10-25)
7
+
8
+ ### Features
9
+
10
+ - **reporting:** don't wait for long-running exports ([#4549](https://github.com/ExodusMovement/exodus-hydra/issues/4549)) ([c1568a5](https://github.com/ExodusMovement/exodus-hydra/commit/c1568a5e5c53b7eb7469aceac19a7bedbc265d45))
11
+
12
+ ### Bug Fixes
13
+
14
+ - headless migrations ([#4568](https://github.com/ExodusMovement/exodus-hydra/issues/4568)) ([610a3a4](https://github.com/ExodusMovement/exodus-hydra/commit/610a3a4ada3124f8aba5d177274db7c05c86fc7e))
15
+
6
16
  ## [2.0.0-alpha.138](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.137...@exodus/headless@2.0.0-alpha.138) (2023-10-20)
7
17
 
8
18
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.138",
3
+ "version": "2.0.0-alpha.139",
4
4
  "description": "The platform-agnostic Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "main": "src/index.js",
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@exodus/address-provider": "^8.0.0",
30
- "@exodus/assets-feature": "^3.5.0",
31
- "@exodus/atoms": "^5.7.3",
30
+ "@exodus/assets-feature": "^3.7.0",
31
+ "@exodus/atoms": "^6.0.0",
32
32
  "@exodus/auto-enable-assets-plugin": "^4.3.0",
33
33
  "@exodus/available-assets": "^7.0.0",
34
- "@exodus/balances": "^11.0.3",
34
+ "@exodus/balances": "^11.1.0",
35
35
  "@exodus/basic-utils": "^2.0.0",
36
- "@exodus/blockchain-metadata": "^14.1.0",
36
+ "@exodus/blockchain-metadata": "^14.2.0",
37
37
  "@exodus/dependency-injection": "^2.0.1",
38
38
  "@exodus/dependency-preprocessors": "^3.1.1",
39
39
  "@exodus/enabled-assets": "^9.0.1",
@@ -43,7 +43,7 @@
43
43
  "@exodus/geolocation": "^3.0.0",
44
44
  "@exodus/hd-key-slip-10": "^2.0.0",
45
45
  "@exodus/key-identifier-provider": "^1.3.1",
46
- "@exodus/keychain": "^4.2.0",
46
+ "@exodus/keychain": "^4.3.0",
47
47
  "@exodus/locale": "^2.0.2",
48
48
  "@exodus/module": "^1.2.0",
49
49
  "@exodus/pricing": "^1.1.0",
@@ -53,7 +53,7 @@
53
53
  "@exodus/sodium-crypto": "^3.2.0",
54
54
  "@exodus/tx-signer": "^1.1.0",
55
55
  "@exodus/wallet": "^10.0.2",
56
- "@exodus/wallet-accounts": "^14.1.0",
56
+ "@exodus/wallet-accounts": "^14.2.0",
57
57
  "@exodus/wallet-compatibility-modes": "^3.1.2",
58
58
  "bip39": "^2.6.0",
59
59
  "events": "^3.3.0",
@@ -98,5 +98,5 @@
98
98
  "msw": "^1.3.0",
99
99
  "p-defer": "^4.0.0"
100
100
  },
101
- "gitHead": "18791c72d9be2a75aea6621a216c1aed819442ca"
101
+ "gitHead": "33d52ad39ea9de1a513ece3ae4cc4d1309edb387"
102
102
  }
package/src/api.js CHANGED
@@ -2,12 +2,12 @@ import { validateMnemonic as isMnemonicValid } from 'bip39'
2
2
 
3
3
  import createReporting from './reporting'
4
4
 
5
- const createApi = ({ ioc, port, lockedAtom }) => {
5
+ const createApi = ({ ioc, port, lockedAtom, config }) => {
6
6
  const apis = ioc.getByType('api')
7
7
 
8
8
  return {
9
9
  ...Object.assign({}, ...Object.values(apis)),
10
- ...createReporting({ ioc, lockedAtom }),
10
+ ...createReporting({ ioc, lockedAtom, config }),
11
11
  isMnemonicValid,
12
12
  subscribe: port.subscribe.bind(port),
13
13
  unsubscribe: port.unsubscribe.bind(port),
package/src/index.js CHANGED
@@ -113,7 +113,7 @@ const createExodus = ({ adapters, config, port }) => {
113
113
  logger: ioc.get('createLogger')('attachPlugins'),
114
114
  })
115
115
 
116
- return createApi({ ioc, port, lockedAtom })
116
+ return createApi({ ioc, port, config, lockedAtom })
117
117
  }
118
118
 
119
119
  return { ...ioc, resolve }
@@ -1,12 +1,14 @@
1
1
  import { deriveSyncKeys } from '../utils/fusion'
2
2
 
3
3
  const attachMigrations = ({ migrations = [], application, modules, adapters, ...deps }) => {
4
- const { analytics, unlockEncryptedStorage, wallet } = modules
5
- const { unsafeStorage, migrateableStorage, fusionKeysDeferred, migrateableFusion } = adapters
4
+ const { unsafeStorage, migrateableStorage } = adapters
5
+ const { analytics, unlockEncryptedStorage, wallet, fusionKeysDeferred, migrateableFusion } =
6
+ modules
6
7
 
7
8
  // Override encrypted storage with migrations own instance to make sure no modules reads from it before migrations ran
8
9
  const migrationFlagsStorage = unsafeStorage.namespace('migrations')
9
- const migrationAdapters = { ...adapters, storage: migrateableStorage, fusion: migrateableFusion }
10
+ const migrationAdapters = { ...adapters, storage: migrateableStorage }
11
+ const migrationModules = { ...modules, fusion: migrateableFusion }
10
12
 
11
13
  const attachMigration = async (migration) => {
12
14
  const { name, factory } = migration
@@ -19,7 +21,7 @@ const attachMigrations = ({ migrations = [], application, modules, adapters, ...
19
21
  try {
20
22
  const start = performance.now()
21
23
 
22
- await factory({ ...deps, adapters: migrationAdapters, modules, logger })
24
+ await factory({ ...deps, adapters: migrationAdapters, modules: migrationModules, logger })
23
25
 
24
26
  const time = performance.now() - start
25
27
 
package/src/reporting.js CHANGED
@@ -1,13 +1,22 @@
1
1
  import { zipObject } from 'lodash'
2
2
 
3
- const createReporting = ({ ioc, lockedAtom }) => {
3
+ import { rejectAfter } from './utils/promises'
4
+
5
+ const createReporting = ({ ioc, lockedAtom, config: { exportTimeout = 2000 } }) => {
4
6
  const getReports = async () => {
5
7
  if (await lockedAtom.get()) throw new Error('Unable to export when locked')
6
8
 
7
9
  const nodes = ioc.getByType('report')
8
10
  const reports = Object.values(nodes)
9
11
 
10
- const resolvedReports = await Promise.allSettled(reports.map((report) => report.export()))
12
+ const timeoutPromise = rejectAfter(
13
+ exportTimeout,
14
+ `Export took longer than the maximum export timeout of ${Math.ceil(exportTimeout / 1000)}s`
15
+ )
16
+
17
+ const resolvedReports = await Promise.allSettled(
18
+ reports.map((report) => Promise.race([report.export(), timeoutPromise]))
19
+ )
11
20
 
12
21
  const namespaces = reports.map((report) => report.namespace)
13
22
  const data = resolvedReports.map((outcome) =>
@@ -0,0 +1,7 @@
1
+ export const rejectAfter = (ms, reason) => {
2
+ return new Promise((resolve, reject) =>
3
+ setTimeout(() => {
4
+ reject(new Error(reason))
5
+ }, ms)
6
+ )
7
+ }