← ALL WORK · CASE 06
WALLET SDK
The wallet layer every chain build used to rewrite — connection, chains, signatures and transactions as one React SDK, built once and hardened by every product since.
CONNECTION STATE MACHINE — EVERY SESSION WALKS THIS PATH
REJECTED OR HUNG → SESSION TORN DOWN → CLEAN RETRY — NO HALF-OPEN STATES
01 — WARP
What had to be true first
A reusable SDK is a contract before it is code. Before any product depended on it we set three rules: one connection state machine as the only source of truth; a connector interface every wallet implements identically, so adding one never touches app code; and strict SSR discipline — no window access before hydration, so Next.js never renders a wallet that isn't there.
02 — WEFT
What we wove through it
Onto that warp we shipped in weekly passes: connectors for injected wallets, WalletConnect and Coinbase Wallet; hooks — useAccount, useChain, useTransaction — all reading one store; chain switching that drops to read-only when the user refuses; session persistence across refreshes; and typed contract calls, so a wrong ABI fails at compile time, not in someone's wallet.
03 — BEAT
How it was pressed tight
Every merge was beaten in: deterministic tests on every state transition, a mock connector that misbehaves on command — rejects, hangs, switches accounts mid-signature — and hydration tests that render every hook server-side first. A regression here ships into every product that depends on it, so releases are semver-strict and a breaking change costs an RFC.
04 — WEAR
Life in production
The SDK now rides in every chain build we start — the wallet layer is a dependency, not a sprint. New products get connection, chains and transactions on day one; wallet-vendor quirks get fixed once, upstream, and every build inherits the patch on its next bump. It began as internal tooling pulled out of client work — now client work starts from it. One thread, through every cloth.
NEXT CASE — 07
ACADEMUN →