Native Integration
Learn how to integrate Abstract Global Wallet with React.
Integrate AGW into an existing React application using the steps below, or watch the video tutorial for a step-by-step walkthrough.
1. Install Abstract Global Wallet
Install the required dependencies:
2. Setup the AbstractWalletProvider
Wrap your application in the AbstractWalletProvider
component to enable the use of the package’s hooks and components
throughout your application.
Next.js App Router: If you are using Next.js App
Router, create a new component and add the use client
directive at the top of your file (see
example)
and wrap your application in this component (see
example).
The AbstractWalletProvider
wraps your application in both the WagmiProvider and
QueryClientProvider,
meaning you can use the hooks and features of these libraries within your application.
3. Login with AGW
With the provider setup, prompt users to sign in to your application with their Abstract Global Wallet using the useLoginWithAbstract hook.
4. Use the Wallet
With the AGW connected, prompt the user to approve sending transactions from their wallet.
- Use the Abstract Client or Abstract hooks for:
- Wallet actions. e.g. sendTransaction, deployContract, writeContract etc.
- Smart contract wallet features. e.g. gas-sponsored transactions, session keys, transaction batches.
- Use Wagmi hooks and Viem functions for generic blockchain interactions, for example:
- Reading data, e.g. Wagmi’s useAccount and useBalance hooks.
- Writing data, e.g. Wagmi’s useSignMessage and Viem’s verifyMessage.
Was this page helpful?