@exodus/balances 13.14.0 → 13.15.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 +14 -0
- package/package.json +4 -4
- package/redux/selectors/create-balance-selectors.js +5 -5
- package/redux/selectors/create-balances.js +19 -3
- package/redux/selectors/create-fuel-threshold.js +3 -4
- package/redux/selectors/create-unconfirmed-balance.js +4 -4
- package/redux/selectors/get-balance-for-field.js +5 -3
- package/redux/selectors/get-unconfirmed-balance.js +4 -4
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.15.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.13.1...@exodus/balances@13.15.0) (2026-01-29)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: bump atoms for importers of observer factory (#14057)
|
|
11
|
+
|
|
12
|
+
- feat: introduce blockChainMetadataAtom (#14470)
|
|
13
|
+
|
|
14
|
+
- feat: update all consumers to use safe strings for error namespaces (#14429)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- fix(balances): default undefined balance fields to ZERO in createBalances (#15068)
|
|
19
|
+
|
|
6
20
|
## [13.14.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.13.1...@exodus/balances@13.14.0) (2025-11-27)
|
|
7
21
|
|
|
8
22
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.15.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@exodus/assets": "^11.0.0",
|
|
56
56
|
"@exodus/assets-base": "^10.0.0",
|
|
57
|
-
"@exodus/assets-feature": "^8.
|
|
58
|
-
"@exodus/available-assets": "^8.
|
|
57
|
+
"@exodus/assets-feature": "^8.8.0",
|
|
58
|
+
"@exodus/available-assets": "^8.10.1",
|
|
59
59
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
60
60
|
"@exodus/blockchain-metadata": "^17.1.0",
|
|
61
61
|
"@exodus/ethereum-meta": "^2.0.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"access": "public",
|
|
70
70
|
"provenance": false
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fe57e7a85d2fc2a56c20fca0cfdce3045ad7fe3b"
|
|
73
73
|
}
|
|
@@ -6,14 +6,14 @@ import { createSelector } from 'reselect'
|
|
|
6
6
|
const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
|
|
7
7
|
|
|
8
8
|
const createBalanceSelectorFactory = ({ field, id }) => {
|
|
9
|
-
const selectorFactory = (
|
|
9
|
+
const selectorFactory = (createAssetSelector, selfSelector) =>
|
|
10
10
|
memoize(
|
|
11
11
|
({ assetName, walletAccount }) =>
|
|
12
12
|
createSelector(
|
|
13
|
-
|
|
13
|
+
createAssetSelector(assetName),
|
|
14
14
|
selfSelector,
|
|
15
|
-
(
|
|
16
|
-
balances[walletAccount]?.data[assetName]?.[field] ??
|
|
15
|
+
(asset, balances) =>
|
|
16
|
+
balances[walletAccount]?.data[assetName]?.[field] ?? asset?.currency.ZERO
|
|
17
17
|
),
|
|
18
18
|
({ assetName, walletAccount, field }) => [assetName, walletAccount, field].join('-')
|
|
19
19
|
)
|
|
@@ -21,7 +21,7 @@ const createBalanceSelectorFactory = ({ field, id }) => {
|
|
|
21
21
|
return {
|
|
22
22
|
id,
|
|
23
23
|
selectorFactory,
|
|
24
|
-
dependencies: [{ module: 'assets', selector: '
|
|
24
|
+
dependencies: [{ module: 'assets', selector: 'createAssetSelector' }, { selector: MY_STATE }],
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -3,19 +3,35 @@ import lodash from 'lodash'
|
|
|
3
3
|
import { createSelector } from 'reselect'
|
|
4
4
|
import { MY_STATE } from '@exodus/redux-dependency-injection'
|
|
5
5
|
|
|
6
|
+
import defaultConfig from '../../default-config.js'
|
|
7
|
+
|
|
6
8
|
const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
const { balanceFields } = defaultConfig
|
|
11
|
+
|
|
12
|
+
const selectorFactory = (createAssetSelector, selfSelector) =>
|
|
9
13
|
memoize(
|
|
10
14
|
({ assetName, walletAccount }) =>
|
|
11
|
-
createSelector(selfSelector, (balances) =>
|
|
15
|
+
createSelector(createAssetSelector(assetName), selfSelector, (asset, balances) => {
|
|
16
|
+
const rawBalances = balances[walletAccount]?.data[assetName]
|
|
17
|
+
if (!rawBalances) return
|
|
18
|
+
|
|
19
|
+
const zero = asset?.currency?.ZERO
|
|
20
|
+
if (!zero) return rawBalances
|
|
21
|
+
const result = {}
|
|
22
|
+
for (const field of balanceFields) {
|
|
23
|
+
result[field] = rawBalances[field] ?? zero
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result
|
|
27
|
+
}),
|
|
12
28
|
({ assetName, walletAccount }) => [assetName, walletAccount].join('-')
|
|
13
29
|
)
|
|
14
30
|
|
|
15
31
|
const createBalancesSelectorDefinition = {
|
|
16
32
|
id: 'createBalances',
|
|
17
33
|
selectorFactory,
|
|
18
|
-
dependencies: [{ selector: MY_STATE }],
|
|
34
|
+
dependencies: [{ module: 'assets', selector: 'createAssetSelector' }, { selector: MY_STATE }],
|
|
19
35
|
}
|
|
20
36
|
|
|
21
37
|
export default createBalancesSelectorDefinition
|
|
@@ -5,10 +5,9 @@ import { isNumberUnit } from '@exodus/currency'
|
|
|
5
5
|
|
|
6
6
|
const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
|
|
7
7
|
|
|
8
|
-
const selectorFactory = (getFeeDataSelector,
|
|
8
|
+
const selectorFactory = (getFeeDataSelector, createAssetSelector) =>
|
|
9
9
|
memoize((assetName) =>
|
|
10
|
-
createSelector(getFeeDataSelector,
|
|
11
|
-
const asset = assets[assetName]
|
|
10
|
+
createSelector(getFeeDataSelector, createAssetSelector(assetName), (getFeeData, asset) => {
|
|
12
11
|
if (!asset) {
|
|
13
12
|
// not all assets are supported by Exodus.
|
|
14
13
|
return null
|
|
@@ -26,7 +25,7 @@ const createFuelThresholdSelectorDefinition = {
|
|
|
26
25
|
selectorFactory,
|
|
27
26
|
dependencies: [
|
|
28
27
|
{ module: 'feeData', selector: 'getData' },
|
|
29
|
-
{ module: 'assets', selector: '
|
|
28
|
+
{ module: 'assets', selector: 'createAssetSelector' },
|
|
30
29
|
],
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -5,13 +5,13 @@ import { getUnconfirmedBalance } from './get-unconfirmed-balance.js'
|
|
|
5
5
|
|
|
6
6
|
const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
|
|
7
7
|
|
|
8
|
-
const selectorFactory = (
|
|
8
|
+
const selectorFactory = (createAssetSelector, createAssetSourceSelector) =>
|
|
9
9
|
memoize(
|
|
10
10
|
({ assetName, walletAccount }) =>
|
|
11
11
|
createSelector(
|
|
12
|
-
|
|
12
|
+
createAssetSelector(assetName),
|
|
13
13
|
createAssetSourceSelector({ assetName, walletAccount }),
|
|
14
|
-
(
|
|
14
|
+
(asset, txs) => getUnconfirmedBalance({ asset, txs })
|
|
15
15
|
),
|
|
16
16
|
({ assetName, walletAccount }) => [assetName, walletAccount].join('-')
|
|
17
17
|
)
|
|
@@ -20,7 +20,7 @@ const createUnconfirmedBalanceSelectorDefinition = {
|
|
|
20
20
|
id: 'createUnconfirmedBalance',
|
|
21
21
|
selectorFactory,
|
|
22
22
|
dependencies: [
|
|
23
|
-
{ module: 'assets', selector: '
|
|
23
|
+
{ module: 'assets', selector: 'createAssetSelector' },
|
|
24
24
|
{ module: 'txLog', selector: 'createAssetSourceSelector' },
|
|
25
25
|
],
|
|
26
26
|
}
|
|
@@ -6,7 +6,7 @@ const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-bas
|
|
|
6
6
|
|
|
7
7
|
const { balanceFields } = defaultConfig
|
|
8
8
|
|
|
9
|
-
const resultFunction = (
|
|
9
|
+
const resultFunction = (getAsset, getBalances) =>
|
|
10
10
|
memoize(
|
|
11
11
|
({ assetName, walletAccount, field }) => {
|
|
12
12
|
if (!balanceFields.includes(field)) {
|
|
@@ -15,7 +15,9 @@ const resultFunction = (assets, getBalances) =>
|
|
|
15
15
|
)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
getBalances({ assetName, walletAccount })?.[field] ?? getAsset(assetName)?.currency.ZERO
|
|
20
|
+
)
|
|
19
21
|
},
|
|
20
22
|
({ assetName, walletAccount, field }) => [assetName, walletAccount, field].join('-')
|
|
21
23
|
)
|
|
@@ -24,7 +26,7 @@ const getBalanceForFieldSelectorDefinition = {
|
|
|
24
26
|
id: 'getBalanceForField',
|
|
25
27
|
resultFunction,
|
|
26
28
|
dependencies: [
|
|
27
|
-
{ module: 'assets', selector: '
|
|
29
|
+
{ module: 'assets', selector: 'getAsset' },
|
|
28
30
|
{ module: 'balances', selector: 'getBalances' },
|
|
29
31
|
],
|
|
30
32
|
}
|
|
@@ -19,12 +19,12 @@ export const getUnconfirmedBalance = ({ asset, txs }) => {
|
|
|
19
19
|
return result
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const selectorFactory = (
|
|
23
|
-
createSelector(
|
|
22
|
+
const selectorFactory = (getAssetSelector, createAssetSourceSelector) =>
|
|
23
|
+
createSelector(getAssetSelector, createAssetSourceSelector, (getAsset, getTxs) =>
|
|
24
24
|
memoize(
|
|
25
25
|
({ assetName, walletAccount }) =>
|
|
26
26
|
getUnconfirmedBalance({
|
|
27
|
-
asset:
|
|
27
|
+
asset: getAsset(assetName),
|
|
28
28
|
txs: getTxs({ assetName, walletAccount }),
|
|
29
29
|
}),
|
|
30
30
|
({ assetName, walletAccount }) => [assetName, walletAccount].join('-')
|
|
@@ -35,7 +35,7 @@ const getUnconfirmedBalanceSelectorDefinition = {
|
|
|
35
35
|
id: 'getUnconfirmedBalance',
|
|
36
36
|
selectorFactory,
|
|
37
37
|
dependencies: [
|
|
38
|
-
{ module: 'assets', selector: '
|
|
38
|
+
{ module: 'assets', selector: 'getAsset' },
|
|
39
39
|
{ module: 'txLog', selector: 'createAssetSourceSelectorOld' },
|
|
40
40
|
],
|
|
41
41
|
}
|