@exodus/fiat-balances 13.6.2 → 13.7.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 +12 -0
- package/package.json +9 -9
- package/plugin/analytics.js +32 -15
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.7.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.6.3...@exodus/fiat-balances@13.7.0) (2026-01-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: filter out combined assets without members (#14961)
|
|
11
|
+
|
|
12
|
+
## [13.6.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.6.2...@exodus/fiat-balances@13.6.3) (2025-11-24)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- fix(fiat-balances): convert analytic values in other currencies to USD before reporting (#14437)
|
|
17
|
+
|
|
6
18
|
## [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
19
|
|
|
8
20
|
**Note:** Version bump only for package @exodus/fiat-balances
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.7.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",
|
|
@@ -46,20 +46,20 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@exodus/assets": "^11.0.0",
|
|
48
48
|
"@exodus/assets-base": "^10.0.0",
|
|
49
|
-
"@exodus/assets-feature": "^8.
|
|
50
|
-
"@exodus/available-assets": "^8.
|
|
51
|
-
"@exodus/balances": "^13.
|
|
52
|
-
"@exodus/blockchain-metadata": "^
|
|
49
|
+
"@exodus/assets-feature": "^8.8.0",
|
|
50
|
+
"@exodus/available-assets": "^8.10.0",
|
|
51
|
+
"@exodus/balances": "^13.14.0",
|
|
52
|
+
"@exodus/blockchain-metadata": "^17.1.0",
|
|
53
53
|
"@exodus/combined-assets-meta": "^3.3.2",
|
|
54
|
-
"@exodus/enabled-assets": "^10.
|
|
54
|
+
"@exodus/enabled-assets": "^10.11.0",
|
|
55
55
|
"@exodus/favorite-assets": "^2.6.0",
|
|
56
56
|
"@exodus/fee-data-monitors": "^5.0.4",
|
|
57
|
-
"@exodus/models": "^12.
|
|
57
|
+
"@exodus/models": "^12.18.0",
|
|
58
58
|
"@exodus/rates-monitor": "^4.14.7",
|
|
59
59
|
"@exodus/redux-dependency-injection": "^4.1.2",
|
|
60
60
|
"@exodus/solana-meta": "^2.0.0",
|
|
61
61
|
"@exodus/storage-memory": "^2.3.0",
|
|
62
|
-
"@exodus/wallet-accounts": "^20.1
|
|
62
|
+
"@exodus/wallet-accounts": "^20.2.1",
|
|
63
63
|
"events": "^3.3.0",
|
|
64
64
|
"redux": "^4.2.1"
|
|
65
65
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"access": "public",
|
|
68
68
|
"provenance": false
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c78411cee430824a8f7e61db3c151ddfdb99db2d"
|
|
71
71
|
}
|
package/plugin/analytics.js
CHANGED
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
const createFiatBalancesAnalyticsPlugin = ({
|
|
2
2
|
analytics,
|
|
3
|
-
|
|
3
|
+
assetsTotalWalletAmountsAtom,
|
|
4
|
+
fiatRateConverter,
|
|
4
5
|
config: { assetsToTrackForBalances },
|
|
5
6
|
}) => {
|
|
6
7
|
let subscriptions = []
|
|
7
8
|
|
|
8
|
-
const setBalanceProperties = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const setBalanceProperties = async (cryptoBalancesByAsset) => {
|
|
10
|
+
if (!cryptoBalancesByAsset) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Convert each asset's total crypto balance to USD
|
|
15
|
+
const assetFiatBalances = Object.fromEntries(
|
|
16
|
+
await Promise.all(
|
|
17
|
+
assetsToTrackForBalances.map(async ({ assetName, analyticsName }) => {
|
|
18
|
+
const cryptoBalance = cryptoBalancesByAsset.get(assetName)
|
|
19
|
+
if (cryptoBalance) {
|
|
20
|
+
const balanceUSD = await fiatRateConverter.toFiatCurrency({
|
|
21
|
+
amount: cryptoBalance,
|
|
22
|
+
currency: 'USD',
|
|
23
|
+
})
|
|
24
|
+
return [analyticsName, balanceUSD.toDefaultNumber()]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return [analyticsName, 0]
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const totalBalanceUsd = Object.values(assetFiatBalances).reduce((sum, value) => sum + value, 0)
|
|
33
|
+
|
|
14
34
|
analytics.setDefaultEventProperties({
|
|
15
35
|
...assetFiatBalances,
|
|
16
|
-
|
|
17
|
-
totalBalanceUsd: balances?.totals?.balance?.toDefaultNumber() ?? 0,
|
|
36
|
+
totalBalanceUsd,
|
|
18
37
|
})
|
|
19
38
|
}
|
|
20
39
|
|
|
21
40
|
const onStart = () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const unsubscribeBalancesAtom = fiatBalancesAtom.observe(({ balances }) => {
|
|
25
|
-
setBalanceProperties(balances)
|
|
41
|
+
const unsubscribe = assetsTotalWalletAmountsAtom.observe((cryptoBalancesByAsset) => {
|
|
42
|
+
setBalanceProperties(cryptoBalancesByAsset)
|
|
26
43
|
})
|
|
27
44
|
|
|
28
|
-
subscriptions = [
|
|
45
|
+
subscriptions = [unsubscribe]
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
const onStop = () => {
|
|
@@ -39,7 +56,7 @@ const fiatBalancesAnalyticsPluginDefinition = {
|
|
|
39
56
|
id: 'fiatBalancesAnalyticsPlugin',
|
|
40
57
|
type: 'plugin',
|
|
41
58
|
factory: createFiatBalancesAnalyticsPlugin,
|
|
42
|
-
dependencies: ['analytics', '
|
|
59
|
+
dependencies: ['analytics', 'assetsTotalWalletAmountsAtom', 'fiatRateConverter', 'config?'],
|
|
43
60
|
public: true,
|
|
44
61
|
}
|
|
45
62
|
|