@exodus/assets-feature 9.3.0 → 9.3.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,18 @@
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
+ ## [9.3.2](https://github.com/ExodusMovement/exodus/compare/@exodus/assets-feature@9.3.1...@exodus/assets-feature@9.3.2) (2026-09-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **assets:** sort testnet variants last in dynamic combined assets ([#44481](https://github.com/ExodusMovement/exodus/issues/44481)) ([d2726b9](https://github.com/ExodusMovement/exodus/commit/d2726b9dc3cba1d440ce0f34d50d26c76848034b))
11
+
12
+ ## [9.3.1](https://github.com/ExodusMovement/exodus/compare/@exodus/assets-feature@9.3.0...@exodus/assets-feature@9.3.1) (2026-08-26)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **assets:** accumulate changes in load() before single flush ([#44228](https://github.com/ExodusMovement/exodus/issues/44228)) ([401680e](https://github.com/ExodusMovement/exodus/commit/401680ef721d736a349d54e89b044ec54a469b0c))
17
+
6
18
  ## [9.3.0](https://github.com/ExodusMovement/exodus/compare/@exodus/assets-feature@9.2.6...@exodus/assets-feature@9.3.0) (2026-08-25)
7
19
 
8
20
  ### Features
@@ -204,6 +204,9 @@ export class AssetsModule {
204
204
  getBaseAssetNames = () => this.#getAssetNamesBy((asset) => asset.baseAsset.name === asset.name)
205
205
 
206
206
  load = once(async () => {
207
+ const allAdded = []
208
+ const allUpdated = []
209
+
207
210
  try {
208
211
  const storedTokens = await this.#readCustomTokens()
209
212
 
@@ -218,14 +221,23 @@ export class AssetsModule {
218
221
  // 3. both of the above from a network that has feature flag customTokens === false
219
222
  // It is OK to add all of these to the assets registry
220
223
  const { added, updated } = this.#handleFetchedTokens(Object.values(tokens))
221
- this.#flushChanges({ added, updated })
224
+ allAdded.push(...added)
225
+ allUpdated.push(...updated)
222
226
  } catch (e) {
223
227
  this.#logger.error('error reading custom tokens from storage: ' + e.message, e)
224
- } finally {
225
- if (this.#useDynamicCombinedAssets) {
226
- this.#createDynamicCombinedAssets()
228
+ }
229
+
230
+ if (this.#useDynamicCombinedAssets) {
231
+ try {
232
+ const { added, updated } = this.#createDynamicCombinedAssets()
233
+ allAdded.push(...added)
234
+ allUpdated.push(...updated)
235
+ } catch (e) {
236
+ this.#logger.error('error creating dynamic combined assets: ' + e.message, e)
227
237
  }
228
238
  }
239
+
240
+ this.#flushChanges({ added: allAdded, updated: allUpdated })
229
241
  })
230
242
 
231
243
  #createDynamicCombinedAssets = () => {
@@ -245,8 +257,10 @@ export class AssetsModule {
245
257
  const newCombinedAssets = newlyCreatedNames.map((name) => this.getAsset(name)).filter(Boolean)
246
258
  const childAssetNames = new Set(newCombinedAssets.flatMap((c) => c.combinedAssetNames))
247
259
  const childAssets = [...childAssetNames].map((name) => this.getAsset(name)).filter(Boolean)
248
- this.#flushChanges({ added: newCombinedAssets, updated: childAssets })
260
+ return { added: newCombinedAssets, updated: childAssets }
249
261
  }
262
+
263
+ return { added: [], updated: [] }
250
264
  }
251
265
 
252
266
  // Custom tokens API
@@ -22,10 +22,10 @@ const groupAssetsByTickerAndName = (assets) => {
22
22
  return groups
23
23
  }
24
24
 
25
- const selectPrimaryAsset = (assets) => {
26
- const sorted = [...assets].sort((a, b) => a.name.localeCompare(b.name))
27
- return sorted[0]
28
- }
25
+ const isTestnetVariant = (asset) => asset.baseAsset?.api?.features?.isTestnet === true
26
+
27
+ const byPrimaryPreference = (a, b) =>
28
+ Number(isTestnetVariant(a)) - Number(isTestnetVariant(b)) || a.name.localeCompare(b.name)
29
29
 
30
30
  const resolveDecimals = (assets) => {
31
31
  const decimals = assets.map((a) => a.currency?.defaultUnit?.power ?? 8)
@@ -33,8 +33,8 @@ const resolveDecimals = (assets) => {
33
33
  }
34
34
 
35
35
  const createDynamicCombinedAssetDefinition = (assetGroup) => {
36
- const primary = selectPrimaryAsset(assetGroup)
37
- const sortedAssets = [...assetGroup].sort((a, b) => a.name.localeCompare(b.name))
36
+ const sortedAssets = [...assetGroup].sort(byPrimaryPreference)
37
+ const [primary] = sortedAssets
38
38
 
39
39
  const normalizedTicker = normalizeForName(primary.displayTicker)
40
40
  const normalizedDisplayName = normalizeForName(primary.displayName)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/assets-feature",
3
- "version": "9.3.0",
3
+ "version": "9.3.2",
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",
@@ -52,7 +52,7 @@
52
52
  "reselect": "^3.0.1"
53
53
  },
54
54
  "devDependencies": {
55
- "@exodus/available-assets": "^8.11.1",
55
+ "@exodus/available-assets": "^8.11.2",
56
56
  "@exodus/bip32": "^4.3.0",
57
57
  "@exodus/bip39": "^1.1.0",
58
58
  "@exodus/bip44-constants": "^195.0.2",
@@ -84,5 +84,5 @@
84
84
  "access": "public",
85
85
  "provenance": false
86
86
  },
87
- "gitHead": "d98bbb7e2796db99847671fe1559b916ca23073d"
87
+ "gitHead": "b8b267e27a2516dfc57d737b82aa361da652d0c1"
88
88
  }