@exodus/headless 2.0.0-alpha.22 → 2.0.0-alpha.24

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,23 @@
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.24](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.23...@exodus/headless@2.0.0-alpha.24) (2023-05-26)
7
+
8
+ ### Features
9
+
10
+ - emit extra payload on application create hook ([#1709](https://github.com/ExodusMovement/exodus-hydra/issues/1709)) ([23412f6](https://github.com/ExodusMovement/exodus-hydra/commit/23412f603cb36c1249d0ed8248a1e44742d5dac9))
11
+
12
+ ## [2.0.0-alpha.23](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.22...@exodus/headless@2.0.0-alpha.23) (2023-05-24)
13
+
14
+ ### Features
15
+
16
+ - add personal notes to headless ([#1676](https://github.com/ExodusMovement/exodus-hydra/issues/1676)) ([c658211](https://github.com/ExodusMovement/exodus-hydra/commit/c6582113b56953edbf68fd0f4d29f4ee802e8bf5))
17
+
18
+ ### Bug Fixes
19
+
20
+ - handle market-history-new-assets ([#1657](https://github.com/ExodusMovement/exodus-hydra/issues/1657)) ([89ff868](https://github.com/ExodusMovement/exodus-hydra/commit/89ff868ade7def9dc1ae99555f069e1a0cfeacba))
21
+ - start geolocation at start ([#1669](https://github.com/ExodusMovement/exodus-hydra/issues/1669)) ([ecfd0f3](https://github.com/ExodusMovement/exodus-hydra/commit/ecfd0f3a74ebf2ed5bca53c67c55ec304df91f4c))
22
+
6
23
  ## [2.0.0-alpha.22](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.21...@exodus/headless@2.0.0-alpha.22) (2023-05-16)
7
24
 
8
25
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.24",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@exodus/addresses-provider": "^3.0.2",
30
- "@exodus/atoms": "^3.5.2",
30
+ "@exodus/atoms": "^3.5.3",
31
31
  "@exodus/available-assets": "^2.0.0",
32
32
  "@exodus/balances": "^6.0.0",
33
33
  "@exodus/basic-utils": "^2.0.0",
@@ -35,9 +35,9 @@
35
35
  "@exodus/config": "^7.0.0",
36
36
  "@exodus/dependency-injection": "^1.2.0",
37
37
  "@exodus/dependency-preprocessors": "^2.4.0",
38
- "@exodus/enabled-assets": "^6.0.0",
38
+ "@exodus/enabled-assets": "^6.0.1",
39
39
  "@exodus/exodus-pricing-client": "^1.1.0",
40
- "@exodus/feature-flags": "^2.0.0",
40
+ "@exodus/feature-flags": "^2.0.1",
41
41
  "@exodus/fetch": "^1.2.1",
42
42
  "@exodus/geolocation": "^2.0.0",
43
43
  "@exodus/key-identifier-provider": "^1.1.3",
@@ -45,6 +45,7 @@
45
45
  "@exodus/kyc": "^3.4.0",
46
46
  "@exodus/market-history": "^3.1.0",
47
47
  "@exodus/module": "^1.0.0",
48
+ "@exodus/personal-notes": "^3.0.1",
48
49
  "@exodus/rates-monitor": "^2.0.0",
49
50
  "@exodus/referrals": "^5.2.0",
50
51
  "@exodus/wallet": "^6.0.1",
@@ -71,10 +72,11 @@
71
72
  "buffer-json": "^2.0.0",
72
73
  "deepmerge": "^4.2.2",
73
74
  "eslint": "^8.33.0",
75
+ "eslint-plugin-simple-import-sort": "^7.0.0",
74
76
  "events": "^3.3.0",
75
77
  "jest": "^29.1.2",
76
78
  "nock": "^13.3.1",
77
79
  "p-defer": "^4.0.0"
78
80
  },
79
- "gitHead": "99a3cb0de3ed192f63dec6dd71ad2d3489698495"
81
+ "gitHead": "197d89380e385198b7cb846b01079c68d46f5d6c"
80
82
  }
package/src/api.js CHANGED
@@ -9,6 +9,7 @@ const createApi = ({ ioc, port }) => {
9
9
  blockchainMetadata,
10
10
  enabledAssets,
11
11
  kyc,
12
+ personalNotes,
12
13
  referrals,
13
14
  remoteConfig,
14
15
  wallet,
@@ -107,6 +108,9 @@ const createApi = ({ ioc, port }) => {
107
108
  setReferredBy: referrals.setReferredBy,
108
109
  referralCodeExists: referrals.referralCodeExists,
109
110
  },
111
+ personalNotes: {
112
+ upsert: personalNotes.upsert,
113
+ },
110
114
  isMnemonicValid,
111
115
  subscribe: port.subscribe.bind(port),
112
116
  unsubscribe: port.unsubscribe.bind(port),
@@ -139,7 +139,15 @@ class Application extends ExodusModule {
139
139
  await this.#applicationStarted
140
140
  await this.#wallet.create(opts)
141
141
 
142
- await this.fire(Hook.Create, { hasPassphraseSet: !!opts?.passphrase })
142
+ const isLocked = await this.#wallet.isLocked()
143
+
144
+ await this.fire(Hook.Create, {
145
+ hasPassphraseSet: !!opts?.passphrase,
146
+ isBackedUp: false,
147
+ isLocked,
148
+ isRestoring: false,
149
+ walletExists: true,
150
+ })
143
151
  }
144
152
 
145
153
  import = async (opts) => {
package/src/constants.js CHANGED
@@ -7,6 +7,7 @@ export const atomsToAttach = [
7
7
  'geolocationAtom',
8
8
  'kycAtom',
9
9
  'languageAtom',
10
+ 'personalNotesAtom',
10
11
  'referralsAtom',
11
12
  'walletAccountsAtom',
12
13
  ]
@@ -1,26 +1,27 @@
1
1
  import {
2
+ createFusionAtomFactory,
2
3
  createInMemoryAtom,
3
4
  createRemoteConfigAtomFactory,
4
5
  createStorageAtomFactory,
5
- createFusionAtomFactory,
6
6
  } from '@exodus/atoms'
7
- import {
8
- walletAccountsAtomDefinition,
9
- enabledWalletAccountsAtomDefinition,
10
- } from '@exodus/wallet-accounts/atoms'
7
+ import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
8
+ import { balancesAtomDefinition } from '@exodus/balances/atoms'
11
9
  import {
12
10
  enabledAndDisabledAssetsAtomDefinition,
13
11
  enabledAssetsAtomDefinition,
14
12
  } from '@exodus/enabled-assets/atoms'
15
- import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
16
- import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
17
- import { balancesAtomDefinition } from '@exodus/balances/atoms'
18
13
  import { featureFlagsAtomDefinition } from '@exodus/feature-flags/atoms'
14
+ import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
19
15
  import { kycAtomDefinition } from '@exodus/kyc/atoms'
16
+ import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
17
+ import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
20
18
  import { referralsAtomDefinition } from '@exodus/referrals/atoms'
19
+ import {
20
+ enabledWalletAccountsAtomDefinition,
21
+ walletAccountsAtomDefinition,
22
+ } from '@exodus/wallet-accounts/atoms'
21
23
 
22
24
  import { withType } from './utils'
23
- import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
24
25
 
25
26
  const createAtomDependencies = () =>
26
27
  [
@@ -134,6 +135,15 @@ const createAtomDependencies = () =>
134
135
  { definition: featureFlagsAtomDefinition },
135
136
  { definition: kycAtomDefinition },
136
137
  { definition: referralsAtomDefinition },
138
+ {
139
+ definition: personalNotesAtomDefinition,
140
+ aliases: [
141
+ {
142
+ implementationId: 'personalNotesStorage',
143
+ interfaceId: 'storage',
144
+ },
145
+ ],
146
+ },
137
147
  ].map(withType('atom'))
138
148
 
139
149
  export default createAtomDependencies
@@ -3,14 +3,14 @@
3
3
 
4
4
  import assert from 'minimalistic-assert'
5
5
 
6
- import createConfigDependencies from './configs'
7
6
  import createAdapterDependencies from './adapters'
8
- import createAtomDependencies from './atoms'
9
7
  import createAtomCollectionDependencies from './atom-collections'
8
+ import createAtomDependencies from './atoms'
9
+ import createConfigDependencies from './configs'
10
10
  import createModuleDependencies from './modules'
11
11
  import createMonitorDependencies from './monitors'
12
- import { wrapConstant } from './utils'
13
12
  import createPluginDependencies from './plugins'
13
+ import { wrapConstant } from './utils'
14
14
 
15
15
  const adapterKeys = [
16
16
  // ...
@@ -1,25 +1,26 @@
1
- import EventEmitter from 'events/'
2
- import createRemoteConfig from '@exodus/config/remote'
3
- import keychainDefinition from '@exodus/keychain/module'
4
- import walletDefinition from '@exodus/wallet/module'
5
- import walletAccountsDefinition from '@exodus/wallet-accounts/module'
6
- import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
7
- import enabledAssetsModuleDefinition from '@exodus/enabled-assets/module'
8
- import availableAssetsModuleDefinition from '@exodus/available-assets/module'
9
- import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
10
- import walletCompatibilityModesDefinition from '@exodus/wallet-compatibility-modes/module'
11
- import balancesDefinition from '@exodus/balances/module'
12
- import featureFlagsDefinition from '@exodus/feature-flags/module'
13
1
  import createAddressesProvider from '@exodus/addresses-provider'
14
- import createMockableAddressesProvider from '@exodus/addresses-provider/mock'
15
2
  import createInMemoryAddressCache from '@exodus/addresses-provider/address-cache-memory'
3
+ import createMockableAddressesProvider from '@exodus/addresses-provider/mock'
4
+ import availableAssetsModuleDefinition from '@exodus/available-assets/module'
5
+ import balancesDefinition from '@exodus/balances/module'
6
+ import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
7
+ import createRemoteConfig from '@exodus/config/remote'
8
+ import enabledAssetsModuleDefinition from '@exodus/enabled-assets/module'
16
9
  import createExodusPricingClient from '@exodus/exodus-pricing-client'
10
+ import featureFlagsDefinition from '@exodus/feature-flags/module'
11
+ import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
12
+ import keychainDefinition from '@exodus/keychain/module'
17
13
  import kycDefinition from '@exodus/kyc/module'
14
+ import personalNotesDefinition from '@exodus/personal-notes/module'
18
15
  import referralsDefinition from '@exodus/referrals/module'
16
+ import walletDefinition from '@exodus/wallet/module'
17
+ import walletAccountsDefinition from '@exodus/wallet-accounts/module'
18
+ import walletCompatibilityModesDefinition from '@exodus/wallet-compatibility-modes/module'
19
+ import EventEmitter from 'events/'
19
20
 
20
21
  import createApplication from '../application'
21
- import { withType } from './utils'
22
22
  import unlockEncryptedStorageDefinition from '../unlock-encrypted-storage'
23
+ import { withType } from './utils'
23
24
 
24
25
  const createModuleDependencies = ({ config }) =>
25
26
  [
@@ -126,6 +127,9 @@ const createModuleDependencies = ({ config }) =>
126
127
  },
127
128
  ],
128
129
  },
130
+ {
131
+ definition: personalNotesDefinition,
132
+ },
129
133
  ].map(withType('module'))
130
134
 
131
135
  export default createModuleDependencies
@@ -1,12 +1,15 @@
1
+ import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
1
2
  import marketHistoryMonitorDefinition from '@exodus/market-history/module'
2
3
  import ratesMonitorDefinition from '@exodus/rates-monitor/module'
3
4
 
4
5
  import { withType } from './utils'
5
- import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
6
6
 
7
7
  const createMonitorDependencies = () =>
8
8
  [
9
- { definition: geolocationMonitorDefinition },
9
+ {
10
+ definition: geolocationMonitorDefinition,
11
+ writesAtoms: ['geolocationAtom'],
12
+ },
10
13
  {
11
14
  definition: marketHistoryMonitorDefinition,
12
15
  storage: { namespace: 'marketHistory' },
package/src/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { pick } from '@exodus/basic-utils'
2
- import createIOC from './ioc'
3
- import createApi from './api'
4
- import { createLoadWalletAccountsHandler } from './utils/blockchain-metadata'
2
+ import { PersonalNoteSet } from '@exodus/models'
5
3
 
6
- import attachPlugins from './plugins/attach'
4
+ import createApi from './api'
7
5
  import attachAtoms from './atoms/attach'
8
6
  import { atomsToAttach } from './constants'
7
+ import createIOC from './ioc'
8
+ import attachPlugins from './plugins/attach'
9
+ import { createLoadWalletAccountsHandler } from './utils/blockchain-metadata'
9
10
 
10
11
  const createExodus = ({ adapters, config, port }) => {
11
12
  const ioc = createIOC({ adapters, config })
@@ -16,6 +17,8 @@ const createExodus = ({ adapters, config, port }) => {
16
17
 
17
18
  const { assetsModule, storage } = ioc.getByType('adapter')
18
19
 
20
+ const { personalNotesAtom } = ioc.getByType('atom')
21
+
19
22
  const {
20
23
  application,
21
24
  blockchainMetadata,
@@ -47,6 +50,9 @@ const createExodus = ({ adapters, config, port }) => {
47
50
 
48
51
  // TODO: migrate to marketHistoryAtom. Will be easier once it's on headless
49
52
  marketHistory.on('market-history', (payload) => port.emit('market-history', payload))
53
+ marketHistory.on('market-history-new-assets', (payload) =>
54
+ port.emit('market-history-new-assets', payload)
55
+ )
50
56
 
51
57
  // TODO: migrate to ratesAtom. Will be easier once it's on headless
52
58
  ratesMonitor.on('rates', (payload) => port.emit('rates', payload))
@@ -54,6 +60,7 @@ const createExodus = ({ adapters, config, port }) => {
54
60
  application.hook('start', () => {
55
61
  remoteConfig.load()
56
62
  featureFlags.load()
63
+ geolocationMonitor.start()
57
64
 
58
65
  port.emit('start')
59
66
  })
@@ -64,7 +71,6 @@ const createExodus = ({ adapters, config, port }) => {
64
71
  remoteConfig.sync()
65
72
  marketHistory.start()
66
73
  ratesMonitor.start()
67
- geolocationMonitor.start()
68
74
 
69
75
  await assetsModule.load()
70
76
  await walletAccounts.load()
@@ -94,6 +100,9 @@ const createExodus = ({ adapters, config, port }) => {
94
100
  enabledAssets.clear(),
95
101
  ])
96
102
 
103
+ // TEMP: dont wait for set to complete as encrypted storage is not yet unlocked
104
+ personalNotesAtom.set(PersonalNoteSet.EMPTY)
105
+
97
106
  port.emit('clear')
98
107
  })
99
108