@exodus/fiat-balances 13.6.0 → 13.6.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,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
+ ## [13.6.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.6.1...@exodus/fiat-balances@13.6.2) (2025-10-27)
7
+
8
+ **Note:** Version bump only for package @exodus/fiat-balances
9
+
10
+ ## [13.6.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.6.0...@exodus/fiat-balances@13.6.1) (2025-10-21)
11
+
12
+ ### Bug Fixes
13
+
14
+ - fix(fiat-balances): initialize USD balance properties immediately on plugin start (#14136)
15
+
6
16
  ## [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
17
 
8
18
  ### Features
@@ -1,5 +1,6 @@
1
- import { cloneDeepWith, set } from '@exodus/basic-utils'
1
+ import { set } from '@exodus/basic-utils'
2
2
  import { isNumberUnit } from '@exodus/currency'
3
+ // eslint-disable-next-line no-restricted-imports -- TODO: Fix this the next time the file is edited.
3
4
  import lodash from 'lodash'
4
5
  import fiatCurrencies from '@exodus/fiat-currencies'
5
6
  import { combine } from '@exodus/atoms'
@@ -9,12 +10,18 @@ const { isEqual } = lodash
9
10
  // not super efficient, so we're assuming small objects, like { [walletAccount]: xyz }
10
11
  const areKeysSame = (a, b) => isEqual(Object.keys(a).sort(), Object.keys(b).sort())
11
12
 
12
- export const cloneBalances = (balances) =>
13
- cloneDeepWith(balances, (value) => {
14
- if (isNumberUnit(value)) {
15
- return value
16
- }
17
- })
13
+ export const cloneBalances = (balances) => {
14
+ if (isNumberUnit(balances)) {
15
+ return balances
16
+ }
17
+
18
+ const cloned = Object.create(Object.getPrototypeOf(balances))
19
+ for (const key in balances) {
20
+ cloned[key] = cloneBalances(balances[key])
21
+ }
22
+
23
+ return cloned
24
+ }
18
25
 
19
26
  class FiatBalances {
20
27
  #logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "13.6.0",
3
+ "version": "13.6.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",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@exodus/atoms": "^9.0.0",
38
- "@exodus/basic-utils": "^4.3.0",
38
+ "@exodus/basic-utils": "^3.0.1",
39
39
  "@exodus/currency": "^5.0.2",
40
40
  "@exodus/fiat-currencies": "^1.2.3",
41
41
  "@exodus/formatting": "^9.0.0",
@@ -46,25 +46,26 @@
46
46
  "devDependencies": {
47
47
  "@exodus/assets": "^11.0.0",
48
48
  "@exodus/assets-base": "^10.0.0",
49
- "@exodus/assets-feature": "^8.1.3",
50
- "@exodus/available-assets": "^8.7.0",
51
- "@exodus/balances": "^13.12.0",
52
- "@exodus/blockchain-metadata": "^15.12.0",
49
+ "@exodus/assets-feature": "^8.7.1",
50
+ "@exodus/available-assets": "^8.8.0",
51
+ "@exodus/balances": "^13.13.1",
52
+ "@exodus/blockchain-metadata": "^16.0.0",
53
53
  "@exodus/combined-assets-meta": "^3.3.2",
54
- "@exodus/enabled-assets": "^10.10.2",
54
+ "@exodus/enabled-assets": "^10.10.4",
55
55
  "@exodus/favorite-assets": "^2.6.0",
56
56
  "@exodus/fee-data-monitors": "^5.0.4",
57
- "@exodus/models": "^12.14.0",
58
- "@exodus/rates-monitor": "^4.14.3",
59
- "@exodus/redux-dependency-injection": "^4.1.1",
57
+ "@exodus/models": "^12.17.1",
58
+ "@exodus/rates-monitor": "^4.14.7",
59
+ "@exodus/redux-dependency-injection": "^4.1.2",
60
60
  "@exodus/solana-meta": "^2.0.0",
61
- "@exodus/storage-memory": "^2.2.2",
62
- "@exodus/wallet-accounts": "^17.6.1",
61
+ "@exodus/storage-memory": "^2.3.0",
62
+ "@exodus/wallet-accounts": "^20.1.0",
63
63
  "events": "^3.3.0",
64
64
  "redux": "^4.2.1"
65
65
  },
66
66
  "publishConfig": {
67
- "access": "public"
67
+ "access": "public",
68
+ "provenance": false
68
69
  },
69
- "gitHead": "20a4bbabfa39c51c7e52e628fb5fa7a8ed54c72f"
70
+ "gitHead": "30137851a6c221e970e9bc85a704403124632c62"
70
71
  }
@@ -4,16 +4,25 @@ const createFiatBalancesAnalyticsPlugin = ({
4
4
  config: { assetsToTrackForBalances },
5
5
  }) => {
6
6
  let subscriptions = []
7
+
8
+ const setBalanceProperties = (balances) => {
9
+ const assetFiatBalances = assetsToTrackForBalances.reduce((acc, obj) => {
10
+ // Always set a value, default to 0 if balance doesn't exist
11
+ acc[obj.analyticsName] = balances?.byAsset[obj.assetName]?.balance.toDefaultNumber() ?? 0
12
+ return acc
13
+ }, Object.create(null))
14
+ analytics.setDefaultEventProperties({
15
+ ...assetFiatBalances,
16
+ // Always set totalBalanceUsd, default to 0 if not available
17
+ totalBalanceUsd: balances?.totals?.balance?.toDefaultNumber() ?? 0,
18
+ })
19
+ }
20
+
7
21
  const onStart = () => {
22
+ setBalanceProperties(undefined)
23
+
8
24
  const unsubscribeBalancesAtom = fiatBalancesAtom.observe(({ balances }) => {
9
- const assetFiatBalances = assetsToTrackForBalances.reduce((acc, obj) => {
10
- acc[obj.analyticsName] = balances?.byAsset[obj.assetName]?.balance.toDefaultNumber()
11
- return acc
12
- }, Object.create(null))
13
- analytics.setDefaultEventProperties({
14
- ...assetFiatBalances,
15
- totalBalanceUsd: balances?.totals?.balance?.toDefaultNumber(),
16
- })
25
+ setBalanceProperties(balances)
17
26
  })
18
27
 
19
28
  subscriptions = [unsubscribeBalancesAtom]
@@ -1,5 +1,6 @@
1
1
  import { createSelector } from 'reselect'
2
2
  import { isMultiNetworkAsset } from '../utils.js'
3
+ // eslint-disable-next-line no-restricted-imports -- TODO: Fix this the next time the file is edited.
3
4
  import lodash from 'lodash'
4
5
 
5
6
  const { groupBy } = lodash
package/report/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { mapValues, pickBy, pickByArrayPaths } from '@exodus/basic-utils'
1
+ import { mapValues, pick, pickBy } from '@exodus/basic-utils'
2
2
 
3
3
  /**
4
4
  * sample report
@@ -21,9 +21,8 @@ const fiatBalancesReportDefinition = {
21
21
  ])
22
22
 
23
23
  const softwareWalletAccountNames = Object.keys(pickBy(walletAccounts, (w) => w.isSoftware))
24
- return mapValues(
25
- pickByArrayPaths(balances.byWalletAccount, softwareWalletAccountNames),
26
- ({ balance }) => balance.toDefaultString({ unit: true })
24
+ return mapValues(pick(balances.byWalletAccount, softwareWalletAccountNames), ({ balance }) =>
25
+ balance.toDefaultString({ unit: true })
27
26
  )
28
27
  },
29
28
  }),