@exodus/market-history 9.0.2 → 9.0.4
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 +12 -0
- package/atoms/index.js +5 -1
- package/module/index.js +11 -8
- package/package.json +5 -5
- package/plugin/index.js +1 -0
- package/redux/initial-state.js +1 -1
- package/redux/selectors/create-asset-daily-prices-loading.js +1 -1
- package/redux/selectors/create-asset-hourly-prices-loading.js +1 -1
- package/redux/selectors/daily-prices.js +1 -1
- package/redux/selectors/fiat-market-history.js +1 -1
- package/redux/selectors/get-asset-daily-price.js +1 -1
- package/redux/selectors/get-asset-hourly-price.js +1 -1
- package/redux/selectors/get-price-with-fallback.js +1 -1
- package/redux/selectors/helpers/append-prices-with-rate.js +6 -1
- package/redux/selectors/helpers/memoize-get-asset-price.js +1 -1
- package/redux/selectors/helpers/memoize-get-price.js +1 -1
- package/redux/selectors/hourly-prices.js +1 -1
- package/utils.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [9.0.4](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@9.0.3...@exodus/market-history@9.0.4) (2024-07-25)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **market-history:** harden against prototype pollution bugs ([#8079](https://github.com/ExodusMovement/exodus-hydra/issues/8079)) ([3715950](https://github.com/ExodusMovement/exodus-hydra/commit/3715950347c3228e7a156952430b6b1f41901847))
|
|
11
|
+
|
|
12
|
+
## [9.0.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@9.0.2...@exodus/market-history@9.0.3) (2024-07-25)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- migrate definitions ([#8030](https://github.com/ExodusMovement/exodus-hydra/issues/8030)) ([d2dfde5](https://github.com/ExodusMovement/exodus-hydra/commit/d2dfde55dfa843eb52842f64b3aac3a6f9a59069))
|
|
17
|
+
|
|
6
18
|
## [9.0.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@9.0.1...@exodus/market-history@9.0.2) (2024-07-18)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @exodus/market-history
|
package/atoms/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import { createRemoteConfigAtomFactory } from '@exodus/remote-config-atoms'
|
|
|
4
4
|
export const marketHistoryAtomDefinition = {
|
|
5
5
|
id: 'marketHistoryAtom',
|
|
6
6
|
type: 'atom',
|
|
7
|
-
factory: () => createInMemoryAtom(
|
|
7
|
+
factory: () => createInMemoryAtom(Object.create(null)), // eslint-disable-line @exodus/hydra/in-memory-atom-default-value
|
|
8
8
|
dependencies: [],
|
|
9
|
+
public: true,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const marketHistoryRefreshIntervalAtomDefinition = {
|
|
@@ -13,6 +14,7 @@ export const marketHistoryRefreshIntervalAtomDefinition = {
|
|
|
13
14
|
type: 'atom',
|
|
14
15
|
factory: ({ config, remoteConfig }) => createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
15
16
|
dependencies: ['config', 'remoteConfig'],
|
|
17
|
+
public: true,
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export const marketHistoryClearCacheAtomDefinition = {
|
|
@@ -20,6 +22,7 @@ export const marketHistoryClearCacheAtomDefinition = {
|
|
|
20
22
|
type: 'atom',
|
|
21
23
|
factory: ({ config }) => createInMemoryAtom(config),
|
|
22
24
|
dependencies: ['config'],
|
|
25
|
+
public: true,
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
export const remoteConfigClearMarketHistoryCacheAtomDefinition = {
|
|
@@ -27,4 +30,5 @@ export const remoteConfigClearMarketHistoryCacheAtomDefinition = {
|
|
|
27
30
|
type: 'atom',
|
|
28
31
|
factory: ({ config, remoteConfig }) => createRemoteConfigAtomFactory({ remoteConfig })(config),
|
|
29
32
|
dependencies: ['config', 'remoteConfig'],
|
|
33
|
+
public: true,
|
|
30
34
|
}
|
package/module/index.js
CHANGED
|
@@ -145,7 +145,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
return acc
|
|
148
|
-
},
|
|
148
|
+
}, Object.create(null))
|
|
149
149
|
|
|
150
150
|
if (!hasChanges) return
|
|
151
151
|
await this.storage.batchSet(changes)
|
|
@@ -175,7 +175,8 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
175
175
|
const assets = this.assetsModule.getAssets()
|
|
176
176
|
const assetTickers = assetNames.map((assetName) => assets[assetName].ticker)
|
|
177
177
|
|
|
178
|
-
const cacheRefreshData =
|
|
178
|
+
const cacheRefreshData =
|
|
179
|
+
(await this.storage.get(MARKET_HISTORY_REFRESH_KEY)) || Object.create(null)
|
|
179
180
|
|
|
180
181
|
const cacheRefreshKey = `${granularity}-${currency}`
|
|
181
182
|
const latestRefreshTimestamp = cacheRefreshData[cacheRefreshKey] || 0
|
|
@@ -250,7 +251,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
250
251
|
await this.#marketHistoryAtom.set(async (current) => ({
|
|
251
252
|
data: mergePricesInAtom({
|
|
252
253
|
prices,
|
|
253
|
-
atomData: current?.data ??
|
|
254
|
+
atomData: current?.data ?? Object.create(null),
|
|
254
255
|
currency,
|
|
255
256
|
parsedGranularity,
|
|
256
257
|
}),
|
|
@@ -299,7 +300,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
299
300
|
const promises = granularities.map((granularity) => this.#updateAssets(granularity, assetNames))
|
|
300
301
|
|
|
301
302
|
const results = await Promise.all(promises)
|
|
302
|
-
let changes =
|
|
303
|
+
let changes = Object.create(null)
|
|
303
304
|
const updateChanges = ({ prices, granularity }) => {
|
|
304
305
|
changes = {
|
|
305
306
|
...changes,
|
|
@@ -319,7 +320,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
319
320
|
|
|
320
321
|
if (Object.keys(changes).length > 0) {
|
|
321
322
|
await this.#marketHistoryAtom.set((current) => {
|
|
322
|
-
let data = current?.data ??
|
|
323
|
+
let data = current?.data ?? Object.create(null)
|
|
323
324
|
granularities.forEach((granularity, index) => {
|
|
324
325
|
const result = results[index]
|
|
325
326
|
if (result) {
|
|
@@ -400,7 +401,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
400
401
|
enabledAssets: this.#enabledAssetsAtom,
|
|
401
402
|
})
|
|
402
403
|
|
|
403
|
-
await difference(combinedAtom).observe(({ current, previous =
|
|
404
|
+
await difference(combinedAtom).observe(({ current, previous = Object.create(null) }) => {
|
|
404
405
|
const { currency, enabledAssets } = current
|
|
405
406
|
const { currency: previousCurrency, enabledAssets: previousEnabledAssets } = previous
|
|
406
407
|
if (!enabledAssets || Object.keys(enabledAssets).length === 0) return
|
|
@@ -504,7 +505,7 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
504
505
|
prices: {
|
|
505
506
|
[assetName]: transformedPrices,
|
|
506
507
|
},
|
|
507
|
-
atomData: current?.data ??
|
|
508
|
+
atomData: current?.data ?? Object.create(null),
|
|
508
509
|
currency,
|
|
509
510
|
parsedGranularity: parseGranularity(granularity),
|
|
510
511
|
})
|
|
@@ -517,7 +518,8 @@ class MarketHistoryMonitor extends ExodusModule {
|
|
|
517
518
|
)
|
|
518
519
|
}
|
|
519
520
|
|
|
520
|
-
const createMarketHistoryMonitor = (args =
|
|
521
|
+
const createMarketHistoryMonitor = (args = Object.create(null)) =>
|
|
522
|
+
new MarketHistoryMonitor({ ...args })
|
|
521
523
|
|
|
522
524
|
const marketHistoryMonitorDefinition = {
|
|
523
525
|
id: MODULE_ID,
|
|
@@ -538,6 +540,7 @@ const marketHistoryMonitorDefinition = {
|
|
|
538
540
|
'config',
|
|
539
541
|
'synchronizedTime',
|
|
540
542
|
],
|
|
543
|
+
public: true,
|
|
541
544
|
}
|
|
542
545
|
|
|
543
546
|
export default marketHistoryMonitorDefinition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/market-history",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.4",
|
|
4
4
|
"description": "Fetches historical prices for assets",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@exodus/assets": "^8.0.94",
|
|
38
38
|
"@exodus/assets-base": "^8.1.6",
|
|
39
|
-
"@exodus/assets-feature": "^5.8.
|
|
39
|
+
"@exodus/assets-feature": "^5.8.2",
|
|
40
40
|
"@exodus/bitcoin-meta": "^1.0.1",
|
|
41
41
|
"@exodus/ethereum-meta": "^1.0.30",
|
|
42
|
-
"@exodus/locale": "^2.2.
|
|
42
|
+
"@exodus/locale": "^2.2.2",
|
|
43
43
|
"@exodus/logger": "^1.1.0",
|
|
44
|
-
"@exodus/rates-monitor": "^4.3.
|
|
44
|
+
"@exodus/rates-monitor": "^4.3.3",
|
|
45
45
|
"@exodus/redux-dependency-injection": "^3.2.3",
|
|
46
46
|
"@exodus/storage-memory": "^2.1.1",
|
|
47
47
|
"events": "^3.3.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"type": "git",
|
|
56
56
|
"url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "0899fc085ddbe0bad881ac5b868a333b250d963d"
|
|
59
59
|
}
|
package/plugin/index.js
CHANGED
|
@@ -52,6 +52,7 @@ const marketHistoryLifecyclePluginDefinition = {
|
|
|
52
52
|
type: 'plugin',
|
|
53
53
|
factory: createMarketHistoryLifecyclePlugin,
|
|
54
54
|
dependencies: ['marketHistoryMonitor', 'marketHistoryAtom', 'appProcessAtom?', 'port'],
|
|
55
|
+
public: true,
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export default marketHistoryLifecyclePluginDefinition
|
package/redux/initial-state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memoize } from 'lodash'
|
|
1
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
import assetLoadingResultFunc from './helpers/asset-loading-result-func'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memoize } from 'lodash'
|
|
1
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
import assetLoadingResultFunc from './helpers/asset-loading-result-func'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memoize } from 'lodash'
|
|
1
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
import { createSelector } from 'reselect'
|
|
3
3
|
import memoizeGetAssetPrice from './helpers/memoize-get-asset-price'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memoize } from 'lodash'
|
|
1
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
2
2
|
|
|
3
3
|
import { createSelector } from 'reselect'
|
|
4
4
|
import memoizeGetAssetPrices from './helpers/memoize-get-asset-price'
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { prepareTime } from './date-utils'
|
|
2
2
|
|
|
3
|
-
const appendPricesWithRate = ({
|
|
3
|
+
const appendPricesWithRate = ({
|
|
4
|
+
historicalPrices = Object.create(null),
|
|
5
|
+
rate,
|
|
6
|
+
type,
|
|
7
|
+
currentTime,
|
|
8
|
+
}) => {
|
|
4
9
|
if (historicalPrices instanceof Error) return null
|
|
5
10
|
if (rate && rate.price) {
|
|
6
11
|
const time = prepareTime(new Date(currentTime), type)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import appendPricesWithRate from './append-prices-with-rate'
|
|
2
|
-
import { memoize } from 'lodash'
|
|
2
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
3
3
|
import { prepareTime } from './date-utils'
|
|
4
4
|
|
|
5
5
|
const memoizeGetAssetPrices = (historicalPrices, rate, type, currentTime) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import appendPricesWithRate from './append-prices-with-rate'
|
|
2
|
-
import { memoize } from 'lodash'
|
|
2
|
+
import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
|
|
3
3
|
import { prepareTime } from './date-utils'
|
|
4
4
|
|
|
5
5
|
const memoizeGetPrices = (getAssetPrices, rates, type, assets, currentTime) => {
|
package/utils.js
CHANGED