wallet-ux is a tiny, zero-dependency TypeScript library that normalizes user-facing wallet behavior across all EIP-1193 providers.
It gives developers a consistent set of UX states like:
connectingconnectedwaitingForSignaturependingTransactionuserRejectedtransactionSuccesstransactionErrorswitchingNetworkdisconnectederror
Something no existing library (wagmi, viem, ethers.js, web3.js) provides.
- ⚡ Universal UX state machine for all wallets
- 🔌 Works with MetaMask, Coinbase, Rabby, Frame, WalletConnect, Brave, OKX
- 🧩 Zero dependencies
- 🟦 Full TypeScript support
- 🌍 Framework-agnostic (React/Vue/Svelte wrappers optional)
- 📦 Lightweight (< 5 KB)
- 🔁 Consistent behavior across all wallets
npm install wallet-uximport { createWalletUX } from 'wallet-ux';
const wallet = createWalletUX({
provider: window.ethereum,
});
wallet.onStateChange(state => {
console.log('UX State:', state);
});
await wallet.connect();
await wallet.sendTransaction({
to: '0x...',
value: '0x1',
});idle
connecting
connected
waitingForSignature
waitingForTransaction
pendingTransaction
transactionSuccess
transactionError
switchingNetwork
userRejected
error
disconnected
These states eliminate hundreds of lines of custom wallet-handling logic.
Returns:
{
getState(): WalletUXState;
onStateChange(cb: (state) => void): void;
connect(): Promise<string>;
sendTransaction(tx): Promise<any>;
switchNetwork(chainId: number): Promise<void>;
reset(): void;
}Install:
npm install wallet-ux-reactUsage:
const { state, connect } = useWalletUX(window.ethereum);See the /examples folder in the repo:
basic.js– minimal integration example- More framework examples coming soon
PRs are welcome!
If this project helps you, please ⭐ star the repo — it helps visibility and adoption.
MIT License
© 2025