@exodus/balances 9.1.0 → 10.0.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,22 @@
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
+ ## [10.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@9.1.1...@exodus/balances@10.0.0) (2023-08-31)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - accept feature config (#3789)
11
+
12
+ ### Features
13
+
14
+ - accept feature config ([#3789](https://github.com/ExodusMovement/exodus-hydra/issues/3789)) ([beac45f](https://github.com/ExodusMovement/exodus-hydra/commit/beac45fd516383b1ab48fc077a417cbc06ba9f5b))
15
+
16
+ ## [9.1.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@9.1.0...@exodus/balances@9.1.1) (2023-08-28)
17
+
18
+ ### Bug Fixes
19
+
20
+ - don't try to find tokens for tokens ([#3663](https://github.com/ExodusMovement/exodus-hydra/issues/3663)) ([1e9e3cc](https://github.com/ExodusMovement/exodus-hydra/commit/1e9e3ccfe6339160d9a7b01dc96e5b36b6e78e3f))
21
+
6
22
  ## [9.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@9.0.0...@exodus/balances@9.1.0) (2023-08-25)
7
23
 
8
24
  ### Features
package/index.js CHANGED
@@ -2,14 +2,24 @@ import balancesDefinition from './module'
2
2
  import { balancesAtomDefinition, hasBalanceAtomDefinition } from './atoms'
3
3
  import balancesReportDefinition from './report'
4
4
  import balancesPluginDefinition from './plugins'
5
+ import typeforce from '@exodus/typeforce'
6
+
7
+ const balances = (config) => {
8
+ typeforce(
9
+ {
10
+ balanceFields: typeforce.arrayOf('String'),
11
+ },
12
+ config,
13
+ true
14
+ )
5
15
 
6
- const balances = () => {
7
16
  return {
8
17
  id: 'balances',
9
18
  definitions: [
10
19
  {
11
20
  definition: balancesDefinition,
12
21
  writesAtoms: ['balancesAtom'],
22
+ config,
13
23
  },
14
24
  { definition: balancesAtomDefinition },
15
25
  { definition: hasBalanceAtomDefinition },
package/module/index.js CHANGED
@@ -241,8 +241,16 @@ class Balances extends ExodusModule {
241
241
  #isSupportedAsset = (assetName) => !this.#getAsset(assetName).isCombined
242
242
  #getSupportedAssetNames = () => Object.keys(this.#getAssets()).filter(this.#isSupportedAsset)
243
243
 
244
- #getRelatedAssetNames = (assetName) =>
245
- [assetName, ...this.#assetsModule.getTokenNames(assetName)].filter(this.#isSupportedAsset)
244
+ #getRelatedAssetNames = (assetName) => {
245
+ const asset = this.#assetsModule.getAsset(assetName)
246
+ if (asset.baseAsset.name === assetName) {
247
+ return [assetName, ...this.#assetsModule.getTokenNames(assetName)].filter(
248
+ this.#isSupportedAsset
249
+ )
250
+ }
251
+
252
+ return [assetName]
253
+ }
246
254
 
247
255
  #loadBlockchainMetadataForBalance = async ({
248
256
  assetName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/balances",
3
- "version": "9.1.0",
3
+ "version": "10.0.0",
4
4
  "description": "Tracks crypto balances across enabled wallet accounts.",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "license": "UNLICENSED",
@@ -28,10 +28,11 @@
28
28
  "url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Abalances"
29
29
  },
30
30
  "dependencies": {
31
- "@exodus/atoms": "^5.5.0",
31
+ "@exodus/atoms": "^5.6.0",
32
32
  "@exodus/basic-utils": "^2.1.0",
33
33
  "@exodus/currency": "^2.1.2",
34
34
  "@exodus/module": "^1.1.0",
35
+ "@exodus/typeforce": "^1.18.0",
35
36
  "lodash": "^4.17.21",
36
37
  "make-concurrent": "^4.0.0"
37
38
  },
@@ -49,5 +50,5 @@
49
50
  "events": "^3.3.0",
50
51
  "jest": "^29.1.2"
51
52
  },
52
- "gitHead": "e0f0debef36a017b662a3eeb736552bd9aae9493"
53
+ "gitHead": "4723d0740241b427c00485e30c0d89a3c6e423b4"
53
54
  }
package/plugins/index.js CHANGED
@@ -4,7 +4,7 @@ const createBalancesPlugin = ({ balancesAtom, port, balances }) => {
4
4
  const balancesAtomObserver = createAtomObserver({
5
5
  port,
6
6
  atom: balancesAtom,
7
- event: 'balancesAtom',
7
+ event: 'balancesAtom', // eslint-disable-line hydra/no-atom-event-suffix -- TODO: rename when creating the balances redux module
8
8
  })
9
9
  balancesAtomObserver.register()
10
10