@exodus/assets-feature

中文文档
9.7.1发布于 2026/11/10MITTypeScriptES Module近 30 天下载 1.3万

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.

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Play with it
  4. API Side
  5. UI Side

@exodus/assets-feature

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. Added tokens persist across restarts.

Install

pnpm add @exodus/assets-feature

Usage

@exodus/assets-feature is bundled with @exodus/headless. It injects the assetsAtom into the IOC, which you can then reference in your feature's dependencies to get all/any particular assets.

Example:

const myModule = {
  id: 'myModule',
  type: 'module,
  factory: ({ assetsAtom }) => {
    // get all assets known at this moment
    const { value: assets } = await assetsAtom.get()
    assetsAtom.observe(({ value }) => {
      // do something with updated assets
    })
  },
  dependencies: ['assetsAtom']
}

Play with it

  1. Open the playground https://exodus-hydra.pages.dev/features/assets
  2. Run await exodus.assets.getAsset('bitcoin') in the Dev Tools Console.
  3. Run await exodus.assets.searchTokens({ lifecycleStatus: ['c', 'v'], baseAssetName: 'ethereum' }) in the Dev Tools Console.
  4. Run await exodus.assets.addTokens({ assetIds: ['0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6'], baseAssetName: 'ethereum', allowedStatusList: ['c', 'v'] }) in the Dev Tools Console to add the Polygon Ecosystem Token token on the ethereum chain (not financial advice).

See api/index.d.ts for more details on the API and token validation/curation status.

API Side

assetsModule.dynamicCombinedAssetOverrides maps a token's asset name to the asset whose name and ticker should identify its dynamic combined group. For example, { cbbtc_basemainnet_58df8ab4: 'bitcoin' } combines Base cbBTC with Bitcoin while preserving cbBTC's metadata and transaction identity. The target is the primary member; both assets must be loaded and eligible for dynamic grouping. Until the target is available and eligible, the token remains available individually and does not fall back to name/ticker grouping. Static grouping is unchanged.

See using the sdk for more details on how features plug into the SDK and the API interface in the type declaration.

UI Side

See using the sdk for more details on basic UI-side setup.

import selectors from '~/ui/flux/selectors'

const MyComponent = () => {
  const bitcoin = useSelector(selectors.assets.createAssetByNameSelector('bitcoin'))
  const tx = await bitcoin.api.signTx({
    // ...,
  })
}

版本与发布记录

@exodus/assets-feature 共发布 109 个版本,首次发布于 2023/08/18;过去 12 个月发布了 22 个版本。

版本发布日期距今
9.7.1latest2026/11/103 天前
9.7.02026/11/067 天前
9.6.02026/10/2916 天前
9.5.02026/10/121 个月前
9.4.02026/10/081 个月前
9.3.32026/09/112 个月前

关于 @exodus/assets-feature 的常见问题

@exodus/assets-feature 是什么?

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.

如何安装 @exodus/assets-feature?

在项目目录运行 npm install @exodus/assets-feature,或使用 pnpm add / yarn add / bun add。

@exodus/assets-feature 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@exodus/assets-feature 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@exodus/assets-feature 可以商用吗?

@exodus/assets-feature 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exodus/assets-feature 的下载量有多少?

根据 npm 官方下载统计,@exodus/assets-feature 在 2026/10/14 – 2026/11/12 这 30 天内被下载 12,551 次,日均约 418 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exodus/assets-feature 还在维护吗?

最新版本 9.7.1 发布于 2026/11/10(3 天前);至今共发布 109 个版本,其中过去 12 个月发布了 22 个;首次发布于 2023/08/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。