@exodus/fiat-balances 13.7.4 → 13.8.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 +10 -0
- package/README.md +1 -1
- package/atoms/fiat-balances.js +1 -1
- package/atoms/optimistic-fiat-balances.js +1 -1
- package/module/fiat-balances.js +11 -9
- package/package.json +29 -28
- package/plugin/analytics.js +1 -1
- package/plugin/track-non-dust-asset-names.js +24 -9
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.8.0](https://github.com/ExodusMovement/exodus/compare/@exodus/fiat-balances@13.7.5...@exodus/fiat-balances@13.8.0) (2026-11-08)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **enabled-assets,fiat-balances:** ignore configured wallet accounts ([#48791](https://github.com/ExodusMovement/exodus/issues/48791)) ([8d69151](https://github.com/ExodusMovement/exodus/commit/8d6915133d8f3c58424157dfd644adb2b998c164))
|
|
11
|
+
|
|
12
|
+
## [13.7.5](https://github.com/ExodusMovement/exodus/compare/@exodus/fiat-balances@13.7.4...@exodus/fiat-balances@13.7.5) (2026-10-09)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @exodus/fiat-balances
|
|
15
|
+
|
|
6
16
|
## [13.7.4](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.7.3...@exodus/fiat-balances@13.7.4) (2026-05-19)
|
|
7
17
|
|
|
8
18
|
### Features
|
package/README.md
CHANGED
package/atoms/fiat-balances.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInMemoryAtom } from '@exodus/atoms'
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// oxlint-disable-next-line @exodus/oxlint-plugin-hydra/in-memory-atom-default-value
|
|
4
4
|
const createFiatBalancesAtom = () => createInMemoryAtom()
|
|
5
5
|
|
|
6
6
|
export default createFiatBalancesAtom
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInMemoryAtom } from '@exodus/atoms'
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// oxlint-disable-next-line @exodus/oxlint-plugin-hydra/in-memory-atom-default-value
|
|
4
4
|
const createOptimisticFiatBalancesAtom = () => createInMemoryAtom()
|
|
5
5
|
|
|
6
6
|
export default createOptimisticFiatBalancesAtom
|
package/module/fiat-balances.js
CHANGED
|
@@ -51,7 +51,7 @@ export const cloneBalances = (wrapper) => {
|
|
|
51
51
|
|
|
52
52
|
class FiatBalances {
|
|
53
53
|
#logger
|
|
54
|
-
#
|
|
54
|
+
#assetsAtom
|
|
55
55
|
#balanceFields
|
|
56
56
|
#fiatCurrency
|
|
57
57
|
#cachedRates
|
|
@@ -67,7 +67,7 @@ class FiatBalances {
|
|
|
67
67
|
#subscriptions = []
|
|
68
68
|
|
|
69
69
|
constructor({
|
|
70
|
-
|
|
70
|
+
assetsAtom,
|
|
71
71
|
logger,
|
|
72
72
|
balancesAtom,
|
|
73
73
|
config: { balanceFields },
|
|
@@ -76,7 +76,7 @@ class FiatBalances {
|
|
|
76
76
|
currencyAtom,
|
|
77
77
|
}) {
|
|
78
78
|
this.#logger = logger
|
|
79
|
-
this.#
|
|
79
|
+
this.#assetsAtom = assetsAtom
|
|
80
80
|
this.#balanceFields = balanceFields
|
|
81
81
|
this.#fiatBalancesAtom = fiatBalancesAtom
|
|
82
82
|
this.#balancesAtom = balancesAtom
|
|
@@ -127,12 +127,13 @@ class FiatBalances {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
#maybeRecompute = () => {
|
|
130
|
-
if (this.#isReady()) this.#recompute()
|
|
130
|
+
if (this.#isReady()) void this.#recompute()
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
#recompute = async () => {
|
|
134
134
|
this.#reset()
|
|
135
135
|
|
|
136
|
+
const { value: assets } = await this.#assetsAtom.get()
|
|
136
137
|
const balances = this.#latestAssetBalances
|
|
137
138
|
const { byAssetSource, byBaseAssetSource, byWalletAccount, byAsset } = this.#balances
|
|
138
139
|
const fiatZero = fiatCurrencies[this.#fiatCurrency].ZERO
|
|
@@ -163,7 +164,7 @@ class FiatBalances {
|
|
|
163
164
|
for (const assetName in walletAccountBalances) {
|
|
164
165
|
const assetBalances = walletAccountBalances[assetName]
|
|
165
166
|
if (!assetBalances) continue
|
|
166
|
-
const asset =
|
|
167
|
+
const asset = assets[assetName]
|
|
167
168
|
const baseAssetName = asset.baseAsset.name
|
|
168
169
|
|
|
169
170
|
let byAssetSourceAssetRef = byAssetSourceWalletRef[assetName]
|
|
@@ -207,7 +208,7 @@ class FiatBalances {
|
|
|
207
208
|
this.#recomputeWalletTotals()
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
#setBalances = ({ balances, changes }) => {
|
|
211
|
+
#setBalances = async ({ balances, changes }) => {
|
|
211
212
|
const needsRecompute =
|
|
212
213
|
!this.#balances.byWalletAccount ||
|
|
213
214
|
!changes ||
|
|
@@ -221,6 +222,7 @@ class FiatBalances {
|
|
|
221
222
|
|
|
222
223
|
this.#logger.log('recomputing based on new balances')
|
|
223
224
|
|
|
225
|
+
const { value: assets } = await this.#assetsAtom.get()
|
|
224
226
|
const fiatZero = fiatCurrencies[this.#fiatCurrency].ZERO
|
|
225
227
|
|
|
226
228
|
// TODO set changes to fiatBalancesAtom as well
|
|
@@ -230,7 +232,7 @@ class FiatBalances {
|
|
|
230
232
|
const walletAccountBalances = byWalletAccount[walletAccount]
|
|
231
233
|
Object.entries(walletAccountBalancesChanges).forEach(
|
|
232
234
|
([assetName, assetSourceBalancesChanges]) => {
|
|
233
|
-
const asset =
|
|
235
|
+
const asset = assets[assetName]
|
|
234
236
|
const baseAssetName = asset.baseAsset.name
|
|
235
237
|
this.#balanceFields.forEach((field) => {
|
|
236
238
|
// we may not be interested in all fields from `balances`
|
|
@@ -270,7 +272,7 @@ class FiatBalances {
|
|
|
270
272
|
set(byAssetSource, [walletAccount, assetName, field], fiatZero)
|
|
271
273
|
}
|
|
272
274
|
|
|
273
|
-
//
|
|
275
|
+
// oxlint-disable-next-line @exodus/oxlint-plugin-hydra/no-param-reassign-prop-only
|
|
274
276
|
byAssetSource[walletAccount][assetName][field] = byAssetSource[walletAccount][
|
|
275
277
|
assetName
|
|
276
278
|
][field]
|
|
@@ -332,7 +334,7 @@ const fiatBalancesDefinition = {
|
|
|
332
334
|
type: 'module',
|
|
333
335
|
factory: createFiatBalances,
|
|
334
336
|
dependencies: [
|
|
335
|
-
'
|
|
337
|
+
'assetsAtom',
|
|
336
338
|
'logger',
|
|
337
339
|
'balancesAtom',
|
|
338
340
|
'fiatBalancesAtom',
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/fiat-balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.8.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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "
|
|
9
|
-
"
|
|
10
|
-
"lint
|
|
11
|
-
"
|
|
12
|
-
"format
|
|
8
|
+
"test": "pnpm exec exodus-test --jest",
|
|
9
|
+
"typecheck": "pnpm exec tsc -p tsconfig.json --noEmit",
|
|
10
|
+
"lint": "pnpm exec eslint -c ../../eslint.config.mjs",
|
|
11
|
+
"lint:fix": "pnpm run lint --fix",
|
|
12
|
+
"format": "pnpm exec prettier --write \"**/*.{json,md,yaml}\" --log-level warn",
|
|
13
|
+
"format:check": "pnpm exec prettier --check \"**/*.{json,md,yaml}\" --log-level warn"
|
|
13
14
|
},
|
|
14
15
|
"type": "module",
|
|
15
16
|
"main": "index.js",
|
|
@@ -27,45 +28,45 @@
|
|
|
27
28
|
],
|
|
28
29
|
"repository": {
|
|
29
30
|
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/ExodusMovement/exodus
|
|
31
|
+
"url": "git+https://github.com/ExodusMovement/exodus.git"
|
|
31
32
|
},
|
|
32
|
-
"homepage": "https://github.com/ExodusMovement/exodus
|
|
33
|
+
"homepage": "https://github.com/ExodusMovement/exodus/tree/master/libs/features/fiat-balances",
|
|
33
34
|
"bugs": {
|
|
34
|
-
"url": "https://github.com/ExodusMovement/exodus
|
|
35
|
+
"url": "https://github.com/ExodusMovement/exodus/issues?q=is%3Aissue+is%3Aopen+label%3Afiat-balances"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@exodus/atoms": "^10.3.
|
|
38
|
-
"@exodus/basic-utils": "^5.
|
|
39
|
-
"@exodus/currency": "^6.
|
|
40
|
-
"@exodus/fiat-currencies": "^1.
|
|
41
|
-
"@exodus/formatting": "^11.
|
|
38
|
+
"@exodus/atoms": "^10.3.5",
|
|
39
|
+
"@exodus/basic-utils": "^5.2.1",
|
|
40
|
+
"@exodus/currency": "^6.4.2",
|
|
41
|
+
"@exodus/fiat-currencies": "^1.3.1",
|
|
42
|
+
"@exodus/formatting": "^11.1.1",
|
|
42
43
|
"lodash": "^4.17.21",
|
|
43
|
-
"minimalistic-assert": "^1.0.1",
|
|
44
44
|
"reselect": "^3.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@exodus/assets": "^11.0.0",
|
|
48
48
|
"@exodus/assets-base": "^12.0.0",
|
|
49
|
-
"@exodus/assets-feature": "^9.
|
|
50
|
-
"@exodus/available-assets": "^8.11.
|
|
51
|
-
"@exodus/balances": "^13.
|
|
52
|
-
"@exodus/blockchain-metadata": "^17.
|
|
49
|
+
"@exodus/assets-feature": "^9.7.0",
|
|
50
|
+
"@exodus/available-assets": "^8.11.2",
|
|
51
|
+
"@exodus/balances": "^13.16.1",
|
|
52
|
+
"@exodus/blockchain-metadata": "^17.2.1",
|
|
53
53
|
"@exodus/combined-assets-meta": "^3.3.2",
|
|
54
|
-
"@exodus/enabled-assets": "^10.
|
|
55
|
-
"@exodus/favorite-assets": "^2.6.
|
|
56
|
-
"@exodus/fee-data-monitors": "^5.0.
|
|
57
|
-
"@exodus/models": "^13.
|
|
58
|
-
"@exodus/rates-monitor": "^4.
|
|
59
|
-
"@exodus/redux-dependency-injection": "^
|
|
54
|
+
"@exodus/enabled-assets": "^10.12.0",
|
|
55
|
+
"@exodus/favorite-assets": "^2.6.1",
|
|
56
|
+
"@exodus/fee-data-monitors": "^5.0.6",
|
|
57
|
+
"@exodus/models": "^13.3.3",
|
|
58
|
+
"@exodus/rates-monitor": "^4.16.0",
|
|
59
|
+
"@exodus/redux-dependency-injection": "^5.0.0",
|
|
60
60
|
"@exodus/solana-meta": "^2.0.0",
|
|
61
|
-
"@exodus/storage-memory": "^2.4.
|
|
62
|
-
"@exodus/wallet-accounts": "^20.4.
|
|
61
|
+
"@exodus/storage-memory": "^2.4.1",
|
|
62
|
+
"@exodus/wallet-accounts": "^20.4.12",
|
|
63
63
|
"events": "^3.3.0",
|
|
64
|
+
"minimalistic-assert": "^1.0.1",
|
|
64
65
|
"redux": "^4.2.1"
|
|
65
66
|
},
|
|
66
67
|
"publishConfig": {
|
|
67
68
|
"access": "public",
|
|
68
69
|
"provenance": false
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "029a93c0112bc16a8a870d43af66b4c197adb9ea"
|
|
71
72
|
}
|
package/plugin/analytics.js
CHANGED
|
@@ -39,7 +39,7 @@ const createFiatBalancesAnalyticsPlugin = ({
|
|
|
39
39
|
|
|
40
40
|
const onStart = () => {
|
|
41
41
|
const unsubscribe = assetsTotalWalletAmountsAtom.observe((cryptoBalancesByAsset) => {
|
|
42
|
-
setBalanceProperties(cryptoBalancesByAsset)
|
|
42
|
+
void setBalanceProperties(cryptoBalancesByAsset)
|
|
43
43
|
})
|
|
44
44
|
|
|
45
45
|
subscriptions = [unsubscribe]
|
|
@@ -4,23 +4,37 @@ import fiatCurrencies from '@exodus/fiat-currencies'
|
|
|
4
4
|
const { USD } = fiatCurrencies
|
|
5
5
|
|
|
6
6
|
const createTrackNonDustAssetNamesPlugin = ({
|
|
7
|
-
|
|
7
|
+
assetsAtom,
|
|
8
8
|
fiatBalancesAtom,
|
|
9
9
|
fiatRateConverter,
|
|
10
10
|
nonDustBalanceAssetNamesAtom,
|
|
11
|
-
config: {
|
|
11
|
+
config: {
|
|
12
|
+
balanceThresholdsUsd,
|
|
13
|
+
balanceThresholdByChainUsd,
|
|
14
|
+
defaultBalanceThresholdUsd,
|
|
15
|
+
ignoredWalletAccounts = [],
|
|
16
|
+
},
|
|
12
17
|
}) => {
|
|
18
|
+
if (
|
|
19
|
+
!Array.isArray(ignoredWalletAccounts) ||
|
|
20
|
+
!ignoredWalletAccounts.every((walletAccount) => typeof walletAccount === 'string')
|
|
21
|
+
) {
|
|
22
|
+
throw new TypeError('ignoredWalletAccounts must be an array of wallet account names')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ignoredWalletAccountsSet = new Set(ignoredWalletAccounts)
|
|
26
|
+
|
|
13
27
|
const handleFiatBalancesChanged = async ({ balances }) => {
|
|
14
28
|
const { byAssetSource } = balances
|
|
15
29
|
if (!byAssetSource) return
|
|
16
30
|
|
|
17
|
-
const balancesByAssetSource = flattenToPaths(byAssetSource)
|
|
18
|
-
([walletAccount, assetName, _balanceField, balance]) => ({
|
|
31
|
+
const balancesByAssetSource = flattenToPaths(byAssetSource)
|
|
32
|
+
.map(([walletAccount, assetName, _balanceField, balance]) => ({
|
|
19
33
|
walletAccount,
|
|
20
34
|
assetName,
|
|
21
35
|
balance,
|
|
22
|
-
})
|
|
23
|
-
|
|
36
|
+
}))
|
|
37
|
+
.filter(({ walletAccount }) => !ignoredWalletAccountsSet.has(walletAccount))
|
|
24
38
|
|
|
25
39
|
const aboveThreshold = await filterAsync(
|
|
26
40
|
balancesByAssetSource,
|
|
@@ -50,7 +64,7 @@ const createTrackNonDustAssetNamesPlugin = ({
|
|
|
50
64
|
const onLoad = () => {
|
|
51
65
|
unobserveFiatBalancesAtom = fiatBalancesAtom.observe((data) => {
|
|
52
66
|
// don't block processing
|
|
53
|
-
handleFiatBalancesChanged(data)
|
|
67
|
+
void handleFiatBalancesChanged(data)
|
|
54
68
|
})
|
|
55
69
|
}
|
|
56
70
|
|
|
@@ -64,7 +78,8 @@ const createTrackNonDustAssetNamesPlugin = ({
|
|
|
64
78
|
defaultBalanceThresholdUsd
|
|
65
79
|
|
|
66
80
|
const isAboveEnableThreshold = async ({ assetName, usdBalance }) => {
|
|
67
|
-
const
|
|
81
|
+
const { value: assets } = await assetsAtom.get()
|
|
82
|
+
const asset = assets[assetName]
|
|
68
83
|
const reserve = asset.accountReserve || asset.currency.ZERO
|
|
69
84
|
const configuredThreshold = resolveConfiguredThreshold(asset)
|
|
70
85
|
const reserveUsd = asset.accountReserve
|
|
@@ -92,7 +107,7 @@ const trackNonDustAssetsNamesPluginDefinition = {
|
|
|
92
107
|
'nonDustBalanceAssetNamesAtom',
|
|
93
108
|
'fiatBalancesAtom',
|
|
94
109
|
'fiatRateConverter',
|
|
95
|
-
'
|
|
110
|
+
'assetsAtom',
|
|
96
111
|
'config?',
|
|
97
112
|
],
|
|
98
113
|
public: true,
|