KyberSwap is a decentralized trading platform whose DEX aggregator has facilitated more than US$150B in transactions for over 5M users. When its team consolidated the frontend onto Wagmi v3 and Viem, they replaced hand-rolled MetaMask detection code with the official metaMask() connector from MetaMask Connect. This case study covers why KyberSwap made the move, what changed on mobile web, and how the Connect integration sits next to KyberSwap's separate role supplying swap rates to MetaMask users.
KyberSwap's job is the best rate on every trade
KyberSwap's DEX Aggregator is a decentralized trading solution built for the best rates and reliable execution on every trade. It runs on Smart Settlement, a smart routing algorithm built to maximize output and minimize slippage by reaching deep liquidity across chains. Around that core sit limit orders, crosschain swaps across 23 networks, and Kyber Earn for yield opportunities.
A platform built around execution quality has a plain requirement for its front door: connecting a wallet should take no thought.
Hand-rolled wallet code is a maintenance bill
KyberSwap's previous setup combined Wagmi v2 with ethers.js and an ad-hoc injected-connector layer, including custom code to detect and connect to MetaMask. As part of moving to Wagmi v3 and Viem, the team chose to drop that code in favor of MetaMask Connect's official connector.
Three things drove the decision. One connector now covers both the browser extension on desktop and the deep-link and relay flow on mobile web. There is less custom wallet-detection code to maintain. And staying on MetaMask's supported path keeps KyberSwap aligned as EIP-6963 and the MetaMask Wallet Protocol (MWP) become the standard way wallets and dapps find each other.
Before | With MetaMask Connect |
Wagmi v2, ethers.js, and an ad-hoc injected-connector setup | Wagmi v3 and Viem with the official metaMask() connector |
Hand-rolled MetaMask detection and connection code to maintain | Detection and connection handled by the connector |
Mobile web leaned on a WalletConnect QR | Native deep-link connect to the MetaMask app through the MWP relay |
Custom code to track wallet-discovery standards | Alignment with EIP-6963 and MWP through MetaMask's supported path |
Getting the mobile handoff right
On mobile web, a QR code is an awkward path: the user is already on their phone. MetaMask Connect gives KyberSwap a deep-link connect flow that opens the MetaMask app through the MWP relay, so a trader on a phone connects without scanning anything.
KyberSwap put particular effort into the iOS handoff. The goal was that users land directly on the MetaMask approval screen, with no extra step between tapping connect and approving it. The result is the same connection experience whether a trader arrives on the desktop extension or the mobile app.
The stack
Layer | Components |
Trading | KyberSwap DEX Aggregator, Smart Settlement, Limit Orders, cross-chain swaps (23 networks), Kyber Earn |
Frontend | Wagmi v3, Viem |
Wallet connection | MetaMask Connect (connect-evm), metaMask() connector |
Discovery and transport | EIP-6963, MetaMask Wallet Protocol relay |
Wallet | MetaMask browser extension (desktop), MetaMask mobile app |
Impact so far
Since adopting MetaMask Connect, Kyberswap reports connecting has been reliable for users, the rollout was smooth from the first day, and no complaints or issues have come back.
The user-facing result, in KyberSwap's words, is that connecting and trading now feel like one step. A trader connects through MetaMask and goes straight into a swap at the best rate, with nothing in between. MetaMask Connect handles the front door of that flow, and Smart Settlement handles the rest.
Two integrations, one relationship
The Connect integration is one half of KyberSwap's relationship with MetaMask. The other half runs in the opposite direction: the KyberSwap Aggregator API supplies swap rates and execution across chains to MetaMask users. MetaMask Connect brings MetaMask users into KyberSwap, and the Aggregator API brings KyberSwap's routing into MetaMask.
“MetaMask has been a valued partner on two fronts. MetaMask Connect simplified how traders connect to KyberSwap, giving them a reliable, consistent experience whether they're on the extension or the mobile app. At the same time, the KyberSwap Aggregator API delivers MetaMask users the best available swap rates and execution across chains. It's a partnership built on the same principle we care about most: making DeFi trading simpler, smoother, and more efficient for everyone.” — Ken Tran, Business Development Manager, KyberSwap
KyberSwap's advice for builders
Lean on the official documentation. It keeps your integration aligned with the standard and makes the transition cleaner than working from older examples or custom wiring.
Migrate wallet connection as part of a wider stack cleanup. KyberSwap replaced its MetaMask code while moving to Wagmi v3 and Viem, so the connector change was one piece of a planned consolidation, not a separate project.
Test the mobile handoff end to end. The detail that matters to users is where they land after tapping connect. KyberSwap checked that iOS users reach the MetaMask approval screen directly.
Weigh it against your own architecture. The migration went smoothly for KyberSwap's setup, but every team's stack is different, and the right call depends on your product's needs.
Build with MetaMask Connect: one integration that works for every user, however they choose to connect.