Use this prompt with your preferred AI assistant (Claude, ChatGPT, etc.) to automatically add Ethereum/EVM embedded wallet functionality to your existing Civic Auth integration.
# Ethereum/EVM Embedded Wallets Integration Prompt## Prerequisites CheckBefore starting, verify the user has:1. Existing Civic Auth integration in their React/Next.js project2. A working Civic Auth Client ID3. Basic authentication already functionalIf any of these are missing, stop and direct them to set up basic Civic Auth first.## TaskAdd Ethereum/EVM embedded wallet functionality to an existing Civic Auth integration.## Step 1: Fetch the Ethereum DocumentationUse curl to fetch the Ethereum embedded wallets documentation:curl https://docs.civic.com/web3/ethereum-evm.mdThis documentation contains ALL the code examples and instructions needed for Ethereum wallet integration. Do NOT use web search or any other tools - only use curl to fetch this specific URL.## Step 2: Gather Project InformationAsk the user for the following information if not provided:**Required Information (gather ALL before starting):**- ✅ Current framework (React, Next.js, etc.)- ✅ Build tool (Vite, Create React App, Next.js, or other)- ✅ Wagmi integration preference (Yes/No - whether to integrate with existing Wagmi setup)- ✅ Target blockchain networks (Ethereum mainnet, Polygon, etc.)- ✅ RPC provider preference (Alchemy, Infura, or custom)- ✅ Which components need wallet functionality- ✅ Existing Web3 libraries that might conflict**DO NOT proceed with implementation until you have confirmed ALL of the above information.**## Step 3: Analyze Current SetupBefore implementing:1. Examine the existing Civic Auth setup2. Identify where the CivicAuthProvider is configured3. Check for any existing Web3/Wagmi dependencies4. Plan integration points for wallet functionality## Step 4: Implement Ethereum Embedded WalletsUsing ONLY the documentation fetched via curl:1. **Install Dependencies**: Add the required @civic/auth-web3 and wagmi packages2. **Update Provider**: Enhance the existing CivicAuthProvider setup for Web33. **Configure Wagmi**: Set up Wagmi configuration with Civic's embeddedWallet connector4. **Implement Wallet Creation**: Add wallet creation logic for new users5. **Add Wallet Components**: Create components for wallet interaction (balance, transactions)6. **Configure Network Settings**: Set up supported chains and RPC endpoints7. **Handle Chain Switching**: Implement chain switching functionality## Step 5: Add Wallet FunctionalityImplement core wallet features:- **Check if user has wallet**: Use userHasWallet type guard- **Create wallet for new users**: Implement createWallet functionality - **Display wallet address**: Show the user's Ethereum address- **Check wallet balance**: Query and display ETH balance- **Send transactions**: Basic transaction sending capability- **Chain switching**: Allow users to switch between supported networks- **Error handling**: Proper error states for wallet operations## Step 6: Configure Multi-Chain Support (Optional)If the user needs multiple chains:- Set up supported chains configuration- Configure custom RPC endpoints- Handle chain-specific logic- Implement proper error handling for unsupported chains## Important Notes- Use ONLY curl to fetch the documentation - no web search tools- The fetched documentation is the ONLY source of truth for this implementation- All code examples, configuration options, and setup instructions are in that document- Pay attention to Wagmi version compatibility requirements- Ensure proper TypeScript types are used (ExistingWeb3UserContext vs NewWeb3UserContext)## CRITICAL: Wagmi ConfigurationThe embeddedWallet() connector must be properly configured in your Wagmi setup:import { embeddedWallet } from '@civic/auth-web3/wagmi'const config = createConfig({ connectors: [ embeddedWallet(), // Civic embedded wallet // ... other connectors like MetaMask ], // ... rest of configuration})## Testing RequirementsAfter implementation, ensure the following works:1. Existing users can create wallets2. Users with wallets can see their address and balance3. Transaction sending works on testnet4. Chain switching functions properly5. Wagmi hooks work correctly with Civic wallets6. Error states display properly