@exodus/headless 2.0.0-alpha.52 → 2.0.0-alpha.54

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,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.54](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.53...@exodus/headless@2.0.0-alpha.54) (2023-06-23)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - make personal-notes opt-in (#2102)
11
+
12
+ ### Features
13
+
14
+ - make personal-notes opt-in ([#2102](https://github.com/ExodusMovement/exodus-hydra/issues/2102)) ([324b64e](https://github.com/ExodusMovement/exodus-hydra/commit/324b64e616025ac7bd095028599736c0bfa97f74))
15
+
16
+ ## [2.0.0-alpha.53](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.52...@exodus/headless@2.0.0-alpha.53) (2023-06-23)
17
+
18
+ **Note:** Version bump only for package @exodus/headless
19
+
6
20
  ## [2.0.0-alpha.52](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.51...@exodus/headless@2.0.0-alpha.52) (2023-06-23)
7
21
 
8
22
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.52",
3
+ "version": "2.0.0-alpha.54",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -53,9 +53,7 @@
53
53
  "@exodus/market-history": "^3.1.2",
54
54
  "@exodus/module": "^1.0.0",
55
55
  "@exodus/nfts": "^2.1.1",
56
- "@exodus/personal-notes": "^3.2.1",
57
56
  "@exodus/rates-monitor": "^2.0.1",
58
- "@exodus/referrals": "^6.0.1",
59
57
  "@exodus/top-movers-monitor": "^2.0.1",
60
58
  "@exodus/wallet": "^6.0.1",
61
59
  "@exodus/wallet-accounts": "^8.0.1",
@@ -74,6 +72,8 @@
74
72
  "@exodus/ethereum-lib": "^2.22.2",
75
73
  "@exodus/ethereum-meta": "^1.0.23",
76
74
  "@exodus/models": "^8.11.1",
75
+ "@exodus/personal-notes": "^3.3.0",
76
+ "@exodus/referrals": "^6.0.2",
77
77
  "@exodus/solana-lib": "^1.3.11",
78
78
  "@exodus/solana-meta": "^1.0.2",
79
79
  "@exodus/storage-encrypted": "^1.1.2",
@@ -89,5 +89,5 @@
89
89
  "nock": "^13.3.1",
90
90
  "p-defer": "^4.0.0"
91
91
  },
92
- "gitHead": "610a4fa47f3181e0efd8ad2575199757ee49ab7e"
92
+ "gitHead": "45ca0bd5dd2965bed369371ab8eb0da071964852"
93
93
  }
package/src/index.js CHANGED
@@ -20,10 +20,8 @@ import kyc from './modules/kyc'
20
20
  import locale from './modules/locale'
21
21
  import marketHistory from './modules/market-history'
22
22
  import nfts from './modules/nfts'
23
- import personalNotes from './modules/personal-notes'
24
23
  import pricing from './modules/pricing'
25
24
  import rates from './modules/rates'
26
- import referrals from './modules/referrals'
27
25
  import remoteConfig from './modules/remote-config'
28
26
  import topMovers from './modules/top-movers'
29
27
  import wallet from './modules/wallet'
@@ -51,10 +49,8 @@ const createExodus = ({ adapters, config, port }) => {
51
49
  ioc.use(locale())
52
50
  ioc.use(nfts())
53
51
  ioc.use(kyc())
54
- ioc.use(referrals())
55
52
  ioc.use(connectedOrigins())
56
53
  ioc.use(abTesting())
57
- ioc.use(personalNotes())
58
54
  ioc.use(cryptoNews())
59
55
  ioc.use(topMovers({ config: topMoversMonitor }))
60
56
  ioc.use(addressProvider({ config: config.addressProvider }))
@@ -66,33 +62,51 @@ const createExodus = ({ adapters, config, port }) => {
66
62
 
67
63
  const { assetsModule, storage } = ioc.getByType('adapter')
68
64
 
69
- const { application, unlockEncryptedStorage } = ioc.getByType('module')
65
+ const { application, wallet, unlockEncryptedStorage } = ioc.getByType('module')
70
66
 
71
- application.hook('start', (payload) => {
72
- port.emit('start', payload)
67
+ application.hook('start', (payload) => port.emit('start', payload))
68
+
69
+ application.on('load', (args) => port.emit('load', args))
70
+
71
+ application.on('create', async ({ hasPassphraseSet }) => {
72
+ const isLocked = await wallet.isLocked()
73
+
74
+ port.emit('create', {
75
+ walletExists: true,
76
+ hasPassphraseSet,
77
+ isLocked,
78
+ isBackedUp: false,
79
+ isRestoring: false,
80
+ })
73
81
  })
74
82
 
83
+ application.on('unlock', () => port.emit('unlock'))
84
+
85
+ application.on('lock', () => port.emit('lock'))
86
+
87
+ application.on('backup', () => port.emit('backup'))
88
+
89
+ application.on('restore', () => port.emit('restore'))
90
+
91
+ application.on('restore-completed', () => port.emit('restore-completed'))
92
+
93
+ application.on('change-passphrase', () => port.emit('passphrase-changed'))
94
+
95
+ application.on('import', () => port.emit('import', { walletExists: true }))
96
+
75
97
  application.hook('unlock', async () => {
76
98
  if (typeof storage.unlock === 'function') unlockEncryptedStorage(storage)
77
99
 
78
100
  await assetsModule.load()
79
101
  })
80
102
 
81
- application.on('unlock', () => {
82
- port.emit('unlock')
83
- })
84
-
85
103
  application.hook('clear', async () => {
86
104
  await assetsModule.clear()
87
105
  })
88
106
 
89
- application.on('clear', () => {
90
- port.emit('clear')
91
- })
107
+ application.on('clear', () => port.emit('clear'))
92
108
 
93
- application.on('restart', (payload) => {
94
- port.emit('restart', payload)
95
- })
109
+ application.on('restart', (payload) => port.emit('restart', payload))
96
110
 
97
111
  attachAtoms({
98
112
  port,
@@ -1,12 +0,0 @@
1
- const createPersonalNotesApi = ({ personalNotes }) => ({
2
- personalNotes: {
3
- upsert: personalNotes.upsert,
4
- },
5
- })
6
-
7
- export default {
8
- id: 'createPersonalNotesApi',
9
- type: 'api',
10
- factory: createPersonalNotesApi,
11
- dependencies: ['personalNotes'],
12
- }
@@ -1,31 +0,0 @@
1
- import { personalNotesAtomDefinition } from '@exodus/personal-notes/atoms'
2
- import personalNotesDefinition from '@exodus/personal-notes/module'
3
-
4
- import personalNotesApiDefinition from './api'
5
- import personalNotesPluginDefinition from './plugin'
6
-
7
- // TODO: Add type to module definitions
8
- const personalNotes = () => {
9
- return {
10
- id: 'personalNotes',
11
- definitions: [
12
- {
13
- definition: { type: 'atom', ...personalNotesAtomDefinition },
14
- aliases: [
15
- {
16
- implementationId: 'personalNotesStorage',
17
- interfaceId: 'storage',
18
- },
19
- ],
20
- },
21
- {
22
- definition: { type: 'module', ...personalNotesDefinition },
23
- writesAtoms: ['personalNotesAtom'],
24
- },
25
- { definition: personalNotesPluginDefinition },
26
- { definition: personalNotesApiDefinition },
27
- ],
28
- }
29
- }
30
-
31
- export default personalNotes
@@ -1,15 +0,0 @@
1
- const personalNotesLifecyclePlugin = ({ personalNotes }) => {
2
- // TEMP: dont wait to clear as encrypted storage is not yet unlocked
3
- const onClear = () => {
4
- personalNotes.clear()
5
- }
6
-
7
- return { onClear }
8
- }
9
-
10
- export default {
11
- id: 'personalNotesLifecyclePlugin',
12
- type: 'plugin',
13
- factory: personalNotesLifecyclePlugin,
14
- dependencies: ['personalNotes'],
15
- }
@@ -1,13 +0,0 @@
1
- const referralsApi = ({ referrals }) => ({
2
- referrals: {
3
- setReferredBy: referrals.setReferredBy,
4
- referralCodeExists: referrals.referralCodeExists,
5
- },
6
- })
7
-
8
- export default {
9
- id: 'referralsApi',
10
- type: 'api',
11
- factory: referralsApi,
12
- dependencies: ['referrals'],
13
- }
@@ -1,28 +0,0 @@
1
- import { referralsAtomDefinition } from '@exodus/referrals/atoms'
2
- import referralsDefinition from '@exodus/referrals/module'
3
-
4
- import referralsApi from './api'
5
- import referralsPlugin from './plugin'
6
-
7
- const unsafeStorageAlias = { implementationId: 'unsafeStorage', interfaceId: 'storage' }
8
-
9
- const referrals = ({ namespace = 'referrals', useUnsafeStorage = true } = {}) => {
10
- const aliases = useUnsafeStorage ? [unsafeStorageAlias] : []
11
-
12
- return {
13
- id: 'referrals',
14
- definitions: [
15
- { definition: referralsAtomDefinition },
16
- {
17
- definition: referralsDefinition,
18
- storage: { namespace },
19
- writesAtoms: ['referralsAtom'],
20
- aliases,
21
- },
22
- { definition: referralsPlugin },
23
- { definition: referralsApi },
24
- ],
25
- }
26
- }
27
-
28
- export default referrals
@@ -1,21 +0,0 @@
1
- const referralsPlugin = ({ referrals, featureFlagAtoms }) => {
2
- const onUnlock = () => {
3
- featureFlagAtoms.referrals?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- referrals.load()
6
- })
7
- }
8
-
9
- const onUnload = () => {
10
- referrals.stop()
11
- }
12
-
13
- return { onUnlock, onUnload }
14
- }
15
-
16
- export default {
17
- id: 'referralsLifecyclePlugin',
18
- type: 'plugin',
19
- factory: referralsPlugin,
20
- dependencies: ['referrals', 'featureFlagAtoms'],
21
- }