@exodus/market-history 4.0.1 → 5.0.0
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 +10 -0
- package/atoms/index.js +22 -1
- package/index.js +53 -0
- package/module/index.js +1 -1
- package/package.json +5 -2
- package/plugin/index.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
## [5.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@4.0.1...@exodus/market-history@5.0.0) (2023-07-06)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- market-history feature (#2361)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- market-history feature ([#2361](https://github.com/ExodusMovement/exodus-hydra/issues/2361)) ([9132471](https://github.com/ExodusMovement/exodus-hydra/commit/9132471cafdf95f46760b6d4528e91210493cab1))
|
|
15
|
+
|
|
6
16
|
## [4.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@4.0.0...@exodus/market-history@4.0.1) (2023-07-05)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/atoms/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createInMemoryAtom } from '@exodus/atoms'
|
|
1
|
+
import { createInMemoryAtom, createRemoteConfigAtomFactory } from '@exodus/atoms'
|
|
2
2
|
|
|
3
3
|
export const marketHistoryAtomDefinition = {
|
|
4
4
|
id: 'marketHistoryAtom',
|
|
@@ -6,3 +6,24 @@ export const marketHistoryAtomDefinition = {
|
|
|
6
6
|
factory: () => createInMemoryAtom({}),
|
|
7
7
|
dependencies: [],
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
export const marketHistoryRefreshIntervalAtomDefinition = {
|
|
11
|
+
id: 'marketHistoryRefreshIntervalAtom',
|
|
12
|
+
type: 'atom',
|
|
13
|
+
factory: ({ config, remoteConfig }) => createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
14
|
+
dependencies: ['config', 'remoteConfig'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const marketHistoryClearCacheAtomDefinition = {
|
|
18
|
+
id: 'marketHistoryClearCacheAtom',
|
|
19
|
+
type: 'atom',
|
|
20
|
+
factory: ({ config }) => createInMemoryAtom(config),
|
|
21
|
+
dependencies: ['config'],
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const remoteConfigClearMarketHistoryCacheAtomDefinition = {
|
|
25
|
+
id: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
26
|
+
type: 'atom',
|
|
27
|
+
factory: ({ config, remoteConfig }) => createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
28
|
+
dependencies: ['config', 'remoteConfig'],
|
|
29
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
marketHistoryAtomDefinition,
|
|
3
|
+
marketHistoryClearCacheAtomDefinition,
|
|
4
|
+
marketHistoryRefreshIntervalAtomDefinition,
|
|
5
|
+
remoteConfigClearMarketHistoryCacheAtomDefinition,
|
|
6
|
+
} from './atoms'
|
|
7
|
+
import marketHistoryMonitorDefinition from './module'
|
|
8
|
+
|
|
9
|
+
import marketHistoryPluginDefinition from './plugin'
|
|
10
|
+
|
|
11
|
+
const marketHistory = () => {
|
|
12
|
+
return {
|
|
13
|
+
id: 'marketHistory',
|
|
14
|
+
definitions: [
|
|
15
|
+
{
|
|
16
|
+
definition: { type: 'monitor', ...marketHistoryMonitorDefinition },
|
|
17
|
+
writesAtoms: ['marketHistoryAtom'],
|
|
18
|
+
storage: { namespace: 'marketHistory' },
|
|
19
|
+
aliases: [
|
|
20
|
+
{
|
|
21
|
+
implementationId: 'unsafeStorage',
|
|
22
|
+
interfaceId: 'storage',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
implementationId: 'marketHistoryClearCacheAtom',
|
|
26
|
+
interfaceId: 'clearCacheAtom',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
implementationId: 'remoteConfigClearMarketHistoryCacheAtom',
|
|
30
|
+
interfaceId: 'remoteConfigClearCacheAtom',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
implementationId: 'marketHistoryRefreshIntervalAtom',
|
|
34
|
+
interfaceId: 'remoteConfigRefreshIntervalAtom',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
definition: marketHistoryClearCacheAtomDefinition,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
definition: remoteConfigClearMarketHistoryCacheAtomDefinition,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
definition: marketHistoryRefreshIntervalAtomDefinition,
|
|
46
|
+
},
|
|
47
|
+
{ definition: marketHistoryPluginDefinition },
|
|
48
|
+
{ definition: marketHistoryAtomDefinition },
|
|
49
|
+
],
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default marketHistory
|
package/module/index.js
CHANGED
|
@@ -66,7 +66,7 @@ const _invalidateStorageCache = async ({
|
|
|
66
66
|
const getCacheKeyDefault = ({ currency, assetName, granularity }) =>
|
|
67
67
|
`prices-${currency}-${assetName}-${granularity}`
|
|
68
68
|
|
|
69
|
-
const MODULE_ID = '
|
|
69
|
+
const MODULE_ID = 'marketHistoryMonitor'
|
|
70
70
|
|
|
71
71
|
class MarketHistoryMonitor extends ExodusModule {
|
|
72
72
|
#pricingClient
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/market-history",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Fetches historical prices for assets",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
"lint:fix": "yarn lint --fix",
|
|
10
10
|
"test": "jest"
|
|
11
11
|
},
|
|
12
|
+
"main": "index.js",
|
|
12
13
|
"files": [
|
|
13
14
|
"module",
|
|
14
15
|
"atoms",
|
|
16
|
+
"plugin",
|
|
15
17
|
"utils.js",
|
|
16
18
|
"CHANGELOG.md",
|
|
17
19
|
"README.md",
|
|
20
|
+
"index.js",
|
|
18
21
|
"!**/__tests__/**"
|
|
19
22
|
],
|
|
20
23
|
"dependencies": {
|
|
@@ -43,5 +46,5 @@
|
|
|
43
46
|
"type": "git",
|
|
44
47
|
"url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
|
|
45
48
|
},
|
|
46
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ea31e65df21404fc765c8513fbc9e5d754e7fa1f"
|
|
47
50
|
}
|
package/plugin/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const createMarketHistoryLifecyclePlugin = ({ marketHistoryMonitor, marketHistoryAtom, port }) => {
|
|
2
|
+
marketHistoryAtom.observe(({ data, changes }) =>
|
|
3
|
+
port.emit('market-history', {
|
|
4
|
+
data,
|
|
5
|
+
changes,
|
|
6
|
+
})
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
const onUnlock = () => {
|
|
10
|
+
marketHistoryMonitor.start()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return { onUnlock }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
id: 'marketHistoryLifecyclePlugin',
|
|
18
|
+
type: 'plugin',
|
|
19
|
+
factory: createMarketHistoryLifecyclePlugin,
|
|
20
|
+
dependencies: ['marketHistoryMonitor', 'port', 'marketHistoryAtom'],
|
|
21
|
+
}
|