@exodus/balances 6.0.1 → 6.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 +7 -0
- package/module/index.js +22 -3
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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
|
+
## [6.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@6.0.1...@exodus/balances@6.1.0) (2023-07-19)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- capture #setWalletAccounts ([#2723](https://github.com/ExodusMovement/exodus-hydra/issues/2723)) ([af8c52b](https://github.com/ExodusMovement/exodus-hydra/commit/af8c52b6f4623e490d470b6185fafb4b771d5bcc))
|
|
11
|
+
- emit errors from balances module ([#2718](https://github.com/ExodusMovement/exodus-hydra/issues/2718)) ([d150e55](https://github.com/ExodusMovement/exodus-hydra/commit/d150e555c76e9fedc3defb2023f8b161ce99c5f1))
|
|
12
|
+
|
|
6
13
|
## [6.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@6.0.0...@exodus/balances@6.0.1) (2023-06-21)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @exodus/balances
|
package/module/index.js
CHANGED
|
@@ -53,10 +53,27 @@ class Balances extends ExodusModule {
|
|
|
53
53
|
this.#pushIntoSharedQueue(() => fn.apply(this, args))
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
const captureErrors =
|
|
57
|
+
(fn, name) =>
|
|
58
|
+
async (...args) => {
|
|
59
|
+
try {
|
|
60
|
+
return await fn(...args)
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.emit('error', { fn: name, error })
|
|
63
|
+
throw error
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
56
67
|
// these share a queue
|
|
57
68
|
this.#updateAssetSource = shareQueue(this.#updateAssetSource)
|
|
58
69
|
this.#handleTxLogUpdate = shareQueue(this.#handleTxLogUpdate)
|
|
59
70
|
this.#recompute = shareQueue(this.#recompute)
|
|
71
|
+
this.#getBalancesForAssetSource = captureErrors(
|
|
72
|
+
this.#getBalancesForAssetSource,
|
|
73
|
+
'getBalancesForAssetSource'
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
this.#setWalletAccounts = captureErrors(this.#setWalletAccounts, 'setWalletAccounts')
|
|
60
77
|
|
|
61
78
|
blockchainMetadata.once('load-wallet-accounts', () => {
|
|
62
79
|
// eslint-disable-next-line hydra/module-side-effects
|
|
@@ -172,7 +189,7 @@ class Balances extends ExodusModule {
|
|
|
172
189
|
this.#balances[walletAccount] = await this.#getBalancesForWalletAccount({ walletAccount })
|
|
173
190
|
}
|
|
174
191
|
|
|
175
|
-
#setWalletAccounts = (walletAccounts) => {
|
|
192
|
+
#setWalletAccounts = async (walletAccounts) => {
|
|
176
193
|
const added = difference(walletAccounts, this.#walletAccounts)
|
|
177
194
|
const removed = difference(this.#walletAccounts, walletAccounts)
|
|
178
195
|
if (added.length === 0 && removed.length === 0) return
|
|
@@ -188,7 +205,7 @@ class Balances extends ExodusModule {
|
|
|
188
205
|
|
|
189
206
|
if (added.length > 0) {
|
|
190
207
|
this._logger.log('recomputing after adding walletAccounts', added)
|
|
191
|
-
this.#recompute({ walletAccounts: added })
|
|
208
|
+
await this.#recompute({ walletAccounts: added })
|
|
192
209
|
} else {
|
|
193
210
|
this.#flush()
|
|
194
211
|
}
|
|
@@ -317,7 +334,7 @@ class Balances extends ExodusModule {
|
|
|
317
334
|
|
|
318
335
|
const createBalances = (opts) => new Balances(opts)
|
|
319
336
|
|
|
320
|
-
|
|
337
|
+
const balancesDefinition = {
|
|
321
338
|
id: MODULE_ID,
|
|
322
339
|
type: 'module',
|
|
323
340
|
factory: createBalances,
|
|
@@ -330,3 +347,5 @@ export default {
|
|
|
330
347
|
'balancesAtom',
|
|
331
348
|
],
|
|
332
349
|
}
|
|
350
|
+
|
|
351
|
+
export default balancesDefinition
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/balances",
|
|
3
|
-
"version": "6.0
|
|
4
|
-
"description": "balances",
|
|
5
|
-
"author": "Exodus Movement Inc",
|
|
3
|
+
"version": "6.1.0",
|
|
4
|
+
"description": "Tracks crypto balances across enabled wallet accounts.",
|
|
5
|
+
"author": "Exodus Movement Inc.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "jest",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"atoms",
|
|
15
15
|
"README.md",
|
|
16
16
|
"CHANGELOG.md",
|
|
17
|
-
"!**/__tests__"
|
|
17
|
+
"!**/__tests__/**"
|
|
18
18
|
],
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Abalances"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@exodus/atoms": "^5.
|
|
28
|
+
"@exodus/atoms": "^5.2.2",
|
|
29
29
|
"@exodus/basic-utils": "^2.0.0",
|
|
30
30
|
"@exodus/currency": "^2.1.2",
|
|
31
31
|
"@exodus/module": "^1.1.0",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@exodus/models": "^8.9.0",
|
|
41
41
|
"@exodus/storage-memory": "*",
|
|
42
42
|
"@exodus/wallet-accounts": "^9.1.0",
|
|
43
|
-
"eslint": "^8.
|
|
43
|
+
"eslint": "^8.44.0",
|
|
44
44
|
"events": "^3.3.0",
|
|
45
45
|
"jest": "^29.1.2"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4d8041f79655449cca977603e87d647c2a3e8df8"
|
|
48
48
|
}
|