@exodus/fiat-balances 13.2.1 → 13.4.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 +12 -0
- package/index.js +3 -2
- package/module/fiat-balances.js +11 -7
- package/package.json +8 -8
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
|
+
## [13.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.3.0...@exodus/fiat-balances@13.4.0) (2025-04-01)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: stop exporting report definitions (#11900)
|
|
11
|
+
|
|
12
|
+
## [13.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.2.1...@exodus/fiat-balances@13.3.0) (2025-03-17)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- feat: improve fiat balance perf (#11796)
|
|
17
|
+
|
|
6
18
|
## [13.2.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.2.0...@exodus/fiat-balances@13.2.1) (2025-03-13)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from './atoms'
|
|
7
7
|
import { fiatBalancesPluginDefinition, fiatBalancesAnalyticsPluginDefinition } from './plugin'
|
|
8
8
|
import trackNonDustAssetsNamesPluginDefinition from './plugin/track-non-dust-asset-names'
|
|
9
|
-
import fiatBalancesReportDefinition from './report'
|
|
10
9
|
import { defaultConfig, defaultNonDustAssetsConfig } from './shared'
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -33,7 +32,9 @@ const fiatBalances = (config = Object.create(null)) => {
|
|
|
33
32
|
},
|
|
34
33
|
{ definition: fiatBalancesAtomDefinition },
|
|
35
34
|
{ definition: fiatBalancesPluginDefinition },
|
|
36
|
-
|
|
35
|
+
// This report was intentionally omitted as it did not provide useful value in practice.
|
|
36
|
+
// We prefer less data over more when it's not meaningful, keeping them commented for reference.
|
|
37
|
+
// { definition: fiatBalancesReportDefinition },
|
|
37
38
|
{
|
|
38
39
|
definition: trackNonDustAssetsNamesPluginDefinition,
|
|
39
40
|
config: {
|
package/module/fiat-balances.js
CHANGED
|
@@ -3,7 +3,6 @@ import { isNumberUnit } from '@exodus/currency'
|
|
|
3
3
|
import { cloneDeepWith, isEqual } from 'lodash'
|
|
4
4
|
import fiatCurrencies from '@exodus/fiat-currencies'
|
|
5
5
|
import { combine } from '@exodus/atoms'
|
|
6
|
-
import { getCreateConversion } from '../shared/get-create-conversion.js'
|
|
7
6
|
|
|
8
7
|
// not super efficient, so we're assuming small objects, like { [walletAccount]: xyz }
|
|
9
8
|
const areKeysSame = (a, b) => isEqual(Object.keys(a).sort(), Object.keys(b).sort())
|
|
@@ -70,17 +69,22 @@ class FiatBalances {
|
|
|
70
69
|
)
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
#getCreateConversion = ({ assetName }) => {
|
|
72
|
+
#convertToFiat = ({ assetName, value }) => {
|
|
75
73
|
const fiatCurrency = fiatCurrencies[this.#fiatCurrency]
|
|
74
|
+
if (value.isZero) return fiatCurrency.ZERO
|
|
76
75
|
const rates = this.#cachedRates[this.#fiatCurrency]
|
|
77
76
|
const asset = this.#assetsModule.getAsset(assetName)
|
|
77
|
+
let fiatRate
|
|
78
|
+
// HACK: Super hacky, terrible, the rates state object should have the prices split up by sub-objects per fiat
|
|
79
|
+
if (fiatCurrency.defaultUnit.unitName === 'USD') {
|
|
80
|
+
fiatRate = rates?.[asset.ticker]?.priceUSD || 0
|
|
81
|
+
} else {
|
|
82
|
+
fiatRate = rates?.[asset.ticker]?.price || 0
|
|
83
|
+
}
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
}
|
|
85
|
+
if (fiatRate === 0) return fiatCurrency.ZERO
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
return this.#getCreateConversion({ assetName })(value)
|
|
87
|
+
return fiatCurrency.defaultUnit(value.mul(fiatRate).toDefaultNumber())
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
#maybeRecompute = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.0",
|
|
4
4
|
"description": "Track asset and portfolio fiat balances based on changes in crypto balances and the user's preferred fiat currency",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,25 +45,25 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@exodus/assets": "^9.1.0",
|
|
47
47
|
"@exodus/assets-base": "^8.1.17",
|
|
48
|
-
"@exodus/assets-feature": "^7.0
|
|
48
|
+
"@exodus/assets-feature": "^7.2.0",
|
|
49
49
|
"@exodus/available-assets": "^8.7.0",
|
|
50
|
-
"@exodus/balances": "^13.
|
|
51
|
-
"@exodus/blockchain-metadata": "^15.9.
|
|
50
|
+
"@exodus/balances": "^13.8.0",
|
|
51
|
+
"@exodus/blockchain-metadata": "^15.9.2",
|
|
52
52
|
"@exodus/combined-assets-meta": "^1.3.0",
|
|
53
53
|
"@exodus/enabled-assets": "^10.9.1",
|
|
54
54
|
"@exodus/favorite-assets": "^2.5.0",
|
|
55
55
|
"@exodus/fee-data-monitors": "^5.0.4",
|
|
56
|
-
"@exodus/models": "^12.8.
|
|
57
|
-
"@exodus/rates-monitor": "^4.
|
|
56
|
+
"@exodus/models": "^12.8.2",
|
|
57
|
+
"@exodus/rates-monitor": "^4.11.0",
|
|
58
58
|
"@exodus/redux-dependency-injection": "^4.1.1",
|
|
59
59
|
"@exodus/solana-meta": "^1.0.4",
|
|
60
60
|
"@exodus/storage-memory": "^2.2.2",
|
|
61
|
-
"@exodus/wallet-accounts": "^17.
|
|
61
|
+
"@exodus/wallet-accounts": "^17.5.0",
|
|
62
62
|
"events": "^3.3.0",
|
|
63
63
|
"redux": "^4.2.1"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "6970f37e127a3fc387c9d58c8dcb8a55191b45bd"
|
|
69
69
|
}
|