@exodus/fiat-balances 13.5.3 → 13.6.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,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.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.6.0...@exodus/fiat-balances@13.6.1) (2025-10-21)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix(fiat-balances): initialize USD balance properties immediately on plugin start (#14136)
11
+
12
+ ## [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)
13
+
14
+ ### Features
15
+
16
+ - feat: provide feeData to asset.api.getBalances (#13104)
17
+
18
+ - feat: update basic utils in balances (#13183)
19
+
6
20
  ## [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)
7
21
 
8
22
  ### Bug Fixes
@@ -1,5 +1,6 @@
1
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'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "13.5.3",
3
+ "version": "13.6.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": "MIT",
@@ -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.2",
50
- "@exodus/available-assets": "^8.7.0",
51
- "@exodus/balances": "^13.9.1",
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.1",
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": "4245c97f8b6281925b9c01376ddba13706d114eb"
70
+ "gitHead": "19a582f72f1dad4ad63a8e6c2ea7680cd9a484d5"
70
71
  }
@@ -4,26 +4,44 @@ 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
+ // Set initial properties to 0 immediately
23
+ setBalanceProperties(undefined)
24
+
25
+ // Start observing future updates
8
26
  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
- })
27
+ setBalanceProperties(balances)
17
28
  })
18
29
 
19
30
  subscriptions = [unsubscribeBalancesAtom]
20
31
  }
21
32
 
33
+ const onUnlock = () => {
34
+ // Load current balance value after wallet is unlocked (non-blocking)
35
+ fiatBalancesAtom.get().then((currentValue) => {
36
+ setBalanceProperties(currentValue?.balances)
37
+ })
38
+ }
39
+
22
40
  const onStop = () => {
23
41
  subscriptions.forEach((unsubscribe) => unsubscribe())
24
42
  }
25
43
 
26
- return { onStart, onStop }
44
+ return { onStart, onUnlock, onStop }
27
45
  }
28
46
 
29
47
  const fiatBalancesAnalyticsPluginDefinition = {
@@ -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