@exodus/fiat-balances 12.0.0 → 12.1.1

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 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
+ ## [12.1.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.1.0...@exodus/fiat-balances@12.1.1) (2024-08-23)
7
+
8
+ ### Bug Fixes
9
+
10
+ - no combinedAssets case ([#8653](https://github.com/ExodusMovement/exodus-hydra/issues/8653)) ([82fb4ed](https://github.com/ExodusMovement/exodus-hydra/commit/82fb4ed31147ee28994350204dab0a60eea5e296))
11
+
12
+ ## [12.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.0.0...@exodus/fiat-balances@12.1.0) (2024-08-23)
13
+
14
+ ### Features
15
+
16
+ - upgrade formatting lib ([#8628](https://github.com/ExodusMovement/exodus-hydra/issues/8628)) ([5b60628](https://github.com/ExodusMovement/exodus-hydra/commit/5b60628586bf734933b46742f2bbe49174ffd6f9))
17
+
6
18
  ## [12.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@11.1.0...@exodus/fiat-balances@12.0.0) (2024-08-16)
7
19
 
8
20
  ### ⚠ BREAKING CHANGES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "12.0.0",
3
+ "version": "12.1.1",
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",
@@ -35,8 +35,8 @@
35
35
  "@exodus/atoms": "^8.0.0",
36
36
  "@exodus/basic-utils": "^2.5.1",
37
37
  "@exodus/currency": "^2.1.2",
38
- "@exodus/fiat-currencies": "^1.0.0",
39
- "@exodus/formatting": "^5.0.0",
38
+ "@exodus/fiat-currencies": "^1.1.0",
39
+ "@exodus/formatting": "^6.0.0",
40
40
  "@exodus/module": "^1.1.0",
41
41
  "@exodus/typeforce": "^1.18.1",
42
42
  "lodash": "^4.17.21",
@@ -46,23 +46,23 @@
46
46
  "devDependencies": {
47
47
  "@exodus/assets": "^9.1.0",
48
48
  "@exodus/assets-base": "^8.1.17",
49
- "@exodus/assets-feature": "^5.10.0",
50
- "@exodus/available-assets": "^8.4.1",
51
- "@exodus/balances": "^13.2.3",
49
+ "@exodus/assets-feature": "^5.11.0",
50
+ "@exodus/available-assets": "^8.5.0",
51
+ "@exodus/balances": "^13.3.0",
52
52
  "@exodus/blockchain-metadata": "^15.3.5",
53
53
  "@exodus/combined-assets-meta": "^1.3.0",
54
- "@exodus/enabled-assets": "^10.5.2",
54
+ "@exodus/enabled-assets": "^10.7.0",
55
55
  "@exodus/favorite-assets": "^2.4.3",
56
- "@exodus/fee-data-monitors": "^4.2.1",
56
+ "@exodus/fee-data-monitors": "^4.3.0",
57
57
  "@exodus/locale": "^2.2.2",
58
58
  "@exodus/models": "^8.9.0",
59
- "@exodus/rates-monitor": "^4.3.3",
60
- "@exodus/redux-dependency-injection": "^4.0.0",
59
+ "@exodus/rates-monitor": "^4.4.0",
60
+ "@exodus/redux-dependency-injection": "^4.0.1",
61
61
  "@exodus/solana-meta": "^1.0.4",
62
- "@exodus/storage-memory": "^2.1.1",
62
+ "@exodus/storage-memory": "^2.2.0",
63
63
  "@exodus/wallet-accounts": "^16.8.2",
64
64
  "events": "^3.3.0",
65
65
  "redux": "^4.2.1"
66
66
  },
67
- "gitHead": "2d69e70334df261d197925d4de51620cf2eed3be"
67
+ "gitHead": "f35676364578f5b07fa694f14854f1dcd45acc1b"
68
68
  }
@@ -1,41 +1,5 @@
1
1
  import { isNumberUnit } from '@exodus/currency'
2
- import { getFiatAdaptiveFraction } from '@exodus/formatting/lib/price'
3
- import { hasLeftCurrencySymbol, units } from '@exodus/fiat-currencies'
4
- import { formatCurrency, LEFT_FORMAT, RIGHT_FORMAT } from '@exodus/formatting/lib/currency'
5
-
6
- const DEFAULT_FRACTION = 2
7
-
8
- function formatPrice(
9
- price,
10
- {
11
- useGrouping = true,
12
- format = '%v',
13
- symbol,
14
- fraction = DEFAULT_FRACTION,
15
- convertDust = true,
16
- } = {}
17
- ) {
18
- const priceNumber = Number(price)
19
-
20
- const isDust = priceNumber < Math.pow(10, -fraction) && priceNumber > 0
21
- if (convertDust && isDust) {
22
- return `~${formatCurrency(0, {
23
- minFraction: 0,
24
- maxFraction: 0,
25
- format,
26
- symbol,
27
- useGrouping,
28
- })}`
29
- }
30
-
31
- return formatCurrency(price, {
32
- minFraction: fraction,
33
- maxFraction: fraction,
34
- format,
35
- symbol,
36
- useGrouping,
37
- })
38
- }
2
+ import { formatPrice, getFiatAdaptiveFraction } from '@exodus/formatting/lib/price'
39
3
 
40
4
  const resultFunction =
41
5
  (currency) =>
@@ -52,15 +16,10 @@ const resultFunction =
52
16
  const value = isNumberUnit(fiatValue) ? fiatValue.toDefaultNumber() : fiatValue
53
17
 
54
18
  return formatPrice(value, {
55
- format: hasLeftCurrencySymbol(fiatCurrency) ? LEFT_FORMAT : RIGHT_FORMAT,
56
- symbol: units[fiatCurrency].symbol,
57
- fraction: adaptiveFraction
58
- ? getFiatAdaptiveFraction(value)
59
- : value === 0
60
- ? 0
61
- : DEFAULT_FRACTION,
19
+ currency: fiatCurrency,
62
20
  useGrouping,
63
21
  convertDust,
22
+ fraction: adaptiveFraction ? getFiatAdaptiveFraction(value) : undefined,
64
23
  })
65
24
  }
66
25
 
@@ -41,7 +41,7 @@ const sortAssetsSelectorFactoryCreator = ({
41
41
  const assetsMap = keyBy(assetsListWithSingleCombined, 'name')
42
42
  const assetsWithMetaData = assetsListWithSingleCombined.map((asset) => {
43
43
  const cap = isMultiNetworkAsset(asset)
44
- ? rates[asset.combinedAssets[0].ticker]?.cap
44
+ ? rates[asset.combinedAssets[0]?.ticker]?.cap
45
45
  : rates[asset.ticker]?.cap
46
46
 
47
47
  const getAssetBalanceNumber = (assetName) => balances?.[assetName]?.toDefaultNumber() ?? 0