@exodus/assets-feature 8.6.0 → 8.7.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,12 @@
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.7.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@8.6.0...@exodus/assets-feature@8.7.0) (2025-09-24)
7
+
8
+ ### Features
9
+
10
+ - feat: filter out invalid custom token names in addRemoteTokens (#13839)
11
+
6
12
  ## [8.6.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@8.5.0...@exodus/assets-feature@8.6.0) (2025-09-19)
7
13
 
8
14
  ### Features
@@ -4,7 +4,7 @@ import {
4
4
  CT_STATUS as STATUS,
5
5
  CT_UPDATEABLE_PROPERTIES,
6
6
  } from '@exodus/assets'
7
- import { keyBy, mapValues, partition, pick, pickBy, difference } from '@exodus/basic-utils'
7
+ import { keyBy, mapValues, partition, pickBy, difference } from '@exodus/basic-utils'
8
8
  import lodash from 'lodash'
9
9
  import assert from 'minimalistic-assert'
10
10
  import { memoizeLruCache } from '@exodus/asset-lib'
@@ -26,7 +26,8 @@ import { validateCustomToken, isValidCustomToken } from '@exodus/asset-schema-va
26
26
  import makeConcurrent from 'make-concurrent'
27
27
  import oldToNewStyleTokenNames from '@exodus/asset-legacy-token-name-mapping'
28
28
 
29
- const { get, isEmpty, once, uniq, chunk } = lodash
29
+ // eslint-disable-next-line @exodus/basic-utils/prefer-basic-utils
30
+ const { get, isEmpty, once, uniq, chunk, pick } = lodash
30
31
 
31
32
  const getFetchCacheKey = (baseAssetName, assetId) => `${assetId}-${baseAssetName}`
32
33
 
@@ -110,7 +111,12 @@ export class AssetsModule {
110
111
  this.#fetchCacheExpiry = config.fetchCacheExpiry ?? CT_FETCH_CACHE_EXPIRY
111
112
  this.#fetchival = createFetchival({ fetch })
112
113
  this.#logger = logger
113
- this.#invalidTokenNames = new Set(Object.keys(oldToNewStyleTokenNames))
114
+ this.#invalidTokenNames = new Set([
115
+ ...Object.keys(oldToNewStyleTokenNames).filter(
116
+ (name) => name !== oldToNewStyleTokenNames[name]
117
+ ),
118
+ ...(config.invalidTokenNames || []),
119
+ ])
114
120
  }
115
121
 
116
122
  #setRegistry = (registry) => {
@@ -382,14 +388,16 @@ export class AssetsModule {
382
388
 
383
389
  addRemoteTokens = async ({ tokenNames, allowedStatusList }) => {
384
390
  this.#assertCustomTokensStorageSupported()
391
+ assert(Array.isArray(tokenNames), 'addRemoteTokens: expected array')
385
392
  assert(
386
393
  !allowedStatusList || Array.isArray(allowedStatusList),
387
394
  'addRemoteTokens: expected `allowedStatusList` to be an array'
388
395
  )
389
396
 
390
397
  const assets = this.getAssets()
398
+ const validNames = tokenNames.filter((name) => this.#validCustomTokenName({ name }))
391
399
  const [tokenNamesToUpdate, tokenNamesToFetch] = partition(
392
- tokenNames,
400
+ validNames,
393
401
  (tokenName) => !!assets[tokenName]
394
402
  )
395
403
 
@@ -680,6 +688,8 @@ export class AssetsModule {
680
688
  }
681
689
  }
682
690
 
691
+ #validCustomTokenName = ({ name }) => !this.#invalidTokenNames.has(name)
692
+
683
693
  // Custom Tokens storage
684
694
 
685
695
  #assertCustomTokensStorageSupported = () => {
@@ -693,10 +703,7 @@ export class AssetsModule {
693
703
 
694
704
  const tokens = await this.#storage.get(this.#storageDataKey)
695
705
  const normalizedTokens = mapValues(tokens, normalizeToken)
696
- return pickBy(
697
- normalizedTokens,
698
- ({ name }) => !this.#invalidTokenNames.has(name) || name === oldToNewStyleTokenNames[name]
699
- )
706
+ return pickBy(normalizedTokens, this.#validCustomTokenName)
700
707
  }
701
708
 
702
709
  #updateStoredCustomTokens = async (tokens) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "license": "MIT",
5
5
  "description": "This Exodus SDK feature provides access to instances of all blockchain asset adapters supported by the wallet, and enables you to search for and add custom tokens at runtime.",
6
6
  "type": "module",
@@ -40,7 +40,7 @@
40
40
  "@exodus/asset-schema-validation": "^1.0.1",
41
41
  "@exodus/assets": "^11.3.0",
42
42
  "@exodus/atoms": "^9.0.0",
43
- "@exodus/basic-utils": "^4.0.0",
43
+ "@exodus/basic-utils": "^3.6.0",
44
44
  "@exodus/fetch": "^1.3.0",
45
45
  "@exodus/fusion-atoms": "^1.4.0",
46
46
  "@exodus/timer": "^1.1.2",
@@ -73,7 +73,7 @@
73
73
  "@exodus/public-key-provider": "^4.2.0",
74
74
  "@exodus/redux-dependency-injection": "^4.1.2",
75
75
  "@exodus/storage-memory": "^2.3.0",
76
- "@exodus/wallet-accounts": "^19.1.0",
76
+ "@exodus/wallet-accounts": "^20.0.0",
77
77
  "@exodus/wild-emitter": "^1.0.0",
78
78
  "events": "^3.3.0",
79
79
  "msw": "^2.0.0",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "bf7e26ead6a6562139716a17a9281f0370cc21af"
85
+ "gitHead": "dde97e04554c3f37aab76ac0c307ba9bcd0673a1"
86
86
  }