When to activate
- Connecting MetaMask/WalletConnect to a dApp frontend
- Implementing EIP-712 typed data signing
- Building transaction flows with gas estimation and confirmation
- Implementing account abstraction (ERC-4337) smart wallets
- Handling multi-chain wallet connections and chain switching
When NOT to use
- For custodial wallet management (exchange wallets)
- For server-to-server blockchain interactions
- For backend-only blockchain integrations
Instructions
- Choose connection library. wagmi + viem (React), ethers.js (vanilla JS), web3modal (multi-wallet).
- Implement connect flow. Detect injected provider → offer WalletConnect → handle rejection gracefully.
- Chain management. Detect current chain, prompt to switch, add custom chains. Handle chain change events.
- Transaction flow. Estimate gas → show confirmation UI → send transaction → poll for receipt → handle revert.
- Message signing. EIP-191 (personal_sign) for auth, EIP-712 for structured data. Verify signatures server-side.
- Account abstraction. Smart contract wallets (ERC-4337), gasless transactions (paymaster), social recovery.
- Error handling. User rejected, insufficient funds, nonce too low, gas estimation failed, chain not supported.
Example
// wagmi + viem transaction flow
import { useWriteContract, useWaitForTransactionReceipt } from 'wagmi'
function MintButton() {
const { writeContract, data: hash } = useWriteContract()
const { isLoading, isSuccess } = useWaitForTransactionReceipt({ hash })
const mint = () => writeContract({
address: '0x1234...',
abi: contractAbi,
functionName: 'mint',
args: [1],
value: parseEther('0.01'),
})
return (
<button disabled={isLoading}>
{isLoading ? 'Minting...' : isSuccess ? 'Minted!' : 'Mint NFT'}
</button>
)
}
1---2name: wallet-integration3description: Integrate Web3 wallets in dApps — MetaMask, WalletConnect, transaction signing, and account abstraction4allowed-tools: [Read, Write, Bash, Grep]5effort: medium6metadata:7 source: https://skillmd.com/skills/uitbreidenos/wallet-integration8---910## When to activate1112- Connecting MetaMask/WalletConnect to a dApp frontend13- Implementing EIP-712 typed data signing14- Building transaction flows with gas estimation and confirmation15- Implementing account abstraction (ERC-4337) smart wallets16- Handling multi-chain wallet connections and chain switching1718## When NOT to use1920- For custodial wallet management (exchange wallets)21- For server-to-server blockchain interactions22- For backend-only blockchain integrations2324## Instructions25261. **Choose connection library.** wagmi + viem (React), ethers.js (vanilla JS), web3modal (multi-wallet).272. **Implement connect flow.** Detect injected provider → offer WalletConnect → handle rejection gracefully.283. **Chain management.** Detect current chain, prompt to switch, add custom chains. Handle chain change events.294. **Transaction flow.** Estimate gas → show confirmation UI → send transaction → poll for receipt → handle revert.305. **Message signing.** EIP-191 (personal_sign) for auth, EIP-712 for structured data. Verify signatures server-side.316. **Account abstraction.** Smart contract wallets (ERC-4337), gasless transactions (paymaster), social recovery.327. **Error handling.** User rejected, insufficient funds, nonce too low, gas estimation failed, chain not supported.3334## Example3536```typescript37// wagmi + viem transaction flow38import { useWriteContract, useWaitForTransactionReceipt } from 'wagmi'3940function MintButton() {41 const { writeContract, data: hash } = useWriteContract()42 const { isLoading, isSuccess } = useWaitForTransactionReceipt({ hash })4344 const mint = () => writeContract({45 address: '0x1234...',46 abi: contractAbi,47 functionName: 'mint',48 args: [1],49 value: parseEther('0.01'),50 })5152 return (53 <button onClick={mint} disabled={isLoading}>54 {isLoading ? 'Minting...' : isSuccess ? 'Minted!' : 'Mint NFT'}55 </button>56 )57}58```