@exodus/fiat-balances 13.5.2 → 13.6.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 CHANGED
@@ -3,6 +3,20 @@
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.6.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.5.3...@exodus/fiat-balances@13.6.0) (2025-07-10)
7
+
8
+ ### Features
9
+
10
+ - feat: provide feeData to asset.api.getBalances (#13104)
11
+
12
+ - feat: update basic utils in balances (#13183)
13
+
14
+ ## [13.5.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.5.2...@exodus/fiat-balances@13.5.3) (2025-07-01)
15
+
16
+ ### Bug Fixes
17
+
18
+ - fix(fiat-balances): calculate fiat balances only when rates are valid (#13075)
19
+
6
20
  ## [13.5.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.5.1...@exodus/fiat-balances@13.5.2) (2025-06-11)
7
21
 
8
22
  ### Performance
@@ -1,4 +1,4 @@
1
- import { set } from '@exodus/basic-utils'
1
+ import { cloneDeepWith, set } from '@exodus/basic-utils'
2
2
  import { isNumberUnit } from '@exodus/currency'
3
3
  import lodash from 'lodash'
4
4
  import fiatCurrencies from '@exodus/fiat-currencies'
@@ -9,18 +9,12 @@ const { isEqual } = lodash
9
9
  // not super efficient, so we're assuming small objects, like { [walletAccount]: xyz }
10
10
  const areKeysSame = (a, b) => isEqual(Object.keys(a).sort(), Object.keys(b).sort())
11
11
 
12
- export const cloneBalances = (balances) => {
13
- if (isNumberUnit(balances)) {
14
- return balances
15
- }
16
-
17
- const cloned = Object.create(Object.getPrototypeOf(balances))
18
- for (const key in balances) {
19
- cloned[key] = cloneBalances(balances[key])
20
- }
21
-
22
- return cloned
23
- }
12
+ export const cloneBalances = (balances) =>
13
+ cloneDeepWith(balances, (value) => {
14
+ if (isNumberUnit(value)) {
15
+ return value
16
+ }
17
+ })
24
18
 
25
19
  class FiatBalances {
26
20
  #logger
@@ -75,7 +69,8 @@ class FiatBalances {
75
69
  this.#cachedRates &&
76
70
  this.#fiatCurrency &&
77
71
  this.#latestAssetBalances &&
78
- this.#cachedRates[this.#fiatCurrency]
72
+ this.#cachedRates[this.#fiatCurrency] &&
73
+ !Object.values(this.#cachedRates[this.#fiatCurrency]).every(({ invalid }) => invalid)
79
74
  )
80
75
  }
81
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "13.5.2",
3
+ "version": "13.6.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",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@exodus/atoms": "^9.0.0",
38
- "@exodus/basic-utils": "^3.0.1",
38
+ "@exodus/basic-utils": "^4.3.0",
39
39
  "@exodus/currency": "^5.0.2",
40
40
  "@exodus/fiat-currencies": "^1.2.3",
41
41
  "@exodus/formatting": "^9.0.0",
@@ -46,15 +46,15 @@
46
46
  "devDependencies": {
47
47
  "@exodus/assets": "^11.0.0",
48
48
  "@exodus/assets-base": "^10.0.0",
49
- "@exodus/assets-feature": "^8.1.2",
49
+ "@exodus/assets-feature": "^8.1.3",
50
50
  "@exodus/available-assets": "^8.7.0",
51
- "@exodus/balances": "^13.9.1",
52
- "@exodus/blockchain-metadata": "^15.11.1",
51
+ "@exodus/balances": "^13.12.0",
52
+ "@exodus/blockchain-metadata": "^15.12.0",
53
53
  "@exodus/combined-assets-meta": "^3.3.2",
54
- "@exodus/enabled-assets": "^10.10.0",
54
+ "@exodus/enabled-assets": "^10.10.2",
55
55
  "@exodus/favorite-assets": "^2.6.0",
56
56
  "@exodus/fee-data-monitors": "^5.0.4",
57
- "@exodus/models": "^12.13.0",
57
+ "@exodus/models": "^12.14.0",
58
58
  "@exodus/rates-monitor": "^4.14.3",
59
59
  "@exodus/redux-dependency-injection": "^4.1.1",
60
60
  "@exodus/solana-meta": "^2.0.0",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "117dc1c3bdcea8033f331987ab0cdeef320f1282"
69
+ "gitHead": "20a4bbabfa39c51c7e52e628fb5fa7a8ed54c72f"
70
70
  }
package/report/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { mapValues, pick, pickBy } from '@exodus/basic-utils'
1
+ import { mapValues, pickBy, pickByArrayPaths } from '@exodus/basic-utils'
2
2
 
3
3
  /**
4
4
  * sample report
@@ -21,8 +21,9 @@ const fiatBalancesReportDefinition = {
21
21
  ])
22
22
 
23
23
  const softwareWalletAccountNames = Object.keys(pickBy(walletAccounts, (w) => w.isSoftware))
24
- return mapValues(pick(balances.byWalletAccount, softwareWalletAccountNames), ({ balance }) =>
25
- balance.toDefaultString({ unit: true })
24
+ return mapValues(
25
+ pickByArrayPaths(balances.byWalletAccount, softwareWalletAccountNames),
26
+ ({ balance }) => balance.toDefaultString({ unit: true })
26
27
  )
27
28
  },
28
29
  }),