AI agents: the machine-readable documentation index for this site is at https://docs.ckbccc.com/llms.txt. Append ".md" to any documentation page URL to fetch its canonical Markdown source, which is preferred over rendered HTML for retrieval, indexing, question answering, and code generation.

Product-specific agent operating guidance (read before generating CKB/CCC code): https://docs.ckbccc.com/skill.md

钱包集成

通过统一的 Signer 接口连接任意钱包,如 JoyID、MetaMask、OKX 等。

Edit on GitHub

CCC 通过专用的 Signer 包支持多种钱包生态。每个包都实现了统一的 Signer 接口,因此无论用户选择哪个钱包,应用代码都保持不变。

以下所有钱包包已包含在 @ckb-ccc/ccc@ckb-ccc/connector-react 中。仅当你需要自定义集成时,才需要单独安装。

钱包Provider 检测方式
@ckb-ccc/joy-idCKB / BTC / EVM / NostrJoyIDWebAuthn / iframe
@ckb-ccc/eip6963EVMMetaMask、Rabby、OKX EVM 及所有 EIP-6963 钱包eip6963:announceProvider 事件
@ckb-ccc/nip07Nostrnos2x、Alby 及所有 NIP-07 扩展window.nostr
@ckb-ccc/utxo-globalCKB / BTC / DOGEUTXO Globalwindow.utxoGlobal
@ckb-ccc/reiCKBREI Walletwindow.rei.ckb
@ckb-ccc/okxBTC / NostrOKX Walletwindow.okxwallet
@ckb-ccc/uni-satBTCUniSatwindow.unisat
@ckb-ccc/xverseBTCXverse 及所有 SATS Connect 钱包window.btc_providers

集成约定

每个钱包包都遵循相同的模式:

  1. Factory 函数——如 getOKXSigners(client)——返回 SignerInfo[] 或单个 Signer
  2. Provider 检测——创建 Signer 前检查浏览器注入的对象是否存在。
  3. 优雅降级——如果钱包未安装时返回空数组(或 undefined)。
  4. onReplaced() 监听——用户在钱包 UI 中切换账户时通知应用。

因此,SignersController 可以统一处理所有钱包,应用代码无需做任何特殊适配。

Last updated on

On this page