@exodus/fiat-balances 10.13.2 → 11.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/package.json +3 -3
- package/redux/selectors/get-format-fiat.js +19 -2
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
|
+
## [11.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@10.13.2...@exodus/fiat-balances@11.0.0) (2024-08-12)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- convert fiat dust value in selector to ~0 (#8320)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- convert fiat dust value in selector to ~0 ([#8320](https://github.com/ExodusMovement/exodus-hydra/issues/8320)) ([78d9126](https://github.com/ExodusMovement/exodus-hydra/commit/78d91269ffb909134da391bfd98ef34915ae4b37))
|
|
15
|
+
|
|
6
16
|
## [10.13.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@10.13.1...@exodus/fiat-balances@10.13.2) (2024-08-06)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.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": "UNLICENSED",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@exodus/assets": "^9.1.0",
|
|
48
48
|
"@exodus/assets-base": "^8.1.17",
|
|
49
|
-
"@exodus/assets-feature": "^5.
|
|
49
|
+
"@exodus/assets-feature": "^5.10.0",
|
|
50
50
|
"@exodus/available-assets": "^8.4.1",
|
|
51
51
|
"@exodus/balances": "^13.2.3",
|
|
52
52
|
"@exodus/blockchain-metadata": "^15.3.5",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"events": "^3.3.0",
|
|
65
65
|
"redux": "^4.2.1"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "5010b9c3937b9fa235e174b74f11197a462b3d5d"
|
|
68
68
|
}
|
|
@@ -3,7 +3,22 @@ import { getFiatAdaptiveFraction } from '@exodus/formatting/lib/price'
|
|
|
3
3
|
import { hasLeftCurrencySymbol, units } from '@exodus/fiat-currencies'
|
|
4
4
|
import { formatCurrency, LEFT_FORMAT, RIGHT_FORMAT } from '@exodus/formatting/lib/currency'
|
|
5
5
|
|
|
6
|
-
function formatPrice(
|
|
6
|
+
function formatPrice(
|
|
7
|
+
price,
|
|
8
|
+
{ useGrouping = true, format = '%v', symbol, fraction = 2, convertDust = true } = {}
|
|
9
|
+
) {
|
|
10
|
+
const priceNumber = Number(price)
|
|
11
|
+
const isDust = priceNumber < Math.pow(10, -fraction) && priceNumber > 0
|
|
12
|
+
if (convertDust && isDust) {
|
|
13
|
+
return `~${formatCurrency(0, {
|
|
14
|
+
minFraction: 0,
|
|
15
|
+
maxFraction: 0,
|
|
16
|
+
format,
|
|
17
|
+
symbol,
|
|
18
|
+
useGrouping,
|
|
19
|
+
})}`
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
return formatCurrency(price, {
|
|
8
23
|
minFraction: fraction,
|
|
9
24
|
maxFraction: fraction,
|
|
@@ -15,7 +30,7 @@ function formatPrice(price, { useGrouping = true, format = '%v', symbol, fractio
|
|
|
15
30
|
|
|
16
31
|
const resultFunction =
|
|
17
32
|
(currency) =>
|
|
18
|
-
(fiatValue, { customCurrency, adaptiveFraction } = {}) => {
|
|
33
|
+
(fiatValue, { customCurrency, adaptiveFraction, useGrouping, convertDust } = {}) => {
|
|
19
34
|
const fiatCurrency = customCurrency || currency
|
|
20
35
|
const value = isNumberUnit(fiatValue) ? fiatValue.toDefaultNumber() : fiatValue
|
|
21
36
|
|
|
@@ -23,6 +38,8 @@ const resultFunction =
|
|
|
23
38
|
format: hasLeftCurrencySymbol(fiatCurrency) ? LEFT_FORMAT : RIGHT_FORMAT,
|
|
24
39
|
symbol: units[fiatCurrency].symbol,
|
|
25
40
|
fraction: adaptiveFraction ? getFiatAdaptiveFraction(value) : undefined,
|
|
41
|
+
useGrouping,
|
|
42
|
+
convertDust,
|
|
26
43
|
})
|
|
27
44
|
}
|
|
28
45
|
|