@exodus/assets-feature 4.0.1 → 4.1.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,19 @@
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
+ ## [4.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.0.2...@exodus/assets-feature@4.1.0) (2024-01-12)
7
+
8
+ ### Features
9
+
10
+ - **enabled-assets:** analytics plugin ([#5377](https://github.com/ExodusMovement/exodus-hydra/issues/5377)) ([36a8c4f](https://github.com/ExodusMovement/exodus-hydra/commit/36a8c4f748d038e35b74f6c805d033048e1d919e))
11
+
12
+ ## [4.0.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.0.1...@exodus/assets-feature@4.0.2) (2024-01-11)
13
+
14
+ ### Bug Fixes
15
+
16
+ - don't use monitor for unsupported asset ([#5315](https://github.com/ExodusMovement/exodus-hydra/issues/5315)) ([6432c86](https://github.com/ExodusMovement/exodus-hydra/commit/6432c863e5547ba1a74d730082a9e2e450729d0d))
17
+ - missing dependencies ([#5322](https://github.com/ExodusMovement/exodus-hydra/issues/5322)) ([01efedc](https://github.com/ExodusMovement/exodus-hydra/commit/01efedc7508fb14925277fdcd388afb721ac3dd1))
18
+
6
19
  ## [4.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.0.0...@exodus/assets-feature@4.0.1) (2023-12-13)
7
20
 
8
21
  - refactor: cache CTR request failures (https://github.com/ExodusMovement/exodus-hydra/pull/4975)
@@ -1,6 +1,7 @@
1
1
  import { pickBy } from '@exodus/basic-utils'
2
2
  import { isEmpty } from 'lodash'
3
3
  import assert from 'minimalistic-assert'
4
+ import { filterAsync } from '@exodus/basic-utils/lib/async'
4
5
 
5
6
  class AssetClientInterface {
6
7
  #availableAssetNamesAtom
@@ -119,7 +120,16 @@ class AssetClientInterface {
119
120
  // In the future, the list of wallets may be different based on the provided assets
120
121
  const asset = this.assetsModule.getAsset(assetName)
121
122
  assert(asset, `${assetName} is not supported`)
122
- return Object.keys(await this.#enabledWalletAccountsAtom.get())
123
+ const enabledWalletAccounts = await this.#enabledWalletAccountsAtom.get()
124
+ return filterAsync(Object.keys(enabledWalletAccounts), async (walletAccount) => {
125
+ try {
126
+ // hardware wallet account may not support coin, to check this get address
127
+ await this.getReceiveAddress({ assetName, walletAccount, useCache: true })
128
+ return true
129
+ } catch {
130
+ return false
131
+ }
132
+ })
123
133
  }
124
134
 
125
135
  // assets interface
package/index.js CHANGED
@@ -7,6 +7,7 @@ import assetModuleDefinition from './module'
7
7
  import customTokensMonitorDefinition from './monitor'
8
8
  import assetPreferencesDefinition from './module/asset-preferences'
9
9
  import assetsAtomDefinition from './atoms/assets'
10
+ import enabledAssetsAnalyticsPluginDefinition from './plugin/analytics'
10
11
 
11
12
  const assets = ({ config = {} } = {}) => {
12
13
  return {
@@ -19,9 +20,7 @@ const assets = ({ config = {} } = {}) => {
19
20
  storage: { namespace: 'assetPreferences' },
20
21
  config: config.multiAddressMode || {},
21
22
  },
22
- {
23
- definition: assetsAtomDefinition,
24
- },
23
+ { definition: assetsAtomDefinition },
25
24
  {
26
25
  definition: disabledPurposesAtomDefinition,
27
26
  storage: { namespace: 'assetPreferences' },
@@ -35,10 +34,12 @@ const assets = ({ config = {} } = {}) => {
35
34
  // storage: { namespace: 'customTokens' },
36
35
  aliases: [{ implementationId: 'customTokensStorage', interfaceId: 'storage' }],
37
36
  },
37
+ { definition: assetPreferencesDefinition },
38
+ { definition: customTokensMonitorDefinition },
38
39
  {
39
- definition: assetPreferencesDefinition,
40
+ if: { registered: ['analytics'] },
41
+ definition: enabledAssetsAnalyticsPluginDefinition,
40
42
  },
41
- { definition: customTokensMonitorDefinition },
42
43
  ],
43
44
  }
44
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Assets module, clients and apis",
6
6
  "main": "index.js",
@@ -31,8 +31,11 @@
31
31
  "url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
32
32
  },
33
33
  "dependencies": {
34
+ "@exodus/assets": "^8.0.95",
35
+ "@exodus/atoms": "^7.0.1",
34
36
  "@exodus/basic-utils": "^2.1.0",
35
37
  "@exodus/fetch": "^1.3.0",
38
+ "@exodus/module": "^1.2.2",
36
39
  "@exodus/timer": "^1.0.0",
37
40
  "lodash": "^4.17.21",
38
41
  "minimalistic-assert": "^1.0.1",
@@ -40,8 +43,6 @@
40
43
  "reselect": "^3.0.1"
41
44
  },
42
45
  "devDependencies": {
43
- "@exodus/assets": "^8.0.95",
44
- "@exodus/atoms": "^7.0.0",
45
46
  "@exodus/available-assets": "^8.0.0",
46
47
  "@exodus/bitcoin-meta": "^1.0.1",
47
48
  "@exodus/bitcoin-plugin": "^1.0.3",
@@ -51,11 +52,10 @@
51
52
  "@exodus/cosmos-plugin": "^1.0.0",
52
53
  "@exodus/ethereum-meta": "^1.1.0",
53
54
  "@exodus/models": "^9.1.1",
54
- "@exodus/module": "^1.2.2",
55
55
  "@exodus/osmosis-plugin": "^1.0.0",
56
56
  "@exodus/redux-dependency-injection": "^3.0.0",
57
57
  "@exodus/storage-memory": "^2.1.1",
58
- "@exodus/wallet-accounts": "^15.0.0",
58
+ "@exodus/wallet-accounts": "^15.1.0",
59
59
  "@exodus/wild-emitter": "^1.0.0",
60
60
  "eslint": "^8.44.0",
61
61
  "events": "^3.3.0",
@@ -63,5 +63,5 @@
63
63
  "msw": "^2.0.0",
64
64
  "redux": "^4.0.0"
65
65
  },
66
- "gitHead": "8a27fc57a2783ecc728030da8b3d2a10fa8f915c"
66
+ "gitHead": "dae8c9d4c3dc27060210398351c9c3d9ed0caab7"
67
67
  }
@@ -0,0 +1,26 @@
1
+ const createEnabledAssetsAnalyticsPlugin = ({ analytics, enabledAssetsAtom }) => {
2
+ let unsubscribe
3
+
4
+ const onStart = () => {
5
+ analytics.requireDefaultProperties(['numberOfAssetsEnabled'])
6
+
7
+ unsubscribe = enabledAssetsAtom.observe((enabledAssets) => {
8
+ const numberOfAssetsEnabled = Object.keys(enabledAssets).length
9
+
10
+ analytics.setDefaultProperties({ numberOfAssetsEnabled })
11
+ })
12
+ }
13
+
14
+ const onStop = () => unsubscribe()
15
+
16
+ return { onStart, onStop }
17
+ }
18
+
19
+ const enabledAssetsAnalyticsPluginDefinition = {
20
+ id: 'enabledAssetsAnalyticsPlugin',
21
+ type: 'plugin',
22
+ factory: createEnabledAssetsAnalyticsPlugin,
23
+ dependencies: ['analytics', 'enabledAssetsAtom'],
24
+ }
25
+
26
+ export default enabledAssetsAnalyticsPluginDefinition