@exodus/address-provider

中文文档
12.15.5发布于 2026/10/10MITTypeScriptES Module近 30 天下载 1.2万

Address provider for deriving and tracking used and unused addresses.

原始使用文档
文档目录7 节
  1. Install
  2. Usage
  3. Play with it
  4. API Side
  5. External Wallet Addresses
  6. UI Side
  7. Mocking Addresses

@exodus/address-provider

This module derives addresses for assets from different wallet accounts. Addresses for software wallet accounts are encoded public keys that are derived from the seed using Keychain, whereas hardware wallet accounts use the public keys stored in the public-key-store.

flowchart LR
    A[AddressProvider] --> B[PublicKeyProvider]
    B -->|software| D[Keychain]
    B -->|hardware| E[PublicKeyStore]

Address derivation can be pretty expensive on certain platforms (*cough, mobile*). So this package also includes a simple walletAccount and bip32 path based cache.

Install

pnpm add @exodus/address-provider

Usage

This feature is designed to be used together with @exodus/headless. See using the sdk.

Play with it

  1. Open the playground https://exodus-hydra.pages.dev/features/address-provider
  2. Try out some methods via the UI. These correspond 1:1 with the exodus.addressProvider API.
  3. Run await exodus.addressProvider.getReceiveAddress({ walletAccount: 'exodus_0', assetName: 'bitcoin' }) in the Dev Tools Console.

API Side

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

const address = await exodus.addressProvider.getAddress({
  purpose: 44,
  assetName: 'bitcoin',
  walletAccount: 'exodus_0',
  chainIndex: 0,
  addressIndex: 0,
})

const receiveAddress = await exodus.addressProvider.getReceiveAddress({
  assetName: 'bitcoin',
  walletAccount: 'exodus_0',
})

const unusedReceiveAddress = await exodus.addressProvider.getReceiveAddress({
  assetName: 'bitcoin',
  walletAccount: 'exodus_0',
  multiAddressMode: true,
})

If you're building a feature that requires the wallet's addresses, add a dependency on the addressProvider module, which provides almost the same API as the external exodus.addressProvider API (caveat: the module expects WalletAccount instances, while the API expects WalletAccount names like 'exodus_0').

External Wallet Addresses

For wallet accounts that don't derive addresses from a seed (e.g. smart contract wallets), the address provider resolves addresses from the externalWalletAddressesAtom. Register addresses via the walletAccounts module:

await exodus.walletAccounts.setExternalAddress({
  walletAccount: 'polymarket_0',
  assetName: 'matic',
  address: '0x1234...abcd',
})

// The address provider now returns this address for the external wallet account
const address = await exodus.addressProvider.getReceiveAddress({
  assetName: 'matic',
  walletAccount: 'polymarket_0',
})

// To remove
await exodus.walletAccounts.removeExternalAddress({
  walletAccount: 'polymarket_0',
  assetName: 'matic',
})

This only applies to wallet accounts where isExternal is true. For all other accounts, normal key derivation is used.

UI Side

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

import exodus from '~/ui/exodus'

const MyComponent = () => {
  const { loading, value: receiveAddress } = useAsync(
    exodus.addressProvider.getReceiveAddress({ walletAccount: 'exodus_0', assetName: 'bitcoin' })
  )

  return loading ? <Text>Loading...</Text> : <Text>Your address: {receiveAddress}</Text>
}

Mocking Addresses

Occasionally you may want to simulate another wallet for which you don't have the seed or private keys. You can do this by mocking at the address level here or at the xpub/public key level in public-key-provider

Mock an address by providing all the parameters that would normally be used to derive it:

exodus.debug.addressProvider.mockAddress({
  walletAccount: 'exodus_0',
  assetName: 'ethereum',
  address: '<address>',
  purpose: 44,
  chainIndex: 0,
  addressIndex: 0,
})

Mock multiple addresses by only a subset of the parameters:

exodus.debug.addressProvider.mockAddress({
  walletAccount: 'exodus_0',
  assetName: 'bitcoin',
  purpose: 44,
  address: '<address>',
})

This would result in mocking all change/receive chain addresses with the same address.

To clear all mocked addresses, call exodus.debug.addressProvider.clear().

版本与发布记录

@exodus/address-provider 共发布 101 个版本,首次发布于 2023/06/02;过去 12 个月发布了 9 个版本。

版本发布日期距今
12.15.5latest2026/10/101 个月前
12.15.42026/07/084 个月前
12.15.32026/05/185 个月前
12.15.22026/04/137 个月前
12.15.12026/04/077 个月前
12.15.02026/03/257 个月前

关于 @exodus/address-provider 的常见问题

@exodus/address-provider 是什么?

Address provider for deriving and tracking used and unused addresses.

如何安装 @exodus/address-provider?

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

@exodus/address-provider 支持 TypeScript 吗?

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

@exodus/address-provider 支持 ESM 还是 CommonJS?

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

@exodus/address-provider 可以商用吗?

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

@exodus/address-provider 的下载量有多少?

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

@exodus/address-provider 还在维护吗?

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