@exodus/balances 13.5.3 → 13.6.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,18 @@
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.6.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.5.4...@exodus/balances@13.6.0) (2025-01-21)
7
+
8
+ ### Features
9
+
10
+ - feat: createBalances selector (#11171)
11
+
12
+ ## [13.5.4](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.5.3...@exodus/balances@13.5.4) (2025-01-17)
13
+
14
+ ### Bug Fixes
15
+
16
+ - fix: balance typo "stakeable" (#11131)
17
+
6
18
  ## [13.5.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/balances@13.5.2...@exodus/balances@13.5.3) (2025-01-06)
7
19
 
8
20
  ### Bug Fixes
package/README.md CHANGED
@@ -10,7 +10,7 @@ yarn add @exodus/balances
10
10
 
11
11
  ## Usage
12
12
 
13
- This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md).
13
+ This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/development/using-the-sdk.md).
14
14
 
15
15
  ### Play with it
16
16
 
@@ -36,7 +36,7 @@ selectors.balances
36
36
 
37
37
  ### API Side
38
38
 
39
- See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md#setup-the-api-side) for more details on how features plug into the SDK. Note that the balances feature currently doesn't provide a top level API and is meant to be used purely through selectors.
39
+ See [using the sdk](../../docs/development/using-the-sdk.md#setup-the-api-side) for more details on how features plug into the SDK. Note that the balances feature currently doesn't provide a top level API and is meant to be used purely through selectors.
40
40
 
41
41
  If you're building a feature that requires balances, add a dependency on the `balancesAtom` as below. See also the [available balance fields](./default-config.js).
42
42
 
@@ -68,7 +68,7 @@ const myModuleDefinition = {
68
68
 
69
69
  ### UI Side
70
70
 
71
- See [using the sdk](../../docs/docs-website/docs/development/using-the-sdk.md#events) for more details on basic UI-side setup.
71
+ See [using the sdk](../../docs/development/using-the-sdk.md#events) for more details on basic UI-side setup.
72
72
 
73
73
  ```js
74
74
  import { selectors } from '~/ui/flux'
package/default-config.js CHANGED
@@ -8,7 +8,7 @@ const balanceFieldsConfig = [
8
8
  { name: 'networkReserve' },
9
9
  { name: 'staking' },
10
10
  { name: 'staked' },
11
- { name: 'stakable' },
11
+ { name: 'stakeable' },
12
12
  { name: 'unstaking' },
13
13
  { name: 'unstaked' },
14
14
  { name: 'rewards' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/balances",
3
- "version": "13.5.3",
3
+ "version": "13.6.0",
4
4
  "description": "Tracks crypto balances across enabled wallet accounts.",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@exodus/assets": "^11.0.0",
53
53
  "@exodus/assets-base": "^10.0.0",
54
- "@exodus/assets-feature": "^6.0.1",
54
+ "@exodus/assets-feature": "^6.0.4",
55
55
  "@exodus/available-assets": "^8.7.0",
56
56
  "@exodus/bitcoin-meta": "^2.0.0",
57
57
  "@exodus/blockchain-metadata": "^15.7.1",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "552dad03015b2b38c40cdf19662b3d26f0bc788e"
68
+ "gitHead": "ddeec2f9272f5959099ae94596ef2c5cf3f15558"
69
69
  }
@@ -35,7 +35,7 @@ const createBalanceSelectors = [
35
35
  { id: 'createNetworkReserve', field: 'networkReserve' },
36
36
  { id: 'createStaking', field: 'staking' },
37
37
  { id: 'createStaked', field: 'staked' },
38
- { id: 'createStakable', field: 'stakable' },
38
+ { id: 'createStakeable', field: 'stakeable' },
39
39
  { id: 'createUnstaking', field: 'unstaking' },
40
40
  { id: 'createUnstaked', field: 'unstaked' },
41
41
  { id: 'createRewards', field: 'rewards' },
@@ -0,0 +1,20 @@
1
+ import lodash from 'lodash'
2
+ import { createSelector } from 'reselect'
3
+ import { MY_STATE } from '@exodus/redux-dependency-injection'
4
+
5
+ const { memoize } = lodash // eslint-disable-line @exodus/basic-utils/prefer-basic-utils
6
+
7
+ const selectorFactory = (selfSelector) =>
8
+ memoize(
9
+ ({ assetName, walletAccount }) =>
10
+ createSelector(selfSelector, (balances) => balances[walletAccount]?.data[assetName]),
11
+ ({ assetName, walletAccount }) => [assetName, walletAccount].join('-')
12
+ )
13
+
14
+ const createBalancesSelectorDefinition = {
15
+ id: 'createBalances',
16
+ selectorFactory,
17
+ dependencies: [{ selector: MY_STATE }],
18
+ }
19
+
20
+ export default createBalancesSelectorDefinition
@@ -31,7 +31,7 @@ const getBalanceSelectors = [
31
31
  { id: 'getNetworkReserve', field: 'networkReserve' },
32
32
  { id: 'getStaking', field: 'staking' },
33
33
  { id: 'getStaked', field: 'staked' },
34
- { id: 'getStakable', field: 'stakable' },
34
+ { id: 'getStakeable', field: 'stakeable' },
35
35
  { id: 'getUnstaking', field: 'unstaking' },
36
36
  { id: 'getUnstaked', field: 'unstaked' },
37
37
  { id: 'getRewards', field: 'rewards' },
@@ -2,6 +2,7 @@ import byAssetSelectorDefinition from './by-asset.js'
2
2
  import createUnconfirmedBalanceSelectorDefinition from './create-unconfirmed-balance.js'
3
3
  import getBalanceForFieldSelectorDefinition from './get-balance-for-field.js'
4
4
  import getBalanceSelectors from './get-balance-selectors.js'
5
+ import createBalancesSelectorDefinition from './create-balances.js'
5
6
  import getBalancesSelectorDefinition from './get-balances.js'
6
7
  import createBalancesSelectors from './create-balance-selectors.js'
7
8
  import getUnconfirmedBalanceSelectorDefinition from './get-unconfirmed-balance.js'
@@ -14,6 +15,7 @@ export default [
14
15
  getBalanceForFieldSelectorDefinition,
15
16
  ...getBalanceSelectors,
16
17
  ...createBalancesSelectors,
18
+ createBalancesSelectorDefinition,
17
19
  getBalancesSelectorDefinition,
18
20
  getUnconfirmedBalanceSelectorDefinition,
19
21
  createFuelThresholdSelectorDefinition,