Skip to main content

WalletConnect

WalletConnect v2 (via Reown WalletKit) lets the boilerplate wallet connect to any compatible dApp. The user scans a QR code from within the app, approves the session, and can then sign transactions and messages requested by the dApp — all backed by MPC signing.

Initialization

WalletKit is initialized in src/hooks/wallet-connect/useInitializeWalletKit.ts. It waits until the EVM address is available before creating the WalletKit instance; Solana request handling is wired separately through the Solana WalletConnect session hook.

// Simplified from src/hooks/wallet-connect/useInitializeWalletKit.ts
useEffect(() => {
if (!evmAddress) return;
createWalletKit().then(() => setInitialized(true));
}, [evmAddress]);

src/libs/wallet-connect.ts handles the WalletKit instantiation, using MMKV for fast persistent storage of sessions.

Event routing

Once initialized, src/hooks/wallet-connect/useWalletKitEventsManager.ts subscribes to WalletKit events and routes them to the appropriate screen:

Signing flow

When a dApp sends a signing request, the session-request screen handles the method and calls into the MPC layer:

JSON-RPC methodWhat happens
personal_signaccount.signMessage(message) — the ECDSA session signs the full message with signWithHash
eth_sendTransactionaccount.signTransaction(tx) → serialize → signWithHash on the ECDSA session → broadcast
eth_signTypedData_v4account.signTypedData(params) — EIP-712 hash via hashTypedData → ECDSA session
solana_signMessage / solana_signTransactionthe EdDSA session signs the message or transaction bytes

For EVM requests, createSilentShardAccount from src/libs/chains/viem.ts provides the account, and the actual cryptographic work is done by the MPC session — no private key is ever assembled.

Policy evaluation

When the active deployment has policy evaluation enabled, the app advertises a smaller method list. src/utils/wallet-connect.ts drops the methods whose payload the policy service cannot evaluate:

NamespaceDropped with policy on
eip155eth_signTypedData, eth_signTypedData_v3, eth_signTypedData_v4
solanasolana_signMessage

A dApp that requests one of these anyway gets a JSON-RPC error back, and the app shows a "Request rejected" toast. Nothing reaches the signing screen.

The two namespaces are dropped for different reasons — see Policy Engine.

To test WalletConnect:

  1. Open the Reown AppKit lab — a WalletConnect v2 test playground.
  2. Choose WalletConnect as the connection method.
  3. In the boilerplate app, tap the QR scanner icon and scan the pairing QR code.
  4. Approve the session proposal.
  5. Trigger a transaction or signature in the lab — the signing request will appear in the app.