@exodus/balances 7.0.0 → 7.1.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 +11 -0
- package/module/index.js +16 -8
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [7.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@6.1.0...@exodus/balances@7.1.0) (2023-07-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **balances:** has balance atom ([#2761](https://github.com/ExodusMovement/exodus-hydra/issues/2761)) ([1b9e51e](https://github.com/ExodusMovement/exodus-hydra/commit/1b9e51e3074e368840832fedc7da45298d442347))
|
|
11
|
+
- move balances to feature dir ([#2757](https://github.com/ExodusMovement/exodus-hydra/issues/2757)) ([8d0729a](https://github.com/ExodusMovement/exodus-hydra/commit/8d0729a470e9f1329814cca7e1ceb01bbc5db4b6))
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- don't crash when a single asset fails to get balance ([#2828](https://github.com/ExodusMovement/exodus-hydra/issues/2828)) ([547ddac](https://github.com/ExodusMovement/exodus-hydra/commit/547ddac4b1a7e1e81db1f3a504dacada50e9ae62))
|
|
16
|
+
|
|
6
17
|
## [7.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@6.1.0...@exodus/balances@7.0.0) (2023-07-21)
|
|
7
18
|
|
|
8
19
|
### ⚠ BREAKING CHANGES
|
package/module/index.js
CHANGED
|
@@ -53,13 +53,15 @@ class Balances extends ExodusModule {
|
|
|
53
53
|
this.#pushIntoSharedQueue(() => fn.apply(this, args))
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
// sanitize args in case someone passes something sensitive, e.g. getBalance({ walletAccount, mnemonic })
|
|
57
|
+
// when only `{ walletAccount }` is expected
|
|
56
58
|
const captureErrors =
|
|
57
|
-
(fn, name) =>
|
|
59
|
+
({ fn, name, sanitizeArgs = () => {} }) =>
|
|
58
60
|
async (...args) => {
|
|
59
61
|
try {
|
|
60
62
|
return await fn(...args)
|
|
61
63
|
} catch (error) {
|
|
62
|
-
this.emit('error', { fn: name, error })
|
|
64
|
+
this.emit('error', { fn: name, error, args: sanitizeArgs(...args) })
|
|
63
65
|
throw error
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -68,12 +70,17 @@ class Balances extends ExodusModule {
|
|
|
68
70
|
this.#updateAssetSource = shareQueue(this.#updateAssetSource)
|
|
69
71
|
this.#handleTxLogUpdate = shareQueue(this.#handleTxLogUpdate)
|
|
70
72
|
this.#recompute = shareQueue(this.#recompute)
|
|
71
|
-
this.#getBalancesForAssetSource = captureErrors(
|
|
72
|
-
this.#getBalancesForAssetSource,
|
|
73
|
-
'getBalancesForAssetSource'
|
|
74
|
-
|
|
73
|
+
this.#getBalancesForAssetSource = captureErrors({
|
|
74
|
+
fn: this.#getBalancesForAssetSource,
|
|
75
|
+
name: 'getBalancesForAssetSource',
|
|
76
|
+
sanitizeArgs: ({ walletAccount, assetName }) => ({ walletAccount, assetName }),
|
|
77
|
+
})
|
|
75
78
|
|
|
76
|
-
this.#setWalletAccounts = captureErrors(
|
|
79
|
+
this.#setWalletAccounts = captureErrors({
|
|
80
|
+
fn: this.#setWalletAccounts,
|
|
81
|
+
name: 'setWalletAccounts',
|
|
82
|
+
sanitizeArgs: (walletAccounts) => walletAccounts,
|
|
83
|
+
})
|
|
77
84
|
|
|
78
85
|
blockchainMetadata.once('load-wallet-accounts', () => {
|
|
79
86
|
// eslint-disable-next-line hydra/module-side-effects
|
|
@@ -177,10 +184,11 @@ class Balances extends ExodusModule {
|
|
|
177
184
|
|
|
178
185
|
#getBalancesForWalletAccount = async ({ walletAccount }) => {
|
|
179
186
|
const assetNames = this.#getSupportedAssetNames()
|
|
180
|
-
const
|
|
187
|
+
const results = await Promise.allSettled(
|
|
181
188
|
assetNames.map((assetName) => this.#getBalancesForAssetSource({ assetName, walletAccount }))
|
|
182
189
|
)
|
|
183
190
|
|
|
191
|
+
const balances = results.map(({ value }) => value).filter(Boolean)
|
|
184
192
|
return merge(Object.create(null), ...balances)
|
|
185
193
|
}
|
|
186
194
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Abalances"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@exodus/atoms": "^5.2.
|
|
30
|
+
"@exodus/atoms": "^5.2.3",
|
|
31
31
|
"@exodus/basic-utils": "^2.0.0",
|
|
32
32
|
"@exodus/currency": "^2.1.2",
|
|
33
33
|
"@exodus/module": "^1.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"events": "^3.3.0",
|
|
47
47
|
"jest": "^29.1.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "6d6d294bc19df3f2b7e67096547012f9eb3cabd7"
|
|
50
50
|
}
|