@exodus/balances 13.10.0 → 13.12.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
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.12.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.11.0...@exodus/balances@13.12.0) (2025-07-10)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: update basic utils in balances (#13183)
|
|
11
|
+
|
|
12
|
+
## [13.11.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.10.0...@exodus/balances@13.11.0) (2025-07-09)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- feat: getBalance, createBalance selectors to default 0 NU (#13164)
|
|
17
|
+
|
|
6
18
|
## [13.10.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.9.1...@exodus/balances@13.10.0) (2025-07-04)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/module/index.js
CHANGED
|
@@ -2,25 +2,25 @@ import { isNumberUnit } from '@exodus/currency'
|
|
|
2
2
|
import { TxSet } from '@exodus/models'
|
|
3
3
|
import lodash from 'lodash'
|
|
4
4
|
import { difference as getChanges } from '@exodus/atoms'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
cloneDeepWith,
|
|
7
|
+
difference,
|
|
8
|
+
flattenToPaths,
|
|
9
|
+
pickByArrayPaths,
|
|
10
|
+
set,
|
|
11
|
+
} from '@exodus/basic-utils'
|
|
6
12
|
import makeConcurrent from 'make-concurrent'
|
|
7
13
|
import { processAssetBalances, validateBalances } from './balances-utils.js'
|
|
8
14
|
import defaultConfig from '../default-config.js'
|
|
9
15
|
|
|
10
16
|
const { isEmpty, merge, zipObject } = lodash
|
|
11
17
|
|
|
12
|
-
export const cloneBalances = (balances) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const key in balances) {
|
|
19
|
-
cloned[key] = cloneBalances(balances[key])
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return cloned
|
|
23
|
-
}
|
|
18
|
+
export const cloneBalances = (balances) =>
|
|
19
|
+
cloneDeepWith(balances, (value) => {
|
|
20
|
+
if (isNumberUnit(value)) {
|
|
21
|
+
return value
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
24
|
|
|
25
25
|
const zipNonNull = (keys, values) =>
|
|
26
26
|
zipObject(
|
|
@@ -206,7 +206,7 @@ class Balances {
|
|
|
206
206
|
zero,
|
|
207
207
|
})
|
|
208
208
|
return validateBalances({
|
|
209
|
-
balances:
|
|
209
|
+
balances: pickByArrayPaths(balances, this.#balanceFields),
|
|
210
210
|
asset,
|
|
211
211
|
zero,
|
|
212
212
|
logger: this.#logger,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@exodus/atoms": "^9.0.0",
|
|
37
|
-
"@exodus/basic-utils": "^3.0
|
|
37
|
+
"@exodus/basic-utils": "^4.3.0",
|
|
38
38
|
"@exodus/core-selectors": "^3.0.0",
|
|
39
39
|
"@exodus/currency": "^5.0.2",
|
|
40
40
|
"@exodus/errors": "^3.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@exodus/assets": "^11.0.0",
|
|
55
55
|
"@exodus/assets-base": "^10.0.0",
|
|
56
|
-
"@exodus/assets-feature": "^8.1.
|
|
56
|
+
"@exodus/assets-feature": "^8.1.3",
|
|
57
57
|
"@exodus/available-assets": "^8.7.0",
|
|
58
58
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
59
59
|
"@exodus/blockchain-metadata": "^15.12.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "20a4bbabfa39c51c7e52e628fb5fa7a8ed54c72f"
|
|
71
71
|
}
|
|
@@ -5,12 +5,14 @@ import { createSelector } from 'reselect'
|
|
|
5
5
|
const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
|
|
6
6
|
|
|
7
7
|
const createBalanceSelectorFactory = ({ field, id }) => {
|
|
8
|
-
const selectorFactory = (selfSelector) =>
|
|
8
|
+
const selectorFactory = (assetsSelector, selfSelector) =>
|
|
9
9
|
memoize(
|
|
10
10
|
({ assetName, walletAccount }) =>
|
|
11
11
|
createSelector(
|
|
12
|
+
assetsSelector,
|
|
12
13
|
selfSelector,
|
|
13
|
-
(balances) =>
|
|
14
|
+
(assets, balances) =>
|
|
15
|
+
balances[walletAccount]?.data[assetName]?.[field] ?? assets[assetName]?.currency.ZERO
|
|
14
16
|
),
|
|
15
17
|
({ assetName, walletAccount, field }) => [assetName, walletAccount, field].join('-')
|
|
16
18
|
)
|
|
@@ -18,7 +20,7 @@ const createBalanceSelectorFactory = ({ field, id }) => {
|
|
|
18
20
|
return {
|
|
19
21
|
id,
|
|
20
22
|
selectorFactory,
|
|
21
|
-
dependencies: [{ selector: MY_STATE }],
|
|
23
|
+
dependencies: [{ module: 'assets', selector: 'all' }, { selector: MY_STATE }],
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -5,7 +5,7 @@ const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-bas
|
|
|
5
5
|
|
|
6
6
|
const { balanceFields } = defaultConfig
|
|
7
7
|
|
|
8
|
-
const resultFunction = (getBalances) =>
|
|
8
|
+
const resultFunction = (assets, getBalances) =>
|
|
9
9
|
memoize(
|
|
10
10
|
({ assetName, walletAccount, field }) => {
|
|
11
11
|
if (!balanceFields.includes(field)) {
|
|
@@ -14,7 +14,7 @@ const resultFunction = (getBalances) =>
|
|
|
14
14
|
)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return getBalances({ assetName, walletAccount })?.[field]
|
|
17
|
+
return getBalances({ assetName, walletAccount })?.[field] ?? assets[assetName]?.currency.ZERO
|
|
18
18
|
},
|
|
19
19
|
({ assetName, walletAccount, field }) => [assetName, walletAccount, field].join('-')
|
|
20
20
|
)
|
|
@@ -22,7 +22,10 @@ const resultFunction = (getBalances) =>
|
|
|
22
22
|
const getBalanceForFieldSelectorDefinition = {
|
|
23
23
|
id: 'getBalanceForField',
|
|
24
24
|
resultFunction,
|
|
25
|
-
dependencies: [
|
|
25
|
+
dependencies: [
|
|
26
|
+
{ module: 'assets', selector: 'all' },
|
|
27
|
+
{ module: 'balances', selector: 'getBalances' },
|
|
28
|
+
],
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export default getBalanceForFieldSelectorDefinition
|