@exodus/headless 2.0.0-alpha.16 → 2.0.0-alpha.18
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 +20 -0
- package/package.json +10 -8
- package/src/constants.js +1 -0
- package/src/dependencies/atom-collections.js +25 -0
- package/src/dependencies/atoms.js +2 -0
- package/src/dependencies/index.js +4 -0
- package/src/dependencies/modules.js +2 -0
- package/src/index.js +6 -12
- package/src/utils/blockchain-metadata.js +2 -39
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.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
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- announce that featureFlags writes to featureFlagAtoms ([#1548](https://github.com/ExodusMovement/exodus-hydra/issues/1548)) ([fefac86](https://github.com/ExodusMovement/exodus-hydra/commit/fefac86970ab11e85d530d8424ca9f3de86fed91))
|
|
11
|
+
|
|
12
|
+
## [2.0.0-alpha.17](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.16...@exodus/headless@2.0.0-alpha.17) (2023-05-05)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
- don't serialize port payloads (#1458)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- add feature-flags to headless ([#1516](https://github.com/ExodusMovement/exodus-hydra/issues/1516)) ([9d2da89](https://github.com/ExodusMovement/exodus-hydra/commit/9d2da895d4f58d34674b19d42fe3fd621d439f73))
|
|
21
|
+
|
|
22
|
+
### Code Refactoring
|
|
23
|
+
|
|
24
|
+
- don't serialize port payloads ([#1458](https://github.com/ExodusMovement/exodus-hydra/issues/1458)) ([9b98a28](https://github.com/ExodusMovement/exodus-hydra/commit/9b98a28b091146ad0dee631a236629f25a16b3e2))
|
|
25
|
+
|
|
6
26
|
## [2.0.0-alpha.16](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.15...@exodus/headless@2.0.0-alpha.16) (2023-05-04)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
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.18",
|
|
4
4
|
"description": "The headless Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
"@exodus/balances": "^6.0.0",
|
|
32
32
|
"@exodus/basic-utils": "^2.0.0",
|
|
33
33
|
"@exodus/blockchain-metadata": "^8.0.1",
|
|
34
|
-
"@exodus/config": "7.0.0",
|
|
34
|
+
"@exodus/config": "^7.0.0",
|
|
35
35
|
"@exodus/dependency-injection": "^1.2.0",
|
|
36
|
-
"@exodus/dependency-preprocessors": "^2.
|
|
36
|
+
"@exodus/dependency-preprocessors": "^2.4.0",
|
|
37
37
|
"@exodus/enabled-assets": "^6.0.0",
|
|
38
38
|
"@exodus/exodus-pricing-client": "^1.1.0",
|
|
39
|
+
"@exodus/feature-flags": "^2.0.0",
|
|
39
40
|
"@exodus/fetch": "^1.2.1",
|
|
40
|
-
"@exodus/geolocation": "1.1.0",
|
|
41
|
+
"@exodus/geolocation": "^1.1.0",
|
|
41
42
|
"@exodus/key-identifier-provider": "^1.1.3",
|
|
42
43
|
"@exodus/keychain": "^4.0.0",
|
|
43
44
|
"@exodus/market-history": "^3.1.0",
|
|
@@ -46,9 +47,9 @@
|
|
|
46
47
|
"@exodus/wallet": "^6.0.1",
|
|
47
48
|
"@exodus/wallet-accounts": "^8.0.1",
|
|
48
49
|
"@exodus/wallet-compatibility-modes": "^2.0.0",
|
|
49
|
-
"bip39": "2.6.0",
|
|
50
|
+
"bip39": "^2.6.0",
|
|
50
51
|
"events": "^3.3.0",
|
|
51
|
-
"lodash": "
|
|
52
|
+
"lodash": "npm:@exodus/lodash@^4.17.21-exodus.2",
|
|
52
53
|
"minimalistic-assert": "^1.0.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
@@ -60,14 +61,15 @@
|
|
|
60
61
|
"@exodus/solana-lib": "^1.3.11",
|
|
61
62
|
"@exodus/solana-meta": "^1.0.2",
|
|
62
63
|
"@exodus/storage-encrypted": "^1.1.2",
|
|
63
|
-
"@exodus/storage-memory": "^
|
|
64
|
+
"@exodus/storage-memory": "^2.0.0",
|
|
64
65
|
"@exodus/wild-emitter": "^1.0.0",
|
|
65
66
|
"buffer-json": "^2.0.0",
|
|
66
67
|
"deepmerge": "^4.2.2",
|
|
67
68
|
"eslint": "^8.33.0",
|
|
68
69
|
"events": "^3.3.0",
|
|
69
70
|
"jest": "^29.1.2",
|
|
71
|
+
"nock": "^13.3.1",
|
|
70
72
|
"p-defer": "^4.0.0"
|
|
71
73
|
},
|
|
72
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "4d58c34dbd00a2c3e69f135b68a552676e421e36"
|
|
73
75
|
}
|
package/src/constants.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
featureFlagAtomsDefinition,
|
|
3
|
+
remoteConfigFeatureFlagAtomsDefinition,
|
|
4
|
+
} from '@exodus/feature-flags/atoms'
|
|
5
|
+
|
|
6
|
+
import { withType } from './utils'
|
|
7
|
+
|
|
8
|
+
const createAtomCollectionDependencies = () =>
|
|
9
|
+
[
|
|
10
|
+
{
|
|
11
|
+
definition: remoteConfigFeatureFlagAtomsDefinition,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
definition: featureFlagAtomsDefinition,
|
|
15
|
+
storage: { namespace: 'featureFlags' },
|
|
16
|
+
aliases: [
|
|
17
|
+
{
|
|
18
|
+
implementationId: 'unsafeStorage',
|
|
19
|
+
interfaceId: 'storage',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
].map(withType('atom-collection'))
|
|
24
|
+
|
|
25
|
+
export default createAtomCollectionDependencies
|
|
@@ -16,6 +16,7 @@ import { availableAssetNamesAtomDefinition } from '@exodus/available-assets/atom
|
|
|
16
16
|
import { ratesAtomDefinition } from '@exodus/rates-monitor/atoms'
|
|
17
17
|
import { balancesAtomDefinition } from '@exodus/balances/atoms'
|
|
18
18
|
import createGeolocationAtom from '@exodus/geolocation'
|
|
19
|
+
import { featureFlagsAtomDefinition } from '@exodus/feature-flags/atoms'
|
|
19
20
|
|
|
20
21
|
import { withType } from './utils'
|
|
21
22
|
|
|
@@ -115,6 +116,7 @@ const createAtomDependencies = () =>
|
|
|
115
116
|
dependencies: ['config'],
|
|
116
117
|
},
|
|
117
118
|
},
|
|
119
|
+
{ definition: featureFlagsAtomDefinition },
|
|
118
120
|
].map(withType('atom'))
|
|
119
121
|
|
|
120
122
|
export default createAtomDependencies
|
|
@@ -6,6 +6,7 @@ import assert from 'minimalistic-assert'
|
|
|
6
6
|
import createConfigDependencies from './configs'
|
|
7
7
|
import createAdapterDependencies from './adapters'
|
|
8
8
|
import createAtomDependencies from './atoms'
|
|
9
|
+
import createAtomCollectionDependencies from './atom-collections'
|
|
9
10
|
import createModuleDependencies from './modules'
|
|
10
11
|
import createMonitorDependencies from './monitors'
|
|
11
12
|
import { wrapConstant } from './utils'
|
|
@@ -38,6 +39,8 @@ const createDependencies = ({ adapters, config }) => {
|
|
|
38
39
|
|
|
39
40
|
const atoms = createAtomDependencies({ adapters, config })
|
|
40
41
|
|
|
42
|
+
const atomCollections = createAtomCollectionDependencies({ adapters, config })
|
|
43
|
+
|
|
41
44
|
const adaptersTree = createAdapterDependencies({ adapters, config })
|
|
42
45
|
|
|
43
46
|
const plugins = createPluginDependencies()
|
|
@@ -48,6 +51,7 @@ const createDependencies = ({ adapters, config }) => {
|
|
|
48
51
|
.concat(modules)
|
|
49
52
|
.concat(monitors)
|
|
50
53
|
.concat(atoms)
|
|
54
|
+
.concat(atomCollections)
|
|
51
55
|
.concat(plugins)
|
|
52
56
|
.concat(wrapConstant({ id: 'logger', type: 'module', value: logger }))
|
|
53
57
|
}
|
|
@@ -9,6 +9,7 @@ import availableAssetsModuleDefinition from '@exodus/available-assets/module'
|
|
|
9
9
|
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
|
+
import featureFlagsDefinition from '@exodus/feature-flags/module'
|
|
12
13
|
|
|
13
14
|
import createApplication from '../application'
|
|
14
15
|
import { withType } from './utils'
|
|
@@ -67,6 +68,7 @@ const createModuleDependencies = () =>
|
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
{ definition: balancesDefinition, writesAtoms: ['balancesAtom'] },
|
|
71
|
+
{ definition: featureFlagsDefinition, writesAtoms: ['featureFlagAtoms'] },
|
|
70
72
|
].map(withType('module'))
|
|
71
73
|
|
|
72
74
|
export default createModuleDependencies
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { pick } from '@exodus/basic-utils'
|
|
2
2
|
import createIOC from './ioc'
|
|
3
3
|
import createApi from './api'
|
|
4
|
-
import {
|
|
5
|
-
createAccountStatesUpdateHandler,
|
|
6
|
-
createLoadWalletAccountsHandler,
|
|
7
|
-
} from './utils/blockchain-metadata'
|
|
4
|
+
import { createLoadWalletAccountsHandler } from './utils/blockchain-metadata'
|
|
8
5
|
|
|
9
6
|
import attachPlugins from './plugins/attach'
|
|
10
7
|
import attachAtoms from './atoms/attach'
|
|
@@ -23,6 +20,7 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
23
20
|
application,
|
|
24
21
|
blockchainMetadata,
|
|
25
22
|
enabledAssets,
|
|
23
|
+
featureFlags,
|
|
26
24
|
remoteConfig,
|
|
27
25
|
unlockEncryptedStorage,
|
|
28
26
|
walletAccounts,
|
|
@@ -33,18 +31,13 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
33
31
|
const handleLoadWalletAccounts = createLoadWalletAccountsHandler({
|
|
34
32
|
blockchainMetadata,
|
|
35
33
|
port,
|
|
36
|
-
config,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const handleAccountStatesUpdate = createAccountStatesUpdateHandler({
|
|
40
|
-
blockchainMetadata,
|
|
41
|
-
port,
|
|
42
|
-
config,
|
|
43
34
|
})
|
|
44
35
|
|
|
45
36
|
blockchainMetadata.on('load-wallet-accounts', handleLoadWalletAccounts)
|
|
46
37
|
blockchainMetadata.on('tx-logs-update', (payload) => port.emit('tx-logs-update', payload))
|
|
47
|
-
blockchainMetadata.on('account-states-update',
|
|
38
|
+
blockchainMetadata.on('account-states-update', (payload) =>
|
|
39
|
+
port.emit('account-states-update', payload)
|
|
40
|
+
)
|
|
48
41
|
|
|
49
42
|
remoteConfig.on('sync', ({ current }) => port.emit('remote-config', current))
|
|
50
43
|
|
|
@@ -56,6 +49,7 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
56
49
|
|
|
57
50
|
application.hook('start', () => {
|
|
58
51
|
remoteConfig.load()
|
|
52
|
+
featureFlags.load()
|
|
59
53
|
|
|
60
54
|
port.emit('start')
|
|
61
55
|
})
|
|
@@ -1,41 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const createAccountStatesTransformer = ({ serializePortPayloads, blockchainMetadata }) => {
|
|
4
|
-
return serializePortPayloads
|
|
5
|
-
? (payload) =>
|
|
6
|
-
mapValues(payload, (byAsset, walletAccount) =>
|
|
7
|
-
mapValues(
|
|
8
|
-
byAsset,
|
|
9
|
-
(accountState, assetName) =>
|
|
10
|
-
blockchainMetadata.serializePayload({ walletAccount, assetName, accountState })
|
|
11
|
-
.accountState
|
|
12
|
-
)
|
|
13
|
-
)
|
|
14
|
-
: (payload) => payload
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function createAccountStatesUpdateHandler({
|
|
18
|
-
port,
|
|
19
|
-
blockchainMetadata,
|
|
20
|
-
config: { serializePortPayloads = false },
|
|
21
|
-
}) {
|
|
22
|
-
const transform = createAccountStatesTransformer({ serializePortPayloads, blockchainMetadata })
|
|
23
|
-
|
|
24
|
-
return (payload) => {
|
|
25
|
-
port.emit('account-states-update', transform(payload))
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createLoadWalletAccountsHandler({
|
|
30
|
-
port,
|
|
31
|
-
blockchainMetadata,
|
|
32
|
-
config: { serializePortPayloads = false },
|
|
33
|
-
}) {
|
|
34
|
-
const transformAccountStates = createAccountStatesTransformer({
|
|
35
|
-
serializePortPayloads,
|
|
36
|
-
blockchainMetadata,
|
|
37
|
-
})
|
|
38
|
-
|
|
1
|
+
export function createLoadWalletAccountsHandler({ port, blockchainMetadata }) {
|
|
39
2
|
return async () => {
|
|
40
3
|
const [txLogs, accountStates] = await Promise.all([
|
|
41
4
|
blockchainMetadata.getLoadedTxLogs(),
|
|
@@ -43,6 +6,6 @@ export function createLoadWalletAccountsHandler({
|
|
|
43
6
|
])
|
|
44
7
|
|
|
45
8
|
port.emit('tx-logs', txLogs)
|
|
46
|
-
port.emit('account-states',
|
|
9
|
+
port.emit('account-states', accountStates)
|
|
47
10
|
}
|
|
48
11
|
}
|