@exodus/balances 13.1.0 → 13.1.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 CHANGED
@@ -3,6 +3,12 @@
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.1.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.1.0...@exodus/balances@13.1.1) (2024-04-09)
7
+
8
+ ### Bug Fixes
9
+
10
+ - don't recompute if asset already exist in balances ([#6410](https://github.com/ExodusMovement/exodus-hydra/issues/6410)) ([f7160cc](https://github.com/ExodusMovement/exodus-hydra/commit/f7160ccf90deb046a12f23f9f42bd78e74bb2859))
11
+
6
12
  ## [13.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.0.1...@exodus/balances@13.1.0) (2024-04-09)
7
13
 
8
14
  ### Features
package/module/index.js CHANGED
@@ -82,6 +82,7 @@ class Balances extends ExodusModule {
82
82
  this.#updateAssetSource = shareQueue(this.#updateAssetSource)
83
83
  this.#handleTxLogUpdate = shareQueue(this.#handleTxLogUpdate)
84
84
  this.#recompute = shareQueue(this.#recompute)
85
+ this.#onAssetsChanged = shareQueue(this.#onAssetsChanged)
85
86
  this.#getBalancesForAssetSource = captureErrors({
86
87
  fn: this.#getBalancesForAssetSource,
87
88
  name: 'getBalancesForAssetSource',
@@ -231,8 +232,15 @@ class Balances extends ExodusModule {
231
232
  }
232
233
  }
233
234
 
234
- #onAssetsChanged = async () => {
235
- // TODO: make this more efficient
235
+ #onAssetsChanged = async (added) => {
236
+ if (
237
+ added.every(({ name }) =>
238
+ this.#walletAccounts.every((walletAccount) => !!this.#balances?.[walletAccount]?.[name])
239
+ )
240
+ ) {
241
+ return
242
+ }
243
+
236
244
  this._logger.log('recomputing based on new assets list')
237
245
  this.#recompute()
238
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/balances",
3
- "version": "13.1.0",
3
+ "version": "13.1.1",
4
4
  "description": "Tracks crypto balances across enabled wallet accounts.",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "license": "UNLICENSED",
@@ -58,5 +58,5 @@
58
58
  "events": "^3.3.0",
59
59
  "redux": "^4.2.1"
60
60
  },
61
- "gitHead": "e3229e4313cd509df06eb7b689f29a7d257f82f2"
61
+ "gitHead": "09df4e0ee6f7185f8d715c6db5a64f1e5a8efd76"
62
62
  }