@dynamic-labs/wallet-book

中文文档
5.16.0发布于 2026/11/11MITTypeScriptESM + CJS近 30 天下载 37.9万
原始使用文档
文档目录6 节
  1. Updating Wallet Book
  2. Adding First Party Wallet
  3. Adding injected (browser extension) wallets
  4. Updating Wallet Connect Data
  5. Adding overrides to WalletConnect
  6. Compile & Publish

Wallet Book

Updating Wallet Book

Adding First Party Wallet

Simply add an entry to firstPartyWalletsData in packages/wallet-book/src/build/sources/firstParty/index.ts and Compile & Publish

For example:

  argentx: {
    brand: {
      alt: 'Argent Wallet',
      primaryColor: '#FF875B',
      spriteId: 'argentx',
    },
    desktop: {
      chromeId: 'dlcobpjiigpikoobohmabehhmhfoodbb',
      firefoxId: 'argent-x',
    },
    name: 'Argent X',
    injectedConfig: [
      {
        chain: 'EVM',
        extensionLocators:
      }
    ]
  },

Required fields:

  • brand
    • alt
    • primaryColor
    • spriteId - The id used in the iconic svg
    • name

Refer to WalletRecordsSchema for more schema options

Adding injected (browser extension) wallets

Similar to adding first party wallets, we add another key, injectedConfig to the wallet object.

...
injectedConfig: [
  {
    chain: 'EVM',
    extensionLocators: [
      { flag: 'isOkxWallet', value: true },
      { flag: 'isOkexWallet', value: true }
    ],
    windowLocations: ['okxwallet']
  }
],
name: 'OKX'

If you need to override any of the following functions: signMessage, getAddress, getSigner, isInstalledOnBrowser, etc...

  1. Create a file in the respective ethereum/src/injected/ or solana/src/injected/. The basic file should follow this form:
export class <NameOfConnector> extends InjectedWalletBase {
  override name = '<Name Here>';
  override walletConnectorFallback = true; // only specified on evm wallet connectors

  constructor(props: EthereumWalletConnectorOpts) {
    super(props);

    this.wallet = findWalletBookWallet(this.walletBook, this.key);
  }

  // override the methods you need below
  override async getAddress() {
    ...
  }
}
  1. Open fetchInjectedWalletConnectors.ts for the respective network package (etherem/solana/...) and add the new InjectedWalletBase class to injectedWalletOverrides and the key (normalized name) to the filterInjectedWalletKeyOverrides

Things to remember when adding a new wallet

  • If the new wallet is also in walletconnect.json: make sure that the key used in firstParty/index.ts is the same as the value from walletconnect.json as to inherit the properties from that wallet definition.
  • The value(s) in windowLocations map to window.<value from windowLocations>. i.e. okxwallet means window.okxwallet. The values can be a nested path that is dot delimited. If the wallet lives under window.ethereum or window.ethereum.providers, those window locations are imported by default.
  • For every extension locator you add for the new wallet, add the negation [{ flag: 'isOkxWallet', value: false }, ...] to the extensionLocators under the metamask key in firstParty.
  • If the new wallet is wallet connect enabled (exists in walletconnect.json), make sure to add: filterFromWalletConnect: true as a sibling to injectedConfig which will filter the wallet from the wallet connect connectors list and use wallet connect as fallback.

Checklist before submitting the PR:

[ ]: If this change adds a new file to the injected folder, add the wallet key to the walletBookFallbackList in packages/wallet-book/src/build/index.ts

[ ]: If the name is changing in walletbook, make sure that if there is no new file in the injected/ folder, you make sure at least the shortName normalizes down to the wallet key

myawesomenewwallet: {
  ...
  injectedConfig: { ... },
  shortName: 'My Awesome New Wallet', // maps down to the key if you lowercase and remove special characters and spaces
  name: 'Awesome Wallet' // this will be displayed in the wallet list and can be changed as long as the `shortName` normalizes to the key
}

NOTE:

Refer to injectedConfigSchema for the schema options

Updating Wallet Connect Data

Adding overrides to WalletConnect

  • modify packages/wallet-book/src/build/sources/walletConnectOverrides/index.ts
  • Compile & Publish

Compile & Publish

The compiled json is stored in packages/wallet-book/wallet-book.json. When the file is updated and merged to main it will be published to S3 automatically.

Simply, make any changes that you need and:

  1. Clean any cache of the wallet-book logic
npm run nuke
  1. Compile
npx nx compile wallet-book

版本与发布记录

@dynamic-labs/wallet-book 共发布 944 个版本,首次发布于 2023/03/14;过去 12 个月发布了 177 个版本。

版本发布日期距今
5.16.0latest2026/11/112 天前
5.15.12026/11/103 天前
5.15.02026/11/103 天前
4.104.0v4-lts2026/11/0310 天前
5.14.02026/10/3014 天前
4.103.02026/10/2816 天前

其他发布通道:alpha → 4.83.2-alpha.0,rc → 5.0.0-rc.4,v4-lts → 4.104.0。

关于 @dynamic-labs/wallet-book 的常见问题

@dynamic-labs/wallet-book 是什么?

Wallet Book - Updating Wallet Book - Adding First Party Wallet - Adding injected (browser extension) wallets - [If you n

如何安装 @dynamic-labs/wallet-book?

在项目目录运行 npm install @dynamic-labs/wallet-book,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0 <20.0.0)、react-dom(>=18.0.0 <20.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dynamic-labs/wallet-book 支持 TypeScript 吗?

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

@dynamic-labs/wallet-book 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dynamic-labs/wallet-book 可以商用吗?

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

@dynamic-labs/wallet-book 的下载量有多少?

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

@dynamic-labs/wallet-book 还在维护吗?

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