@exodus/balances 13.12.0 → 13.13.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 +10 -0
- package/module/index.js +28 -20
- package/package.json +10 -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.13.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.13.0...@exodus/balances@13.13.1) (2025-08-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/balances
|
|
9
|
+
|
|
10
|
+
## [13.13.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.12.0...@exodus/balances@13.13.0) (2025-07-16)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- feat: track errors from balances module (#13237)
|
|
15
|
+
|
|
6
16
|
## [13.12.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.11.0...@exodus/balances@13.12.0) (2025-07-10)
|
|
7
17
|
|
|
8
18
|
### Features
|
package/module/index.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
import { safeString } from '@exodus/safe-string'
|
|
1
2
|
import { isNumberUnit } from '@exodus/currency'
|
|
2
3
|
import { TxSet } from '@exodus/models'
|
|
3
4
|
import lodash from 'lodash'
|
|
4
5
|
import { difference as getChanges } from '@exodus/atoms'
|
|
5
|
-
import {
|
|
6
|
-
cloneDeepWith,
|
|
7
|
-
difference,
|
|
8
|
-
flattenToPaths,
|
|
9
|
-
pickByArrayPaths,
|
|
10
|
-
set,
|
|
11
|
-
} from '@exodus/basic-utils'
|
|
6
|
+
import { difference, flattenToPaths, pick, set } from '@exodus/basic-utils'
|
|
12
7
|
import makeConcurrent from 'make-concurrent'
|
|
13
8
|
import { processAssetBalances, validateBalances } from './balances-utils.js'
|
|
14
9
|
import defaultConfig from '../default-config.js'
|
|
15
10
|
|
|
16
11
|
const { isEmpty, merge, zipObject } = lodash
|
|
17
12
|
|
|
18
|
-
export const cloneBalances = (balances) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
export const cloneBalances = (balances) => {
|
|
14
|
+
if (isNumberUnit(balances)) {
|
|
15
|
+
return balances
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const cloned = Object.create(Object.getPrototypeOf(balances))
|
|
19
|
+
for (const key in balances) {
|
|
20
|
+
cloned[key] = cloneBalances(balances[key])
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return cloned
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
const zipNonNull = (keys, values) =>
|
|
26
27
|
zipObject(
|
|
@@ -46,7 +47,7 @@ class Balances {
|
|
|
46
47
|
#enabledWalletAccountsAtom
|
|
47
48
|
#loaded = false
|
|
48
49
|
#subscriptions = []
|
|
49
|
-
|
|
50
|
+
#errorTracking
|
|
50
51
|
constructor({
|
|
51
52
|
assetsModule,
|
|
52
53
|
availableAssetNamesAtom,
|
|
@@ -57,6 +58,7 @@ class Balances {
|
|
|
57
58
|
txLogsAtom,
|
|
58
59
|
accountStatesAtom,
|
|
59
60
|
feeDataAtom,
|
|
61
|
+
errorTracking,
|
|
60
62
|
}) {
|
|
61
63
|
this.#logger = logger
|
|
62
64
|
this.#assetsModule = assetsModule
|
|
@@ -68,6 +70,7 @@ class Balances {
|
|
|
68
70
|
this.#txLogsAtom = txLogsAtom
|
|
69
71
|
this.#feeDataAtom = feeDataAtom
|
|
70
72
|
this.#enabledWalletAccountsAtom = enabledWalletAccountsAtom
|
|
73
|
+
this.#errorTracking = errorTracking
|
|
71
74
|
|
|
72
75
|
const shareQueue =
|
|
73
76
|
(fn) =>
|
|
@@ -78,12 +81,12 @@ class Balances {
|
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
const swallowErrors =
|
|
81
|
-
(fn) =>
|
|
84
|
+
(fn, method) =>
|
|
82
85
|
async (...args) => {
|
|
83
86
|
try {
|
|
84
87
|
return await fn(...args)
|
|
85
88
|
} catch (error) {
|
|
86
|
-
this.#
|
|
89
|
+
this.#errorTracking.track({ error: new Error(method, { cause: error }) })
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
@@ -93,8 +96,11 @@ class Balances {
|
|
|
93
96
|
this.#handleFeeDataUpdate = shareQueue(this.#handleFeeDataUpdate)
|
|
94
97
|
this.#recompute = shareQueue(this.#recompute)
|
|
95
98
|
this.#onAssetsChanged = shareQueue(this.#onAssetsChanged)
|
|
96
|
-
this.#getBalancesForAssetSource = swallowErrors(
|
|
97
|
-
|
|
99
|
+
this.#getBalancesForAssetSource = swallowErrors(
|
|
100
|
+
this.#getBalancesForAssetSource,
|
|
101
|
+
safeString`getBalancesForAssetSource`
|
|
102
|
+
)
|
|
103
|
+
this.#setWalletAccounts = swallowErrors(this.#setWalletAccounts, safeString`setWalletAccounts`)
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
load = async () => {
|
|
@@ -118,10 +124,11 @@ class Balances {
|
|
|
118
124
|
this.#feeDataAtom.observe((changes) => {
|
|
119
125
|
Object.entries(changes).forEach(([assetName, feeData]) => {
|
|
120
126
|
const asset = this.#getAsset(assetName).baseAsset
|
|
121
|
-
if (asset.api?.features?.balancesRequireFeeData)
|
|
127
|
+
if (asset.api?.features?.balancesRequireFeeData) {
|
|
122
128
|
this.#walletAccounts.forEach((walletAccount) => {
|
|
123
129
|
return this.#handleFeeDataUpdate({ walletAccount, assetName, feeData })
|
|
124
130
|
})
|
|
131
|
+
}
|
|
125
132
|
})
|
|
126
133
|
}),
|
|
127
134
|
|
|
@@ -206,7 +213,7 @@ class Balances {
|
|
|
206
213
|
zero,
|
|
207
214
|
})
|
|
208
215
|
return validateBalances({
|
|
209
|
-
balances:
|
|
216
|
+
balances: pick(balances, this.#balanceFields),
|
|
210
217
|
asset,
|
|
211
218
|
zero,
|
|
212
219
|
logger: this.#logger,
|
|
@@ -426,6 +433,7 @@ const balancesDefinition = {
|
|
|
426
433
|
'txLogsAtom',
|
|
427
434
|
'accountStatesAtom',
|
|
428
435
|
'feeDataAtom',
|
|
436
|
+
'errorTracking',
|
|
429
437
|
],
|
|
430
438
|
public: true,
|
|
431
439
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.13.1",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@exodus/atoms": "^9.0.0",
|
|
37
|
-
"@exodus/basic-utils": "^
|
|
38
|
-
"@exodus/core-selectors": "^
|
|
37
|
+
"@exodus/basic-utils": "^3.0.1",
|
|
38
|
+
"@exodus/core-selectors": "^4.0.0",
|
|
39
39
|
"@exodus/currency": "^5.0.2",
|
|
40
40
|
"@exodus/errors": "^3.0.0",
|
|
41
41
|
"@exodus/models": "^12.0.1",
|
|
42
42
|
"@exodus/multi-account-redux": "^2.0.1",
|
|
43
43
|
"@exodus/redux-dependency-injection": "^4.0.3",
|
|
44
|
+
"@exodus/safe-string": "^1.1.0",
|
|
44
45
|
"@exodus/typeforce": "^1.18.0",
|
|
45
46
|
"@exodus/zod": "^3.24.2",
|
|
46
47
|
"lodash": "^4.17.21",
|
|
@@ -53,19 +54,19 @@
|
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@exodus/assets": "^11.0.0",
|
|
55
56
|
"@exodus/assets-base": "^10.0.0",
|
|
56
|
-
"@exodus/assets-feature": "^8.
|
|
57
|
-
"@exodus/available-assets": "^8.
|
|
57
|
+
"@exodus/assets-feature": "^8.4.0",
|
|
58
|
+
"@exodus/available-assets": "^8.8.0",
|
|
58
59
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
59
|
-
"@exodus/blockchain-metadata": "^15.
|
|
60
|
+
"@exodus/blockchain-metadata": "^15.14.0",
|
|
60
61
|
"@exodus/ethereum-meta": "^2.0.0",
|
|
61
62
|
"@exodus/fee-data-monitors": "^5.0.4",
|
|
62
|
-
"@exodus/storage-memory": "^2.
|
|
63
|
-
"@exodus/wallet-accounts": "^
|
|
63
|
+
"@exodus/storage-memory": "^2.3.0",
|
|
64
|
+
"@exodus/wallet-accounts": "^18.0.0",
|
|
64
65
|
"events": "^3.3.0",
|
|
65
66
|
"redux": "^4.2.1"
|
|
66
67
|
},
|
|
67
68
|
"publishConfig": {
|
|
68
69
|
"access": "public"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "089fd1aa6a27487f0dd0de41b5235676545a9bdc"
|
|
71
72
|
}
|