Skip to Content
butr
API reference

@usebutr/walletconnect

createWalletConnectAdapters, the namespaces it pairs, and the WalletConnect signer.

WalletConnect v2 for EVM, Solana, Sui and Bitcoin mobile wallets. Requires the peer dependency @walletconnect/universal-provider, imported on first use unless you pass universalProvider.

Factory

createWalletConnectAdapters(options): Promise<Array<WalletAdapter>>

One pairing, one adapter per requested namespace. The adapters are un-paired until the user connects one; hand them to the manager with fromAdapters:

import type { WalletManagerConfig } from "@usebutr/core";
import { fromAdapters } from "@usebutr/core";
import { autoDiscovery } from "@usebutr/wallets";
import { createWalletConnectAdapters } from "@usebutr/walletconnect";

const config: WalletManagerConfig = {
  sources: [
    autoDiscovery(),
    fromAdapters(
      createWalletConnectAdapters({
        metadata: { name: "My dapp", url: "https://my-dapp.example" },
        namespaces: { evm: ["eip155:1", "eip155:137"], svm: [] },
        onPairingUri: showQr,
        projectId: "<your Reown project id>",
      }),
    ),
  ],
};

With more than one namespace each adapter's id carries the platform (walletconnect-evm); with one, it stays options.id ?? "walletconnect". Every adapter is named options.name ?? "WalletConnect" and shares one walletKey. The promise rejects for an unknown namespace key or an empty namespaces.

The pairing requires one namespace and marks the rest optional. The required one is the first selected platform in CHAIN_PLATFORMS order (evm, svm, sui, bitcoin), not the first key you write.

WalletConnectOptions

FieldTypeNotes
projectIdstringRequired. From Reown Cloud.
namespacesPartial<Record<ChainPlatform, ReadonlyArray<string>>>Required. CAIP-2 chains per platform (SVM_CHAINS ids work for Solana). Omit a key to skip it; an empty array means the platform's mainnet (DEFAULT_CHAINS).
metadataWalletConnectMetadata{ description?; icons?; name?; url? }. Some wallets refuse to pair without name and url.
onPairingUri(uri: string) => voidRender the QR code or deep link; butr ships no QR renderer.
idstringDefault "walletconnect".
namestringDefault "WalletConnect".
iconstringDefault WALLETCONNECT_DEFAULT_ICON.
universalProviderUniversalProviderConstructorThe UniversalProvider class, for an app that already imports it. Default: a dynamic import of @walletconnect/universal-provider.

Namespaces

The factory pairs these namespaces. Polkadot has none yet.

PlatformCAIP-2 namespaceDefault chainMethodsEvents
evmeip155eip155:1eth_sendTransaction, eth_accounts, eth_chainId, eth_getBalance, eth_getTransactionReceipt, personal_sign, wallet_switchEthereumChainaccountsChanged, chainChanged, disconnect
svmsolanasolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpsolana_signMessage, solana_signTransaction, solana_signAndSendTransactionaccountsChanged, chainChanged, disconnect
suisuisui:mainnetsui_signTransaction, sui_signAndExecuteTransaction, sui_signPersonalMessageaccountsChanged, chainChanged, disconnect
bitcoinbip122bip122:000000000019d6689c085ae165831e93signMessage, signPsbt, sendTransfer, getAccountAddressesbip122_addressesChanged

The default chain is the platform's entry in DEFAULT_CHAINS, used when its namespaces array is empty. Solana sessions name clusters by genesis hash, so the factory maps each SVM_CHAINS id to the genesis-hash id its entry lists first in aliases; pass SVM_CHAINS ids as on any other transport.

Signers

The EVM adapter resolves { kind: "eip1193", provider }: an EIP-1193 shim over the session's eip155 side. Importing the package registers the walletconnect kind the other namespaces resolve. WalletSignerOf<"walletconnect"> from @usebutr/core is { chainId: string; kind: "walletconnect"; provider: UniversalProviderLike }, where chainId is the session's id for the adapter's current chain.

Pass chainId as provider.request's second argument. Without it, UniversalProvider routes the call to the session's first namespace, so a Solana request in an EVM + Solana session would reach the EVM wallet.

Constants

WALLETCONNECT_DEFAULT_ICON: the default adapter icon.

Types

WalletConnectOptions, WalletConnectMetadata, UniversalProviderLike, UniversalProviderConstructor.

See the WalletConnect connector for what each namespace defines and how it routes chains.

Source: packages/walletconnect/src/index.ts.