@exodus/headless 2.0.0-alpha.18 → 2.0.0-alpha.19

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,21 @@
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.19](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.18...@exodus/headless@2.0.0-alpha.19) (2023-05-08)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - use revamped geolocation (#1559)
11
+
12
+ ### Features
13
+
14
+ - add addressesProvider to headless ([#1540](https://github.com/ExodusMovement/exodus-hydra/issues/1540)) ([90e963a](https://github.com/ExodusMovement/exodus-hydra/commit/90e963aafa0bb855d8c857902feac37514985d4a))
15
+ - add kyc and referrals modules to headless ([#1539](https://github.com/ExodusMovement/exodus-hydra/issues/1539)) ([1a0cf7c](https://github.com/ExodusMovement/exodus-hydra/commit/1a0cf7c18cbbfc5f2b92d9720d9cbf17cd850214))
16
+
17
+ ### Code Refactoring
18
+
19
+ - use revamped geolocation ([#1559](https://github.com/ExodusMovement/exodus-hydra/issues/1559)) ([4378d13](https://github.com/ExodusMovement/exodus-hydra/commit/4378d137a67e4836a45c72e6bfc79590d4b7ab20))
20
+
6
21
  ## [2.0.0-alpha.18](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.17...@exodus/headless@2.0.0-alpha.18) (2023-05-05)
7
22
 
8
23
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/headless",
3
- "version": "2.0.0-alpha.18",
3
+ "version": "2.0.0-alpha.19",
4
4
  "description": "The headless Exodus wallet SDK",
5
5
  "author": "Exodus Movement Inc",
6
6
  "main": "src/index.js",
@@ -26,6 +26,7 @@
26
26
  "test": "jest"
27
27
  },
28
28
  "dependencies": {
29
+ "@exodus/addresses-provider": "^3.0.2",
29
30
  "@exodus/atoms": "^3.5.2",
30
31
  "@exodus/available-assets": "^2.0.0",
31
32
  "@exodus/balances": "^6.0.0",
@@ -41,9 +42,11 @@
41
42
  "@exodus/geolocation": "^1.1.0",
42
43
  "@exodus/key-identifier-provider": "^1.1.3",
43
44
  "@exodus/keychain": "^4.0.0",
45
+ "@exodus/kyc": "^3.4.0",
44
46
  "@exodus/market-history": "^3.1.0",
45
47
  "@exodus/module": "^1.0.0",
46
48
  "@exodus/rates-monitor": "^2.0.0",
49
+ "@exodus/referrals": "^5.2.0",
47
50
  "@exodus/wallet": "^6.0.1",
48
51
  "@exodus/wallet-accounts": "^8.0.1",
49
52
  "@exodus/wallet-compatibility-modes": "^2.0.0",
@@ -53,6 +56,8 @@
53
56
  "minimalistic-assert": "^1.0.1"
54
57
  },
55
58
  "devDependencies": {
59
+ "@exodus/algorand-lib": "^2.0.1",
60
+ "@exodus/algorand-meta": "^1.1.4",
56
61
  "@exodus/bitcoin-meta": "^1.0.0",
57
62
  "@exodus/currency": "^2.2.0",
58
63
  "@exodus/ethereum-lib": "^2.22.2",
@@ -61,7 +66,7 @@
61
66
  "@exodus/solana-lib": "^1.3.11",
62
67
  "@exodus/solana-meta": "^1.0.2",
63
68
  "@exodus/storage-encrypted": "^1.1.2",
64
- "@exodus/storage-memory": "^2.0.0",
69
+ "@exodus/storage-memory": "^2.1.0",
65
70
  "@exodus/wild-emitter": "^1.0.0",
66
71
  "buffer-json": "^2.0.0",
67
72
  "deepmerge": "^4.2.2",
@@ -71,5 +76,5 @@
71
76
  "nock": "^13.3.1",
72
77
  "p-defer": "^4.0.0"
73
78
  },
74
- "gitHead": "4d58c34dbd00a2c3e69f135b68a552676e421e36"
79
+ "gitHead": "caf144d4d059cc940c2c70d96407af06bace8038"
75
80
  }
package/src/api.js CHANGED
@@ -3,8 +3,17 @@ import { validateMnemonic as isMnemonicValid } from 'bip39'
3
3
  const createApi = ({ ioc, port }) => {
4
4
  const { assetsModule, passphraseCache } = ioc.getByType('adapter')
5
5
 
6
- const { application, blockchainMetadata, enabledAssets, remoteConfig, wallet, walletAccounts } =
7
- ioc.getByType('module')
6
+ const {
7
+ addressesProvider,
8
+ application,
9
+ blockchainMetadata,
10
+ enabledAssets,
11
+ kyc,
12
+ referrals,
13
+ remoteConfig,
14
+ wallet,
15
+ walletAccounts,
16
+ } = ioc.getByType('module')
8
17
 
9
18
  const { ratesMonitor } = ioc.getByType('monitor')
10
19
 
@@ -77,6 +86,20 @@ const createApi = ({ ioc, port }) => {
77
86
  rates: {
78
87
  refresh: () => ratesMonitor.update(),
79
88
  },
89
+ addressesProvider: {
90
+ getAddress: addressesProvider.getAddress.bind(addressesProvider),
91
+ getSupportedPurposes: addressesProvider.getSupportedPurposes.bind(addressesProvider),
92
+ getReceiveAddress: addressesProvider.getReceiveAddress.bind(addressesProvider),
93
+ },
94
+ kyc: {
95
+ start: kyc.start,
96
+ sync: kyc.sync,
97
+ requestKycToken: kyc.requestKycToken,
98
+ },
99
+ referrals: {
100
+ setReferredBy: referrals.setReferredBy,
101
+ referralCodeExists: referrals.referralCodeExists,
102
+ },
80
103
  isMnemonicValid,
81
104
  subscribe: port.subscribe.bind(port),
82
105
  unsubscribe: port.unsubscribe.bind(port),
package/src/constants.js CHANGED
@@ -5,6 +5,8 @@ export const atomsToAttach = [
5
5
  'enabledWalletAccountsAtom',
6
6
  'featureFlagsAtom',
7
7
  'geolocationAtom',
8
+ 'kycAtom',
8
9
  'languageAtom',
10
+ 'referralsAtom',
9
11
  'walletAccountsAtom',
10
12
  ]
@@ -15,10 +15,12 @@ import {
15
15
  import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atoms'
16
16
  import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
17
17
  import { balancesAtomDefinition } from '@exodus/balances/atoms'
18
- import createGeolocationAtom from '@exodus/geolocation'
19
18
  import { featureFlagsAtomDefinition } from '@exodus/feature-flags/atoms'
19
+ import { kycAtomDefinition } from '@exodus/kyc/atoms'
20
+ import { referralsAtomDefinition } from '@exodus/referrals/atoms'
20
21
 
21
22
  import { withType } from './utils'
23
+ import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
22
24
 
23
25
  const createAtomDependencies = () =>
24
26
  [
@@ -109,14 +111,10 @@ const createAtomDependencies = () =>
109
111
  },
110
112
  { definition: balancesAtomDefinition },
111
113
  { definition: ratesAtomDefinition },
112
- {
113
- definition: {
114
- id: 'geolocationAtom',
115
- factory: createGeolocationAtom,
116
- dependencies: ['config'],
117
- },
118
- },
114
+ { definition: geolocationAtomDefinition },
119
115
  { definition: featureFlagsAtomDefinition },
116
+ { definition: kycAtomDefinition },
117
+ { definition: referralsAtomDefinition },
120
118
  ].map(withType('atom'))
121
119
 
122
120
  export default createAtomDependencies
@@ -10,11 +10,15 @@ import createKeyIdentifierProvider from '@exodus/key-identifier-provider'
10
10
  import walletCompatibilityModesDefinition from '@exodus/wallet-compatibility-modes/module'
11
11
  import balancesDefinition from '@exodus/balances/module'
12
12
  import featureFlagsDefinition from '@exodus/feature-flags/module'
13
+ import createAddressesProvider from '@exodus/addresses-provider'
14
+ import createInMemoryAddressCache from '@exodus/addresses-provider/address-cache-memory'
15
+ import createExodusPricingClient from '@exodus/exodus-pricing-client'
16
+ import kycDefinition from '@exodus/kyc/module'
17
+ import referralsDefinition from '@exodus/referrals/module'
13
18
 
14
19
  import createApplication from '../application'
15
20
  import { withType } from './utils'
16
21
  import unlockEncryptedStorageDefinition from '../unlock-encrypted-storage'
17
- import createExodusPricingClient from '@exodus/exodus-pricing-client'
18
22
 
19
23
  const createModuleDependencies = () =>
20
24
  [
@@ -68,7 +72,44 @@ const createModuleDependencies = () =>
68
72
  },
69
73
  },
70
74
  { definition: balancesDefinition, writesAtoms: ['balancesAtom'] },
71
- { definition: featureFlagsDefinition, writesAtoms: ['featureFlagAtoms'] },
75
+ {
76
+ definition: featureFlagsDefinition,
77
+ writesAtoms: ['featureFlagAtoms'],
78
+ },
79
+ {
80
+ definition: {
81
+ id: 'addressCache',
82
+ factory: createInMemoryAddressCache,
83
+ },
84
+ },
85
+ {
86
+ definition: {
87
+ id: 'addressesProvider',
88
+ factory: createAddressesProvider,
89
+ dependencies: [
90
+ 'assetsModule',
91
+ 'keychain',
92
+ 'keyIdentifierProvider',
93
+ 'blockchainMetadata',
94
+ 'addressCache',
95
+ ],
96
+ },
97
+ },
98
+ {
99
+ definition: kycDefinition,
100
+ writesAtoms: ['kycAtom'],
101
+ },
102
+ {
103
+ definition: referralsDefinition,
104
+ storage: { namespace: 'referrals' },
105
+ writesAtoms: ['referralsAtom'],
106
+ aliases: [
107
+ {
108
+ implementationId: 'unsafeStorage',
109
+ interfaceId: 'storage',
110
+ },
111
+ ],
112
+ },
72
113
  ].map(withType('module'))
73
114
 
74
115
  export default createModuleDependencies
@@ -2,9 +2,11 @@ import marketHistoryMonitorDefinition from '@exodus/market-history/module'
2
2
  import ratesMonitorDefinition from '@exodus/rates-monitor/module'
3
3
 
4
4
  import { withType } from './utils'
5
+ import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
5
6
 
6
- const createModuleDependencies = () =>
7
+ const createMonitorDependencies = () =>
7
8
  [
9
+ { definition: geolocationMonitorDefinition },
8
10
  {
9
11
  definition: marketHistoryMonitorDefinition,
10
12
  storage: { namespace: 'marketHistory' },
@@ -30,4 +32,4 @@ const createModuleDependencies = () =>
30
32
  { definition: ratesMonitorDefinition, writesAtoms: ['ratesAtom'] },
31
33
  ].map(withType('monitor'))
32
34
 
33
- export default createModuleDependencies
35
+ export default createMonitorDependencies
package/src/index.js CHANGED
@@ -21,12 +21,16 @@ const createExodus = ({ adapters, config, port }) => {
21
21
  blockchainMetadata,
22
22
  enabledAssets,
23
23
  featureFlags,
24
+ kyc,
25
+ referrals,
24
26
  remoteConfig,
25
27
  unlockEncryptedStorage,
26
28
  walletAccounts,
27
29
  } = ioc.getByType('module')
28
30
 
29
- const { marketHistory, ratesMonitor } = ioc.getByType('monitor')
31
+ const { geolocationMonitor, marketHistory, ratesMonitor } = ioc.getByType('monitor')
32
+
33
+ const { featureFlagAtoms } = ioc.getByType('atom-collection')
30
34
 
31
35
  const handleLoadWalletAccounts = createLoadWalletAccountsHandler({
32
36
  blockchainMetadata,
@@ -60,6 +64,7 @@ const createExodus = ({ adapters, config, port }) => {
60
64
  remoteConfig.sync()
61
65
  marketHistory.start()
62
66
  ratesMonitor.start()
67
+ geolocationMonitor.start()
63
68
 
64
69
  await assetsModule.load()
65
70
  await walletAccounts.load()
@@ -68,6 +73,12 @@ const createExodus = ({ adapters, config, port }) => {
68
73
  blockchainMetadata.load(),
69
74
  enabledAssets.load(),
70
75
  ])
76
+
77
+ featureFlagAtoms.referrals?.get().then(({ isOn }) => {
78
+ if (!isOn) return
79
+ kyc.load()
80
+ referrals.load()
81
+ })
71
82
  })
72
83
 
73
84
  application.on('unlock', () => {