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 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 hooks/wallet-connect/useInitializeWalletKit.ts
useEffect(() => {
if (!evmAddress) return;
createWalletKit().then(() => setInitialized(true));
}, [evmAddress]);
libs/wallet-connect.ts handles the WalletKit instantiation, using MMKV for fast persistent storage of sessions.
Event routing
Once initialized, 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 method | What happens |
|---|---|
personal_sign | account.signMessage(message) — hashes via hashMessage, signs via ECDSA session |
eth_sendTransaction | account.signTransaction(tx) → serialize → keccak256 → ECDSA session → broadcast |
eth_signTypedData_v4 | account.signTypedData(params) — EIP-712 hash via hashTypedData → ECDSA session |
For EVM requests, createSilentShardAccount from libs/chains/viem.ts provides the account, and the actual cryptographic work is done by the MPC session — no private key is ever assembled.
To test WalletConnect:
- Open the Reown AppKit lab — a WalletConnect v2 test playground.
- Choose WalletConnect as the connection method.
- In the boilerplate app, tap the QR scanner icon and scan the pairing QR code.
- Approve the session proposal.
- Trigger a transaction or signature in the lab — the signing request will appear in the app.