@exodus/assets-feature 8.4.0 → 8.6.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 +12 -0
- package/module/assets-module.js +37 -15
- package/package.json +5 -5
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
|
+
## [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
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- feat: batch addRemoteTokens requests by 50 (#13858)
|
|
11
|
+
|
|
12
|
+
## [8.5.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@8.4.0...@exodus/assets-feature@8.5.0) (2025-09-18)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- feat: support passing lifecycleStatus in addRemoteTokens (#13844)
|
|
17
|
+
|
|
6
18
|
## [8.4.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/assets-feature@8.3.0...@exodus/assets-feature@8.4.0) (2025-08-18)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/module/assets-module.js
CHANGED
|
@@ -380,8 +380,12 @@ export class AssetsModule {
|
|
|
380
380
|
return [...added, ...updated]
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
addRemoteTokens = async ({ tokenNames }) => {
|
|
383
|
+
addRemoteTokens = async ({ tokenNames, allowedStatusList }) => {
|
|
384
384
|
this.#assertCustomTokensStorageSupported()
|
|
385
|
+
assert(
|
|
386
|
+
!allowedStatusList || Array.isArray(allowedStatusList),
|
|
387
|
+
'addRemoteTokens: expected `allowedStatusList` to be an array'
|
|
388
|
+
)
|
|
385
389
|
|
|
386
390
|
const assets = this.getAssets()
|
|
387
391
|
const [tokenNamesToUpdate, tokenNamesToFetch] = partition(
|
|
@@ -389,23 +393,25 @@ export class AssetsModule {
|
|
|
389
393
|
(tokenName) => !!assets[tokenName]
|
|
390
394
|
)
|
|
391
395
|
|
|
392
|
-
const
|
|
393
|
-
tokenNamesToFetch.length > 0
|
|
394
|
-
? await this.#fetch('tokens', { tokenNames: tokenNamesToFetch }, 'tokens')
|
|
395
|
-
: []
|
|
396
|
+
const tokens = tokenNamesToUpdate.map((tokenName) => assets[tokenName])
|
|
396
397
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
if (tokenNamesToFetch.length > 0) {
|
|
399
|
+
const fetchedTokens = await this.#fetchTokensByNames({
|
|
400
|
+
tokenNames: tokenNamesToFetch,
|
|
401
|
+
allowedStatusList,
|
|
402
|
+
})
|
|
403
|
+
const validTokens = fetchedTokens.filter(this.#isValidCustomToken).map(normalizeToken)
|
|
401
404
|
|
|
402
|
-
|
|
405
|
+
if (validTokens && validTokens.length !== fetchedTokens.length) {
|
|
406
|
+
this.#logger.warn('Invalid Custom Token schema')
|
|
407
|
+
}
|
|
403
408
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
+
validTokens.forEach((token) => {
|
|
410
|
+
// replace fetched CT with existing built-in token if found by assetId
|
|
411
|
+
const asset = token.assetId && this.#getAssetFromAssetId(token.assetId, token.baseAssetName)
|
|
412
|
+
tokens.push(asset || token)
|
|
413
|
+
})
|
|
414
|
+
}
|
|
409
415
|
|
|
410
416
|
if (isEmpty(tokens)) return
|
|
411
417
|
|
|
@@ -493,6 +499,22 @@ export class AssetsModule {
|
|
|
493
499
|
this.getAsset(assetName).api?.hasFeature?.('customTokens')
|
|
494
500
|
)
|
|
495
501
|
|
|
502
|
+
#fetchTokensByNames = async ({ tokenNames, allowedStatusList }) => {
|
|
503
|
+
const pages = chunk(tokenNames, CTR_TOKENS_LIMIT)
|
|
504
|
+
|
|
505
|
+
const pagePromises = pages.map(async (page) => {
|
|
506
|
+
const body = {
|
|
507
|
+
tokenNames: page,
|
|
508
|
+
...(allowedStatusList && { lifecycleStatus: allowedStatusList }),
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return this.#fetch('tokens', body, 'tokens')
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
const pagesResults = await Promise.all(pagePromises)
|
|
515
|
+
return pagesResults.flat()
|
|
516
|
+
}
|
|
517
|
+
|
|
496
518
|
#fetchUpdates = async (assetVersions) => {
|
|
497
519
|
const updatedTokens = await this.#fetch('updates', assetVersions, 'tokens')
|
|
498
520
|
const validatedTokens = updatedTokens.filter(this.#isValidCustomToken).map(normalizeToken)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/assets-feature",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.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",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"reselect": "^3.0.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@exodus/available-assets": "^8.
|
|
54
|
+
"@exodus/available-assets": "^8.8.0",
|
|
55
55
|
"@exodus/bip39": "^1.0.3",
|
|
56
56
|
"@exodus/bip44-constants": "^195.0.0",
|
|
57
57
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
58
58
|
"@exodus/bitcoin-plugin": "^1.29.1",
|
|
59
59
|
"@exodus/bitcoinregtest-plugin": "^1.11.0",
|
|
60
60
|
"@exodus/bitcointestnet-plugin": "^1.13.1",
|
|
61
|
-
"@exodus/blockchain-metadata": "^
|
|
61
|
+
"@exodus/blockchain-metadata": "^16.0.0",
|
|
62
62
|
"@exodus/cardano-lib": "^3.4.1",
|
|
63
63
|
"@exodus/combined-assets-meta": "^3.0.0",
|
|
64
64
|
"@exodus/cosmos-plugin": "^1.3.3",
|
|
@@ -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": "^
|
|
76
|
+
"@exodus/wallet-accounts": "^19.1.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": "
|
|
85
|
+
"gitHead": "bf7e26ead6a6562139716a17a9281f0370cc21af"
|
|
86
86
|
}
|