@exodus/available-assets 8.3.1 → 8.4.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,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
+ ## [8.4.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.4.0...@exodus/available-assets@8.4.1) (2024-07-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - mark optional configs as optional and remove unused configs ([#8075](https://github.com/ExodusMovement/exodus-hydra/issues/8075)) ([c1c990d](https://github.com/ExodusMovement/exodus-hydra/commit/c1c990dfcea35874d4bbc8429e97688e17977a9f))
11
+
12
+ ## [8.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.3.1...@exodus/available-assets@8.4.0) (2024-07-25)
13
+
14
+ ### Features
15
+
16
+ - **available-assets:** add default available assets. make this config optional ([#7936](https://github.com/ExodusMovement/exodus-hydra/issues/7936)) ([491a901](https://github.com/ExodusMovement/exodus-hydra/commit/491a9019efd135d6c8e65a4f20710a5ecaedc81c))
17
+
18
+ ### Bug Fixes
19
+
20
+ - migrate definitions ([#8030](https://github.com/ExodusMovement/exodus-hydra/issues/8030)) ([d2dfde5](https://github.com/ExodusMovement/exodus-hydra/commit/d2dfde55dfa843eb52842f64b3aac3a6f9a59069))
21
+
6
22
  ## [8.3.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/available-assets@8.3.0...@exodus/available-assets@8.3.1) (2024-07-18)
7
23
 
8
24
  **Note:** Version bump only for package @exodus/available-assets
@@ -1,8 +1,6 @@
1
1
  import { createInMemoryAtom } from '@exodus/atoms'
2
2
 
3
- const createAvailableAssetAtom = ({ config: { defaultAvailableAssetNames } }) =>
4
- createInMemoryAtom({
5
- defaultValue: defaultAvailableAssetNames.map((assetName) => ({ assetName, reason: 'default' })),
6
- })
3
+ // eslint-disable-next-line @exodus/hydra/in-memory-atom-default-value
4
+ const createAvailableAssetAtom = () => createInMemoryAtom()
7
5
 
8
6
  export default createAvailableAssetAtom
package/atoms/index.js CHANGED
@@ -7,13 +7,14 @@ export const availableAssetNamesAtomDefinition = {
7
7
  type: 'atom',
8
8
  factory: createAvailableAssetNamesAtom,
9
9
  dependencies: ['availableAssetsAtom'],
10
+ public: true,
10
11
  }
11
12
 
12
13
  export const availableAssetsAtomDefinition = {
13
14
  id: 'availableAssetsAtom',
14
15
  type: 'atom',
15
16
  factory: createAvailableAssetAtom,
16
- dependencies: ['config'],
17
+ public: true,
17
18
  }
18
19
 
19
20
  export const availableAssetNamesWithoutParentCombinedAtomDefinition = {
@@ -21,4 +22,5 @@ export const availableAssetNamesWithoutParentCombinedAtomDefinition = {
21
22
  type: 'atom',
22
23
  factory: createAvailableAssetNamesWithoutParentCombinedAtom,
23
24
  dependencies: ['assetsModule', 'availableAssetNamesAtom'],
25
+ public: true,
24
26
  }
package/index.js CHANGED
@@ -12,13 +12,13 @@ const availableAssets = (config = Object.create(null)) => ({
12
12
  definitions: [
13
13
  {
14
14
  definition: availableAssetsModuleDefinition,
15
- },
16
- {
17
- definition: availableAssetsAtomDefinition,
18
15
  config: {
19
16
  defaultAvailableAssetNames: config.defaultAvailableAssetNames,
20
17
  },
21
18
  },
19
+ {
20
+ definition: availableAssetsAtomDefinition,
21
+ },
22
22
  { definition: availableAssetNamesAtomDefinition },
23
23
  { definition: availableAssetNamesWithoutParentCombinedAtomDefinition },
24
24
  { definition: availableAssetsApiDefinition },
package/module/index.js CHANGED
@@ -8,6 +8,7 @@ class AvailableAssets extends ExodusModule {
8
8
  #availableAssetsAtom
9
9
  #enabledAndDisabledAssetsAtom
10
10
  #assetsAtom
11
+ #defaultAvailableAssetNames
11
12
  #subscriptions = []
12
13
 
13
14
  constructor({
@@ -15,10 +16,15 @@ class AvailableAssets extends ExodusModule {
15
16
  assetsAtom,
16
17
  availableAssetsAtom,
17
18
  enabledAndDisabledAssetsAtom,
19
+ // these are the hardcoded default available asset names
20
+ // we will filter this list by defined assets at assetsModule at start function
21
+ config: { defaultAvailableAssetNames = ['bitcoin', 'ethereum', 'solana'] } = Object.create(
22
+ null
23
+ ),
18
24
  logger,
19
25
  }) {
20
26
  super({ name: MODULE_ID, logger })
21
-
27
+ this.#defaultAvailableAssetNames = defaultAvailableAssetNames
22
28
  this.#assetsModule = assetsModule
23
29
  this.#assetsAtom = assetsAtom
24
30
  this.#availableAssetsAtom = availableAssetsAtom
@@ -26,6 +32,14 @@ class AvailableAssets extends ExodusModule {
26
32
  }
27
33
 
28
34
  start = async () => {
35
+ // we will filter the hardcoded default available asset names list by defined assets
36
+ // not every wallet will have the same assets set up
37
+ await this.#availableAssetsAtom.set(
38
+ this.#defaultAvailableAssetNames
39
+ .filter((name) => this.#assetsModule.getAsset(name))
40
+ .map((assetName) => ({ assetName, reason: 'default' }))
41
+ )
42
+
29
43
  const { added, updated } = await this.#assetsAtom.get()
30
44
 
31
45
  const toMakeAvailable = [...added, ...updated]
@@ -101,9 +115,11 @@ const availableAssetsDefinition = {
101
115
  'assetsModule',
102
116
  'enabledAndDisabledAssetsAtom',
103
117
  'logger',
118
+ 'config?',
104
119
  'availableAssetsAtom',
105
120
  'assetsAtom',
106
121
  ],
122
+ public: true,
107
123
  }
108
124
 
109
125
  export default availableAssetsDefinition
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@exodus/available-assets",
3
- "version": "8.3.1",
3
+ "version": "8.4.1",
4
4
  "description": "Tracks supported/available assets, i.e. assets that the user can potentially enable via the UI",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Exodus Movement, Inc.",
7
7
  "scripts": {
8
- "test": "run -T jest",
8
+ "test": "run -T exodus-test --jest --esbuild",
9
9
  "lint": "run -T eslint . --ignore-path ../../.gitignore",
10
10
  "lint:fix": "yarn lint --fix"
11
11
  },
@@ -42,7 +42,7 @@
42
42
  "devDependencies": {
43
43
  "@exodus/assets": "^9.1.1",
44
44
  "@exodus/assets-base": "^8.1.10",
45
- "@exodus/assets-feature": "^5.8.1",
45
+ "@exodus/assets-feature": "^5.8.3",
46
46
  "@exodus/combined-assets-meta": "^1.2.6-alpha-1",
47
47
  "@exodus/enabled-assets": "^6.0.2",
48
48
  "@exodus/models": "^11.12.0",
@@ -50,5 +50,5 @@
50
50
  "jest-when": "^3.6.0",
51
51
  "redux": "^4.2.1"
52
52
  },
53
- "gitHead": "a76a22c96445bcaa05e18de0e0c323cf9dd04cba"
53
+ "gitHead": "c6840317806103687455d7e31c5ca1d1c1e741f8"
54
54
  }
package/plugins/index.js CHANGED
@@ -34,6 +34,7 @@ const availableAssetsPluginDefinition = {
34
34
  type: 'plugin',
35
35
  factory: createAvailableAssetsPlugin,
36
36
  dependencies: ['port', 'availableAssetNamesAtom', 'availableAssets'],
37
+ public: true,
37
38
  }
38
39
 
39
40
  export default availableAssetsPluginDefinition
@@ -1,4 +1,4 @@
1
- import { memoize } from 'lodash'
1
+ import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
2
2
  import { pickBy } from '@exodus/basic-utils'
3
3
 
4
4
  const resultFunction = (availableAssets) =>
@@ -1,4 +1,4 @@
1
- import { memoize } from 'lodash'
1
+ import { memoize } from 'lodash' // eslint-disable-line @exodus/restricted-imports/prefer-basic-utils -- TODO: fix next time we touch this file
2
2
  import { createSelector } from 'reselect'
3
3
 
4
4
  const selectorFactory = (allAvailableAssetsSelector) =>