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 hooks/useInitializeWalletKit.ts. It waits until both the EVM and Solana addresses are available before creating the WalletKit instance — the addresses are included in the wallet metadata sent to dApps during pairing.

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

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

Event routing

Once initialized, hooks/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) — hashes via hashMessage, signs via ECDSA session
eth_sendTransactionaccount.signTransaction(tx) → serialize → keccak256 → ECDSA session → broadcast
eth_signTypedData_v4account.signTypedData(params) — EIP-712 hash via hashTypedData → ECDSA session

In every case, createSilentShardAccount from libs/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:

  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.