@usebutr/walletconnect
createWalletConnectAdapter(s), namespace builders, per-platform capabilities.
WalletConnect v2 transport for EVM, SVM, Sui, and Bitcoin mobile wallets.
Requires the optional peer dependency @walletconnect/universal-provider
(dynamically imported).
Factory
createWalletConnectAdapters(options): Promise<Array<WalletAdapter>>
Single factory for all namespaces. Returns one adapter per requested namespace; all share the same paired session.
const wcs = await createWalletConnectAdapters({
projectId,
namespaces: {
evm: ["eip155:1"],
svm: ["solana:mainnet"],
sui: ["sui:mainnet"],
bitcoin: ["bip122:000000000019d6689c085ae165831e93"],
},
onPairingUri: (uri) => setQrUri(uri),
});When more than one namespace is requested, each adapter's id is suffixed
with the platform (walletconnect-evm, walletconnect-svm, …). With a
single namespace, the id stays the base options.id ?? "walletconnect".
WalletConnectOptions
| Field | Type | Default |
|---|---|---|
projectId | string (required) | — |
namespaces | Partial<Record<ChainPlatform, ReadonlyArray<string>>> | — |
metadata | WalletConnectMetadata | — |
onPairingUri | (uri: string) => void | — |
id | string | "walletconnect" |
name | string | "WalletConnect" |
icon | string | WALLETCONNECT_DEFAULT_ICON |
WalletConnectMetadata = { name?; url?; description?; icons? }.
Namespace builders
import {
KNOWN_NAMESPACES,
bitcoinNamespace,
evmNamespace,
solanaNamespace,
suiNamespace,
} from "@usebutr/walletconnect";KNOWN_NAMESPACES: Readonly<Partial<Record<ChainPlatform, WalletConnectNamespaceBuilder>>> is
the dispatch table createWalletConnectAdapters walks. Today: evm, svm,
sui, bitcoin all ship.
WalletConnectNamespaceBuilder exposes caipNamespace, methods, events,
defaultChains, and buildAdapter(...). Compose your own factory by importing
the builders directly.
Constants
WALLETCONNECT_DEFAULT_ICON: string— default SVG data URI.WALLETCONNECT_CAPABILITIES: WalletCapabilities— EVM (used by the single-platform factory).WALLETCONNECT_SVM_CAPABILITIES: WalletCapabilities— Solana.WALLETCONNECT_SUI_CAPABILITIES: WalletCapabilities— Sui.WALLETCONNECT_BITCOIN_CAPABILITIES: WalletCapabilities— Bitcoin.
Types
WalletConnectOptions, WalletConnectMetadata,
WalletConnectNamespaceBuilder, UniversalProviderLike,
UniversalProviderConstructor, and a re-exported Account.
See the WalletConnect connector guide for the full setup, QR rendering, per-platform capabilities, and caveats.
Source: packages/walletconnect/src/index.ts.