Wagmi
Learn how to integrate Capsule with Wagmi for both v1 and v2
Wagmi is a collection of React Hooks for Ethereum, making it easier to build Web3 applications. This guide will show you how to integrate Capsule’s wallet and signing capabilities with both Wagmi v2 (recommended) and v1.
Prerequisites
Before integrating Capsule with Wagmi, ensure you have:
- Set up authentication with Capsule. See our Getting Started guides for details.
- Configured the Capsule client in your application
- A React application set up with React 18 or higher
If you haven’t set up Capsule authentication yet, complete one of our authentication tutorials first and return to this guide when you’re ready to implement Wagmi integration.
Wagmi v2
Installation
Choose your preferred package manager to install the required dependencies:
Usage
First, set up the required providers and configurations:
Then, implement your components using Wagmi hooks:
Always ensure your components using Wagmi hooks are wrapped with both WagmiProvider and QueryClientProvider.
Wagmi v1 (Legacy)
Installation
Install the v1-specific integration package:
Usage
Set up the Wagmi v1 provider:
Example component using v1 hooks:
Server-Side Usage
Wagmi is designed for client-side usage. For server-side signing with Capsule, please refer to our Server-Side Signing Guide for specific instructions.
Wagmi hooks should only be used in client-side components. For server-side signing operations, use our dedicated server-side SDKs.
Additional Resources
Was this page helpful?