@exodus/available-assets 8.6.0 → 8.8.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,28 @@
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
+ ## [8.8.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.6.0...@exodus/available-assets@8.8.0) (2025-08-22)
7
+
8
+ ### Features
9
+
10
+ - feat: memoize available asset names atom selector (#10829)
11
+
12
+ - feat: use atoms v9 (#9651)
13
+
14
+ ### License
15
+
16
+ - license: re-license under MIT license (#10580)
17
+
18
+ ## [8.7.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.6.0...@exodus/available-assets@8.7.0) (2024-11-25)
19
+
20
+ ### Features
21
+
22
+ - feat: use atoms v9 (#9651)
23
+
24
+ ### License
25
+
26
+ - license: re-license under MIT license (#10580)
27
+
6
28
  ## [8.6.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.5.0...@exodus/available-assets@8.5.1) (2024-09-30)
7
29
 
8
30
  ### Refactor
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2024 Exodus Movement, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @exodus/available-assets
2
2
 
3
- Tracks supported/available assets, i.e. assets that the user can potentially enable via the UI.
3
+ This Exodus SDK feature tracks available assets, i.e. assets that the user can potentially enable via the UI.
4
4
 
5
5
  ## Install
6
6
 
@@ -10,27 +10,31 @@ yarn add @exodus/available-assets
10
10
 
11
11
  ## Usage
12
12
 
13
+ This feature is designed to be used together with `@exodus/headless`. See [using the sdk](../../docs/development/using-the-sdk.md).
14
+
15
+ ### Play with it
16
+
17
+ 1. Open the playground https://exodus-hydra.pages.dev/features/available-assets
18
+ 2. Run `exodus.availableAssets.get()` in the Dev Tools Console.
19
+ 3. Run `selectors.availableAssets.all(store.getState())` in the Dev Tools Console.
20
+ 4. Run `selectors.availableAssets.get(store.getState())('bitcoin')` in the Dev Tools Console.
21
+ 5. Try out some other selectors from `selectors.availableAssets`. See example usage in [tests](./redux/__tests__/selectors/).
22
+
23
+ ### API Side
24
+
25
+ See [using the sdk](../../docs/development/using-the-sdk.md#setup-the-api-side) for more details on how features plug into the SDK and the API interface in the [type declaration](./api/index.d.ts).
26
+
27
+ If you're building a feature that requires knowing available assets, add a dependency on the `availableAssetNamesAtom`.
28
+
29
+ ### UI Side
30
+
31
+ See [using the sdk](../../docs/development/using-the-sdk.md#events) for more details on basic UI-side setup.
32
+
13
33
  ```js
14
- // see https://github.com/ExodusMovement/exodus-hydra/blob/c5632b131fd3cd210f658fb45113528c0e227beb/sdks/headless/__tests__/available-assets.test.js#L40
15
- import createExodus from '@exodus/headless'
16
- import availableAssets from '@exodus/available-assets'
17
-
18
- const container = createExodus({
19
- port,
20
- adapters,
21
- config: {
22
- // ...,
23
- // TODO: support configuring via feature config:
24
- // `container.use(availableAssets({ defaultAvailableAssetNames: ['bitcoin', 'ethereum']}))`
25
- availableAssetsAtom: {
26
- defaultAvailableAssetNames: ['bitcoin', 'ethereum'],
27
- },
28
- },
29
- })
30
-
31
- container.use(availableAssets())
32
-
33
- const exodus = container.resolve()
34
-
35
- const availableAssetNames = await exodus.availableAssets.get() // ['bitcoin', 'ethereum']
34
+ import selectors from '~/ui/flux/selectors'
35
+
36
+ const MyComponent = () => {
37
+ const bitcoin = useSelector((state) => selectors.availableAssets.get(state)('bitcoin'))
38
+ if (!bitcoin) return <div>Bitcoin is not supported</div>
39
+ }
36
40
  ```
@@ -1,9 +1,14 @@
1
1
  import { compute } from '@exodus/atoms'
2
+ import selector from './selector.js'
3
+ import memoizeOne from 'memoize-one'
4
+ import lodash from 'lodash'
5
+
6
+ const { isEqual } = lodash
2
7
 
3
8
  const createAvailableAssetNamesAtom = ({ availableAssetsAtom }) =>
4
9
  compute({
5
10
  atom: availableAssetsAtom,
6
- selector: (availableAssets) => availableAssets.map((a) => a.assetName),
11
+ selector: memoizeOne(selector, isEqual),
7
12
  })
8
13
 
9
14
  export default createAvailableAssetNamesAtom
@@ -0,0 +1,3 @@
1
+ const selector = (availableAssets) => availableAssets.map((a) => a.assetName)
2
+
3
+ export default selector
package/atoms/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import createAvailableAssetNamesWithoutParentCombinedAtom from './available-asset-names-without-parent-combined.js'
2
- import createAvailableAssetNamesAtom from './available-asset-names.js'
2
+ import createAvailableAssetNamesAtom from './available-asset-names/factory.js'
3
3
  import createAvailableAssetAtom from './available-assets.js'
4
4
 
5
5
  export const availableAssetNamesAtomDefinition = {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@exodus/available-assets",
3
- "version": "8.6.0",
4
- "description": "Tracks supported/available assets, i.e. assets that the user can potentially enable via the UI",
5
- "license": "UNLICENSED",
3
+ "version": "8.8.0",
4
+ "description": "This Exodus SDK feature tracks available assets, i.e. assets that the user can potentially enable via the UI.",
5
+ "license": "MIT",
6
6
  "author": "Exodus Movement, Inc.",
7
7
  "scripts": {
8
8
  "test": "run -T exodus-test --jest",
@@ -31,24 +31,27 @@
31
31
  "url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
32
32
  },
33
33
  "dependencies": {
34
- "@exodus/atoms": "^8.1.0",
34
+ "@exodus/atoms": "^9.0.0",
35
35
  "@exodus/basic-utils": "^3.0.1",
36
- "@exodus/core-selectors": "^3.0.0",
37
- "@exodus/trezor-meta": "^3.3.6",
36
+ "@exodus/core-selectors": "^4.0.0",
38
37
  "lodash": "^4.17.21",
39
38
  "make-concurrent": "^5.3.0",
39
+ "memoize-one": "^5.2.1",
40
40
  "reselect": "^3.0.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@exodus/assets": "^11.0.0",
44
44
  "@exodus/assets-base": "^10.0.0",
45
- "@exodus/assets-feature": "^5.12.0",
45
+ "@exodus/assets-feature": "^8.4.0",
46
46
  "@exodus/combined-assets-meta": "^3.0.0",
47
- "@exodus/enabled-assets": "^10.7.1",
48
- "@exodus/models": "^12.0.1",
49
- "@exodus/redux-dependency-injection": "^4.0.3",
47
+ "@exodus/enabled-assets": "^10.10.3",
48
+ "@exodus/models": "^12.16.0",
49
+ "@exodus/redux-dependency-injection": "^4.1.2",
50
50
  "jest-when": "^3.6.0",
51
51
  "redux": "^4.2.1"
52
52
  },
53
- "gitHead": "8353eb9f3712dcb5ba6808a8604f677de08980ed"
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "gitHead": "089fd1aa6a27487f0dd0de41b5235676545a9bdc"
54
57
  }