Overview
Wagmi is a collection of React hooks for Ethereum Virtual Machine (EVM) compatible networks that makes it easy to work with wallets, contracts, transactions, and signing. Base Account integrates perfectly with Wagmi, allowing you to use all your familiar hooks. You can jump ahead and use the Base Account Wagmi Template to get started.Installation
Option 1: New Wagmi Project
1
Create a new Wagmi Project
To create a new wagmi project, you can use the command line:
2
Override the Base Account SDK version
To get access to the latest version of the Base Account SDK within Wagmi, you can use the following command to override it:Or you can use a specific version by adding the version to the overrides:
3
Install the dependencies
Install the dependencies with your package manager of choice:
Option 2: Existing Project
1
Override the Base Account SDK version
To get access to the latest version of the Base Account SDK within Wagmi, you can use the following command to override it:Or you can use a specific version by adding the version to the overrides:
2
Install the dependencies
Install the dependencies with your package manager of choice:
Configuration
1. Configure Wagmi with Base Account
Create your Wagmi configuration with the Base Account connector configured for Base Account:app/wagmi.ts
2. Wrap Your App
Wrap your application with the Wagmi provider and QueryClient provider:Create a Simple Page (Sign in with Base)
Create a simple landing page that uses Sign In With Base to authenticate the userRun the Wagmi App
Run the application with your package manager of choice:
What you will see when you navigate to the page