React Native theorytheory 0/50 · 0%
Web3 integration · medium

30. WalletConnect and mobile dApp flows

Connecting a mobile wallet to a dApp.

WalletConnect lets a mobile wallet app approve connection/signing requests initiated from a dApp (often on desktop, scanned via QR code, or via deep link when both are mobile).

import { Core } from "@walletconnect/core";
import { Web3Wallet } from "@walletconnect/web3wallet";

async function initWallet(projectId: string) {
  const core = new Core({ projectId });
  const wallet = await Web3Wallet.init({
    core,
    metadata: { name: "MyWallet", description: "", url: "https://example.com", icons: [] },
  });
  return wallet;
}

The wallet app must show a clear approval screen listing the requesting dApp's name, the method (e.g. `eth_sendTransaction`), and the exact parameters before signing — never auto-approve.

Check your understanding

  1. 1. What is WalletConnect used for?

  2. 2. How is a WalletConnect session commonly initiated on desktop-to-mobile?

  3. 3. What should a wallet always show before signing?