@exodus/headless 2.0.0-alpha.68 → 2.0.0-alpha.70
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 +17 -0
- package/package.json +4 -4
- package/src/index.js +1 -3
- package/src/plugins/attach.js +12 -1
- package/src/features/geolocation/index.js +0 -20
- package/src/features/geolocation/plugin.js +0 -15
- package/src/features/nfts/api.js +0 -14
- package/src/features/nfts/index.js +0 -33
- package/src/features/nfts/plugin.js +0 -24
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.70](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.68...@exodus/headless@2.0.0-alpha.70) (2023-07-14)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- nfts feature out of headless (#2588)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- geolocation feature ([#2600](https://github.com/ExodusMovement/exodus-hydra/issues/2600)) ([457df6f](https://github.com/ExodusMovement/exodus-hydra/commit/457df6f8e8ef1f515914b901202b5b81cca59b4b))
|
|
15
|
+
- nfts feature out of headless ([#2588](https://github.com/ExodusMovement/exodus-hydra/issues/2588)) ([86ac6f5](https://github.com/ExodusMovement/exodus-hydra/commit/86ac6f516d7d39fbe5174c3d31ab82f5561b17aa))
|
|
16
|
+
|
|
17
|
+
## [2.0.0-alpha.69](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.68...@exodus/headless@2.0.0-alpha.69) (2023-07-14)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- geolocation feature ([#2600](https://github.com/ExodusMovement/exodus-hydra/issues/2600)) ([457df6f](https://github.com/ExodusMovement/exodus-hydra/commit/457df6f8e8ef1f515914b901202b5b81cca59b4b))
|
|
22
|
+
|
|
6
23
|
## [2.0.0-alpha.68](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/headless@2.0.0-alpha.67...@exodus/headless@2.0.0-alpha.68) (2023-07-13)
|
|
7
24
|
|
|
8
25
|
### ⚠ BREAKING CHANGES
|
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.70",
|
|
4
4
|
"description": "The platform-agnostic Exodus wallet SDK",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -42,12 +42,11 @@
|
|
|
42
42
|
"@exodus/fee-monitors": "^1.0.0",
|
|
43
43
|
"@exodus/fetch": "^1.2.1",
|
|
44
44
|
"@exodus/fusion": "^6.0.0",
|
|
45
|
-
"@exodus/geolocation": "^2.0
|
|
45
|
+
"@exodus/geolocation": "^2.1.0",
|
|
46
46
|
"@exodus/key-identifier-provider": "^1.1.3",
|
|
47
47
|
"@exodus/keychain": "^4.1.0",
|
|
48
48
|
"@exodus/market-history": "^5.0.0",
|
|
49
49
|
"@exodus/module": "^1.0.0",
|
|
50
|
-
"@exodus/nfts": "^2.1.1",
|
|
51
50
|
"@exodus/rates-monitor": "^2.0.1",
|
|
52
51
|
"@exodus/restore-progress-tracker": "^2.0.0",
|
|
53
52
|
"@exodus/wallet": "^6.3.0",
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
"@exodus/ethereum-meta": "^1.0.23",
|
|
73
72
|
"@exodus/kyc": "^4.0.0",
|
|
74
73
|
"@exodus/models": "^8.11.1",
|
|
74
|
+
"@exodus/nfts": "^3.0.0",
|
|
75
75
|
"@exodus/personal-notes": "^3.3.0",
|
|
76
76
|
"@exodus/referrals": "^6.2.0",
|
|
77
77
|
"@exodus/solana-lib": "^1.3.11",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"nock": "^13.3.1",
|
|
91
91
|
"p-defer": "^4.0.0"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "d1190f7eeeec96c479b92a16d39e9660556b764e"
|
|
94
94
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import addressProvider from '@exodus/address-provider'
|
|
2
2
|
import { pick } from '@exodus/basic-utils'
|
|
3
3
|
import blockchainMetadata from '@exodus/blockchain-metadata'
|
|
4
|
+
import geolocation from '@exodus/geolocation'
|
|
4
5
|
import keychain from '@exodus/keychain'
|
|
5
6
|
import marketHistory from '@exodus/market-history'
|
|
6
7
|
import restoreProgressTracker from '@exodus/restore-progress-tracker'
|
|
@@ -15,9 +16,7 @@ import balances from './features/balances'
|
|
|
15
16
|
import enabledAssets from './features/enabled-assets'
|
|
16
17
|
import featureFlags from './features/feature-flags'
|
|
17
18
|
import fees from './features/fees'
|
|
18
|
-
import geolocation from './features/geolocation'
|
|
19
19
|
import locale from './features/locale'
|
|
20
|
-
import nfts from './features/nfts'
|
|
21
20
|
import pricing from './features/pricing'
|
|
22
21
|
import rates from './features/rates'
|
|
23
22
|
import remoteConfig from './features/remote-config'
|
|
@@ -43,7 +42,6 @@ const createExodus = ({ adapters, config, port }) => {
|
|
|
43
42
|
ioc.use(rates())
|
|
44
43
|
ioc.use(featureFlags())
|
|
45
44
|
ioc.use(locale())
|
|
46
|
-
ioc.use(nfts())
|
|
47
45
|
ioc.use(addressProvider({ config: config.addressProvider }))
|
|
48
46
|
ioc.use(restoreProgressTracker())
|
|
49
47
|
|
package/src/plugins/attach.js
CHANGED
|
@@ -8,13 +8,24 @@ const LIFECYCLE_METHOD_TO_HOOK_NAME = Object.fromEntries(
|
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
const attachPlugins = ({ plugins, application, logger }) => {
|
|
11
|
+
const timeFn =
|
|
12
|
+
(fn, name) =>
|
|
13
|
+
async (...args) => {
|
|
14
|
+
const start = Date.now()
|
|
15
|
+
try {
|
|
16
|
+
return await fn(...args)
|
|
17
|
+
} finally {
|
|
18
|
+
logger.debug(name, `${Date.now() - start}ms`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
Object.entries(plugins).forEach(([name, lifecycleMethods]) => {
|
|
12
23
|
const entries = Object.entries(lifecycleMethods || {})
|
|
13
24
|
|
|
14
25
|
for (const [lifecycleMethod, fn] of entries) {
|
|
15
26
|
const hookName = LIFECYCLE_METHOD_TO_HOOK_NAME[lifecycleMethod]
|
|
16
27
|
if (hookName) {
|
|
17
|
-
application.hook(hookName, fn)
|
|
28
|
+
application.hook(hookName, timeFn(fn, `plugin ${name}.${lifecycleMethod}`))
|
|
18
29
|
} else {
|
|
19
30
|
logger.error(`plugin "${name}" declares unsupported lifecycle method "${lifecycleMethod}"`)
|
|
20
31
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
|
|
2
|
-
import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
|
|
3
|
-
|
|
4
|
-
import geolocationPluginDefinition from './plugin'
|
|
5
|
-
|
|
6
|
-
const geolocation = () => {
|
|
7
|
-
return {
|
|
8
|
-
id: 'geolocation',
|
|
9
|
-
definitions: [
|
|
10
|
-
{ definition: geolocationAtomDefinition },
|
|
11
|
-
{
|
|
12
|
-
definition: geolocationMonitorDefinition,
|
|
13
|
-
writesAtoms: ['geolocationAtom'],
|
|
14
|
-
},
|
|
15
|
-
{ definition: geolocationPluginDefinition },
|
|
16
|
-
],
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default geolocation
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const createGeolocationLifecyclePlugin = ({ geolocationMonitor }) => {
|
|
2
|
-
const onStart = async () => {
|
|
3
|
-
geolocationMonitor.start()
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
return { onStart }
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line @exodus/export-default/named
|
|
10
|
-
export default {
|
|
11
|
-
id: 'geolocationLifecyclePlugin',
|
|
12
|
-
type: 'plugin',
|
|
13
|
-
factory: createGeolocationLifecyclePlugin,
|
|
14
|
-
dependencies: ['geolocationMonitor'],
|
|
15
|
-
}
|
package/src/features/nfts/api.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const createNftsApi = ({ nfts, nftsMonitor }) => ({
|
|
2
|
-
nfts: {
|
|
3
|
-
upsertConfig: nfts.upsertConfig,
|
|
4
|
-
setMonitorInterval: nftsMonitor.setInterval,
|
|
5
|
-
},
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @exodus/export-default/named
|
|
9
|
-
export default {
|
|
10
|
-
id: 'createNftsApi',
|
|
11
|
-
type: 'api',
|
|
12
|
-
factory: createNftsApi,
|
|
13
|
-
dependencies: ['nfts', 'nftsMonitor'],
|
|
14
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { nftsCacheAtomDefinition, nftsConfigsAtomDefinition } from '@exodus/nfts/atoms'
|
|
2
|
-
import nftsModuleDefinition from '@exodus/nfts/module'
|
|
3
|
-
import nftsMonitorDefinition from '@exodus/nfts/monitor'
|
|
4
|
-
|
|
5
|
-
import nftsApiDefinition from './api'
|
|
6
|
-
import nftsPluginDefinition from './plugin'
|
|
7
|
-
|
|
8
|
-
// TODO: Add type to module definitions
|
|
9
|
-
const nfts = () => {
|
|
10
|
-
return {
|
|
11
|
-
id: 'nfts',
|
|
12
|
-
definitions: [
|
|
13
|
-
{
|
|
14
|
-
definition: { type: 'atom', ...nftsCacheAtomDefinition },
|
|
15
|
-
storage: { namespace: 'nftsCache' },
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
definition: { type: 'atom', ...nftsConfigsAtomDefinition },
|
|
19
|
-
aliases: [{ implementationId: 'unsafeStorage', interfaceId: 'storage' }],
|
|
20
|
-
storage: { namespace: 'nfts-config' },
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
definition: { type: 'monitor', ...nftsMonitorDefinition },
|
|
24
|
-
writesAtoms: ['nftsCacheAtom'],
|
|
25
|
-
},
|
|
26
|
-
{ definition: nftsModuleDefinition, writesAtoms: ['nftsCacheAtom', 'nftsConfigAtom'] },
|
|
27
|
-
{ definition: nftsPluginDefinition },
|
|
28
|
-
{ definition: nftsApiDefinition },
|
|
29
|
-
],
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default nfts
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const nftsLifecyclePlugin = ({ nfts, nftsMonitor, port }) => {
|
|
2
|
-
// TODO: Move to onStart, but needs testing first
|
|
3
|
-
nftsMonitor.on('nfts', (data) => port.emit('nfts', data))
|
|
4
|
-
nftsMonitor.on('nfts-txs', (data) => port.emit('nfts-txs', data))
|
|
5
|
-
|
|
6
|
-
const onUnlock = () => {
|
|
7
|
-
nfts.load()
|
|
8
|
-
nftsMonitor.start()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const onClear = () => {
|
|
12
|
-
nfts.clear()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return { onUnlock, onClear }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @exodus/export-default/named
|
|
19
|
-
export default {
|
|
20
|
-
id: 'nftsLifecyclePlugin',
|
|
21
|
-
type: 'plugin',
|
|
22
|
-
factory: nftsLifecyclePlugin,
|
|
23
|
-
dependencies: ['nfts', 'nftsMonitor', 'port'],
|
|
24
|
-
}
|