@exodus/fiat-balances 13.5.0 → 13.5.2

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
+ ## [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
+
8
+ ### Performance
9
+
10
+ - perf: merge fiat balances in reducer (#12879)
11
+
12
+ ## [13.5.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.5.0...@exodus/fiat-balances@13.5.1) (2025-06-11)
13
+
14
+ ### Performance
15
+
16
+ - perf: clone balances (#12882)
17
+
6
18
  ## [13.5.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.4.1...@exodus/fiat-balances@13.5.0) (2025-05-12)
7
19
 
8
20
  ### Features
@@ -4,15 +4,23 @@ import lodash from 'lodash'
4
4
  import fiatCurrencies from '@exodus/fiat-currencies'
5
5
  import { combine } from '@exodus/atoms'
6
6
 
7
- const { cloneDeepWith, isEqual } = lodash
7
+ const { isEqual } = lodash
8
8
 
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
- const cloneBalances = (balances) =>
13
- cloneDeepWith(balances, (val) => {
14
- if (isNumberUnit(val)) return val
15
- })
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
+ }
16
24
 
17
25
  class FiatBalances {
18
26
  #logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "13.5.0",
3
+ "version": "13.5.2",
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",
@@ -46,25 +46,25 @@
46
46
  "devDependencies": {
47
47
  "@exodus/assets": "^11.0.0",
48
48
  "@exodus/assets-base": "^10.0.0",
49
- "@exodus/assets-feature": "^7.4.0",
49
+ "@exodus/assets-feature": "^8.1.2",
50
50
  "@exodus/available-assets": "^8.7.0",
51
- "@exodus/balances": "^13.8.2",
52
- "@exodus/blockchain-metadata": "^15.10.0",
51
+ "@exodus/balances": "^13.9.1",
52
+ "@exodus/blockchain-metadata": "^15.11.1",
53
53
  "@exodus/combined-assets-meta": "^3.3.2",
54
- "@exodus/enabled-assets": "^10.9.2",
55
- "@exodus/favorite-assets": "^2.5.0",
54
+ "@exodus/enabled-assets": "^10.10.0",
55
+ "@exodus/favorite-assets": "^2.6.0",
56
56
  "@exodus/fee-data-monitors": "^5.0.4",
57
- "@exodus/models": "^12.8.2",
58
- "@exodus/rates-monitor": "^4.14.1",
57
+ "@exodus/models": "^12.13.0",
58
+ "@exodus/rates-monitor": "^4.14.3",
59
59
  "@exodus/redux-dependency-injection": "^4.1.1",
60
60
  "@exodus/solana-meta": "^2.0.0",
61
61
  "@exodus/storage-memory": "^2.2.2",
62
- "@exodus/wallet-accounts": "^17.5.1",
62
+ "@exodus/wallet-accounts": "^17.6.1",
63
63
  "events": "^3.3.0",
64
64
  "redux": "^4.2.1"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "95ebc9f827e4fc0ff63c9e9abc687e6a86d3fa82"
69
+ "gitHead": "117dc1c3bdcea8033f331987ab0cdeef320f1282"
70
70
  }
package/redux/index.js CHANGED
@@ -1,32 +1,29 @@
1
1
  import id from './id.js'
2
2
  import initialState from './initial-state.js'
3
3
  import createSelectorDefinitions from './selectors/index.js'
4
- import lodash from 'lodash'
5
-
6
- const { merge } = lodash
7
-
8
- const mergeWalletAccountChanges = (balances, byWalletAccount) =>
9
- merge(
10
- //
11
- {},
12
- balances,
13
- byWalletAccount
14
- )
15
-
16
- const mergeAssetSourceChanges = (balances, byType) =>
17
- merge(
18
- //
19
- {},
20
- balances,
21
- byType
22
- )
4
+
5
+ const mergeChanges = (balances, changes) => {
6
+ const result = { ...balances }
7
+
8
+ for (const key in changes) {
9
+ const sourceValue = changes[key]
10
+
11
+ if (sourceValue && typeof sourceValue === 'object' && sourceValue.constructor === Object) {
12
+ result[key] = mergeChanges(result[key] || {}, sourceValue)
13
+ } else {
14
+ result[key] = sourceValue
15
+ }
16
+ }
17
+
18
+ return result
19
+ }
23
20
 
24
21
  const prepareData = ({ state, payload }) => {
25
22
  const { totals, byWalletAccount, ...rest } = payload
26
23
  return {
27
- ...mergeAssetSourceChanges(state.data, rest),
24
+ ...mergeChanges(state.data, rest),
28
25
  totals,
29
- byWalletAccount: mergeWalletAccountChanges(state.data.byWalletAccount, byWalletAccount),
26
+ byWalletAccount: mergeChanges(state.data.byWalletAccount, byWalletAccount),
30
27
  }
31
28
  }
32
29