@exodus/assets-feature 4.1.0 → 4.1.2

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,20 @@
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.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.1.1...@exodus/assets-feature@4.1.2) (2024-02-20)
7
+
8
+ ### Bug Fixes
9
+
10
+ - make sure the check does not throw ([#5070](https://github.com/ExodusMovement/exodus-hydra/issues/5070)) ([b145ecc](https://github.com/ExodusMovement/exodus-hydra/commit/b145ecce8d5e2720edc9f422b913268e5f5b8364))
11
+ - native tokens auto-disabling when already in registry ([#5736](https://github.com/ExodusMovement/exodus-hydra/issues/5736)) ([feb9e8c](https://github.com/ExodusMovement/exodus-hydra/commit/feb9e8cf79f43f5be3987108bb2bc307c3648365))
12
+
13
+ ## [4.1.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@4.1.0...@exodus/assets-feature@4.1.1) (2024-01-19)
14
+
15
+ ### Bug Fixes
16
+
17
+ - merge mem ([#5448](https://github.com/ExodusMovement/exodus-hydra/issues/5448)) ([a6fb606](https://github.com/ExodusMovement/exodus-hydra/commit/a6fb6065bdabf0b9ebf0a678c5e748198f2dd100))
18
+ - remove duplicated analytics plugin ([#5442](https://github.com/ExodusMovement/exodus-hydra/issues/5442)) ([e453417](https://github.com/ExodusMovement/exodus-hydra/commit/e453417ee9f11574655031d91f060bff86bd0894))
19
+
6
20
  ## [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
21
 
8
22
  ### Features
@@ -102,15 +102,15 @@ class AssetClientInterface {
102
102
  accountState,
103
103
  batch = this.blockchainMetadata.batch(),
104
104
  }) => {
105
- if (!isEmpty(newData)) {
106
- return batch.updateAccountState({ assetName, walletAccount, newData })
107
- }
108
-
109
105
  // merge mem to keep the previous accountMem behavior
110
- if (newData.mem && (!accountState || accountState.mem)) {
106
+ if (!isEmpty(newData?.mem) && (!accountState || accountState.mem)) {
111
107
  newData = { ...newData, mem: { ...accountState?.mem, ...newData.mem } }
112
108
  }
113
109
 
110
+ if (!isEmpty(newData)) {
111
+ return batch.updateAccountState({ assetName, walletAccount, newData })
112
+ }
113
+
114
114
  return batch
115
115
  }
116
116
 
package/index.js CHANGED
@@ -7,7 +7,6 @@ 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'
11
10
 
12
11
  const assets = ({ config = {} } = {}) => {
13
12
  return {
@@ -36,10 +35,6 @@ const assets = ({ config = {} } = {}) => {
36
35
  },
37
36
  { definition: assetPreferencesDefinition },
38
37
  { definition: customTokensMonitorDefinition },
39
- {
40
- if: { registered: ['analytics'] },
41
- definition: enabledAssetsAnalyticsPluginDefinition,
42
- },
43
38
  ],
44
39
  }
45
40
  }
@@ -318,8 +318,8 @@ export class AssetsModule {
318
318
 
319
319
  if (isEmpty(tokens)) return
320
320
 
321
- const validTokens = tokensToAdd.filter(this.#validateCustomToken).map(normalizeToken)
322
- if (validTokens.length !== tokensToAdd.length) this.#logger.warn('Invalid Custom Token schema')
321
+ const validTokens = tokens.filter(this.#validateCustomToken).map(normalizeToken)
322
+ if (validTokens.length !== tokens.length) this.#logger.warn('Invalid Custom Token schema')
323
323
 
324
324
  const { fetchedAndHandledTokens, added, updated } = this.#handleFetchedTokens(validTokens)
325
325
 
@@ -481,8 +481,8 @@ export class AssetsModule {
481
481
 
482
482
  #assertSupportsCustomTokens = (baseAssetName) => {
483
483
  const baseAsset = this.getAsset(baseAssetName)
484
- if (!baseAsset.api.hasFeature('customTokens')) {
485
- const reason = `BUG: network ${baseAsset.name} does not support custom tokens.`
484
+ if (!baseAsset?.api?.hasFeature('customTokens')) {
485
+ const reason = `BUG: network ${baseAsset?.name} does not support custom tokens.`
486
486
  this.#logger.warn(reason)
487
487
  throw new Error(reason)
488
488
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Assets module, clients and apis",
6
6
  "main": "index.js",
@@ -48,6 +48,7 @@
48
48
  "@exodus/bitcoin-plugin": "^1.0.3",
49
49
  "@exodus/bitcoinregtest-plugin": "^1.0.3",
50
50
  "@exodus/bitcointestnet-plugin": "^1.0.3",
51
+ "@exodus/blockchain-metadata": "^15.1.0",
51
52
  "@exodus/combined-assets-meta": "^1.2.5",
52
53
  "@exodus/cosmos-plugin": "^1.0.0",
53
54
  "@exodus/ethereum-meta": "^1.1.0",
@@ -55,7 +56,7 @@
55
56
  "@exodus/osmosis-plugin": "^1.0.0",
56
57
  "@exodus/redux-dependency-injection": "^3.0.0",
57
58
  "@exodus/storage-memory": "^2.1.1",
58
- "@exodus/wallet-accounts": "^15.1.0",
59
+ "@exodus/wallet-accounts": "^16.0.0",
59
60
  "@exodus/wild-emitter": "^1.0.0",
60
61
  "eslint": "^8.44.0",
61
62
  "events": "^3.3.0",
@@ -63,5 +64,5 @@
63
64
  "msw": "^2.0.0",
64
65
  "redux": "^4.0.0"
65
66
  },
66
- "gitHead": "dae8c9d4c3dc27060210398351c9c3d9ed0caab7"
67
+ "gitHead": "27ed0586ad800043afc77ebe8192259fcfb966cc"
67
68
  }
@@ -1,26 +0,0 @@
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