@exodus/assets-feature 9.3.2 → 9.4.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/client/asset-client-interface.js +28 -1
- package/client/index.js +1 -0
- package/index.d.ts +13 -1
- package/index.js +2 -0
- package/module/dynamic-combined-assets.js +7 -5
- package/package.json +8 -10
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.4.0](https://github.com/ExodusMovement/exodus/compare/@exodus/assets-feature@9.3.3...@exodus/assets-feature@9.4.0) (2026-10-07)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **assets-feature:** add getRuntimeConfig to asset client interface ([#46606](https://github.com/ExodusMovement/exodus/issues/46606)) ([d4e0969](https://github.com/ExodusMovement/exodus/commit/d4e096901d753541928a9e6e8331a25a3765d375))
|
|
11
|
+
|
|
12
|
+
## [9.3.3](https://github.com/ExodusMovement/exodus/compare/@exodus/assets-feature@9.3.2...@exodus/assets-feature@9.3.3) (2026-09-11)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **assets-feature:** exclude testnet assets from dynamic combined assets ([#44957](https://github.com/ExodusMovement/exodus/issues/44957)) ([00c8d84](https://github.com/ExodusMovement/exodus/commit/00c8d849a93e8c5c9537bddf4d6b8707d6e91a32))
|
|
17
|
+
|
|
6
18
|
## [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
19
|
|
|
8
20
|
### Bug Fixes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { filterAsync, pickBy } from '@exodus/basic-utils'
|
|
1
|
+
import { filterAsync, pickBy, set } from '@exodus/basic-utils'
|
|
2
2
|
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
4
|
class AssetClientInterface {
|
|
@@ -16,6 +16,7 @@ class AssetClientInterface {
|
|
|
16
16
|
#transactionSigner
|
|
17
17
|
#walletAccountsAtom
|
|
18
18
|
#multisigAtom
|
|
19
|
+
#featureFlagAtoms
|
|
19
20
|
#freshlyCreated = false
|
|
20
21
|
|
|
21
22
|
constructor({
|
|
@@ -33,6 +34,7 @@ class AssetClientInterface {
|
|
|
33
34
|
transactionSigner,
|
|
34
35
|
walletAccountsAtom,
|
|
35
36
|
multisigAtom,
|
|
37
|
+
featureFlagAtoms,
|
|
36
38
|
}) {
|
|
37
39
|
this.#addressProvider = addressProvider
|
|
38
40
|
this.#assetsModule = assetsModule
|
|
@@ -48,6 +50,7 @@ class AssetClientInterface {
|
|
|
48
50
|
this.#transactionSigner = transactionSigner
|
|
49
51
|
this.#walletAccountsAtom = walletAccountsAtom
|
|
50
52
|
this.#multisigAtom = multisigAtom
|
|
53
|
+
this.#featureFlagAtoms = featureFlagAtoms
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
setFreshlyCreated = (value) => {
|
|
@@ -210,6 +213,30 @@ class AssetClientInterface {
|
|
|
210
213
|
return out
|
|
211
214
|
}
|
|
212
215
|
|
|
216
|
+
getRuntimeConfig = async ({ assetName }) => {
|
|
217
|
+
const asset = this.#assetsModule.getAsset(assetName)
|
|
218
|
+
assert(asset, `assetName ${assetName} is not supported`)
|
|
219
|
+
const runtimeConfigFlags = this.#config?.runtimeConfigFlags ?? Object.create(null)
|
|
220
|
+
const flagsByPath = {
|
|
221
|
+
...runtimeConfigFlags[asset.baseAsset.name],
|
|
222
|
+
...runtimeConfigFlags[asset.name],
|
|
223
|
+
}
|
|
224
|
+
if (!this.#featureFlagAtoms || Object.keys(flagsByPath).length === 0) return {}
|
|
225
|
+
|
|
226
|
+
const flagValuesByPath = await Promise.all(
|
|
227
|
+
Object.entries(flagsByPath).map(async ([path, flag]) => {
|
|
228
|
+
const featureFlagAtom = this.#featureFlagAtoms[flag]
|
|
229
|
+
assert(featureFlagAtom, `feature flag ${flag} is not registered`)
|
|
230
|
+
const featureFlag = await featureFlagAtom.get()
|
|
231
|
+
return [path, featureFlag?.isOn === true]
|
|
232
|
+
})
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
const runtimeConfig = {}
|
|
236
|
+
for (const [path, isOn] of flagValuesByPath) set(runtimeConfig, path, isOn)
|
|
237
|
+
return runtimeConfig
|
|
238
|
+
}
|
|
239
|
+
|
|
213
240
|
getConfirmationsNumber = async ({ assetName }) => {
|
|
214
241
|
const baseAsset = this.#assetsModule.getAsset(assetName).baseAsset
|
|
215
242
|
return baseAsset.api?.getConfirmationsNumber ? baseAsset.api.getConfirmationsNumber() : 1
|
package/client/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -3,7 +3,19 @@ import type assetsApiDefinition from './api/index.js'
|
|
|
3
3
|
export type { AssetsModule } from './module/assets-module.js'
|
|
4
4
|
export { TokenStatus } from './api/index.js'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export type RuntimeConfigFlags = Record<string, Record<string, string>>
|
|
7
|
+
|
|
8
|
+
export type AssetsConfig = {
|
|
9
|
+
multiAddressMode?: { defaults?: Record<string, boolean> }
|
|
10
|
+
disabledPurposes?: { defaults?: Record<string, number[]> }
|
|
11
|
+
compatibilityModeGapLimits?: Record<string, number>
|
|
12
|
+
compatibilityModeMultiAddressMode?: Record<string, boolean>
|
|
13
|
+
runtimeConfigFlags?: RuntimeConfigFlags
|
|
14
|
+
searchBasedAssetLoaderPlugin?: unknown
|
|
15
|
+
assetsModule?: Record<string, unknown>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const assets: (config?: AssetsConfig) => {
|
|
7
19
|
id: 'assets'
|
|
8
20
|
definitions: [{ definition: typeof assetsApiDefinition }]
|
|
9
21
|
}
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const assets = (config = Object.create(null)) => {
|
|
|
18
18
|
disabledPurposes,
|
|
19
19
|
compatibilityModeGapLimits,
|
|
20
20
|
compatibilityModeMultiAddressMode,
|
|
21
|
+
runtimeConfigFlags,
|
|
21
22
|
searchBasedAssetLoaderPlugin,
|
|
22
23
|
assetsModule,
|
|
23
24
|
} = { ...defaultConfig, ...config }
|
|
@@ -30,6 +31,7 @@ const assets = (config = Object.create(null)) => {
|
|
|
30
31
|
config: {
|
|
31
32
|
compatibilityModeGapLimits,
|
|
32
33
|
compatibilityModeMultiAddressMode,
|
|
34
|
+
runtimeConfigFlags,
|
|
33
35
|
},
|
|
34
36
|
},
|
|
35
37
|
{ definition: assetsPluginDefinition },
|
|
@@ -24,8 +24,7 @@ const groupAssetsByTickerAndName = (assets) => {
|
|
|
24
24
|
|
|
25
25
|
const isTestnetVariant = (asset) => asset.baseAsset?.api?.features?.isTestnet === true
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
Number(isTestnetVariant(a)) - Number(isTestnetVariant(b)) || a.name.localeCompare(b.name)
|
|
27
|
+
const byName = (a, b) => a.name.localeCompare(b.name)
|
|
29
28
|
|
|
30
29
|
const resolveDecimals = (assets) => {
|
|
31
30
|
const decimals = assets.map((a) => a.currency?.defaultUnit?.power ?? 8)
|
|
@@ -33,7 +32,7 @@ const resolveDecimals = (assets) => {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
const createDynamicCombinedAssetDefinition = (assetGroup) => {
|
|
36
|
-
const sortedAssets = [...assetGroup].sort(
|
|
35
|
+
const sortedAssets = [...assetGroup].sort(byName)
|
|
37
36
|
const [primary] = sortedAssets
|
|
38
37
|
|
|
39
38
|
const normalizedTicker = normalizeForName(primary.displayTicker)
|
|
@@ -74,7 +73,9 @@ export const isTrustedAsset = (asset) => {
|
|
|
74
73
|
|
|
75
74
|
export const createDynamicCombinedAssetDefinitions = (assets) => {
|
|
76
75
|
const assetList = Array.isArray(assets) ? assets : Object.values(assets)
|
|
77
|
-
const trustedAssets = assetList.filter(
|
|
76
|
+
const trustedAssets = assetList.filter(
|
|
77
|
+
(asset) => isTrustedAsset(asset) && !isTestnetVariant(asset)
|
|
78
|
+
)
|
|
78
79
|
const groups = groupAssetsByTickerAndName(trustedAssets)
|
|
79
80
|
|
|
80
81
|
const definitions = []
|
|
@@ -103,4 +104,5 @@ export const findDynamicCombinedAssetForToken = (token, existingCombinedAssets)
|
|
|
103
104
|
return null
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
export const shouldTokenJoinCombinedAsset = (token) =>
|
|
107
|
+
export const shouldTokenJoinCombinedAsset = (token) =>
|
|
108
|
+
isTrustedAsset(token) && !isTestnetVariant(token)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/assets-feature",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.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",
|
|
@@ -52,29 +52,27 @@
|
|
|
52
52
|
"reselect": "^3.0.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@exodus/
|
|
56
|
-
"@exodus/bip32": "^4.3.0",
|
|
55
|
+
"@exodus/bip32": "^4.3.1",
|
|
57
56
|
"@exodus/bip39": "^1.1.0",
|
|
58
57
|
"@exodus/bip44-constants": "^195.0.2",
|
|
59
58
|
"@exodus/bitcoin-meta": "^2.0.0",
|
|
60
59
|
"@exodus/bitcoin-plugin": "^2.0.0",
|
|
61
60
|
"@exodus/bitcoinregtest-plugin": "^2.0.0",
|
|
62
61
|
"@exodus/bitcointestnet-plugin": "^2.0.0",
|
|
63
|
-
"@exodus/blockchain-metadata": "^17.2.0",
|
|
64
62
|
"@exodus/cardano-lib": "^4.0.0",
|
|
65
63
|
"@exodus/cosmos-plugin": "^1.3.3",
|
|
66
|
-
"@exodus/ethereum-lib": "^5.
|
|
64
|
+
"@exodus/ethereum-lib": "^5.26.0",
|
|
67
65
|
"@exodus/ethereum-meta": "^2.0.0",
|
|
68
|
-
"@exodus/ethereum-plugin": "^
|
|
66
|
+
"@exodus/ethereum-plugin": "^3.1.1",
|
|
69
67
|
"@exodus/fusion-local": "^2.1.0",
|
|
70
|
-
"@exodus/keychain": "^12.
|
|
68
|
+
"@exodus/keychain": "^12.1.0",
|
|
71
69
|
"@exodus/logger": "^1.2.3",
|
|
72
|
-
"@exodus/models": "^13.3.
|
|
70
|
+
"@exodus/models": "^13.3.2",
|
|
73
71
|
"@exodus/osmosis-plugin": "^1.3.3",
|
|
74
72
|
"@exodus/public-key-provider": "^4.3.1",
|
|
75
73
|
"@exodus/redux-dependency-injection": "^5.0.0",
|
|
76
74
|
"@exodus/storage-memory": "^2.4.0",
|
|
77
|
-
"@exodus/wallet-accounts": "^20.4.
|
|
75
|
+
"@exodus/wallet-accounts": "^20.4.12",
|
|
78
76
|
"@exodus/wild-emitter": "^1.1.2",
|
|
79
77
|
"events": "^3.3.0",
|
|
80
78
|
"msw": "^2.0.0",
|
|
@@ -84,5 +82,5 @@
|
|
|
84
82
|
"access": "public",
|
|
85
83
|
"provenance": false
|
|
86
84
|
},
|
|
87
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "a65e66ff61d27471e199419be8b31806f58c6b1b"
|
|
88
86
|
}
|