Getting Started
Learn how to integrate Abstract Global Wallet into your React application using the agw-react package.
Quickstart
Starting a new project? Use our CLI to bootstrap a new project with Abstract Global Wallet.
Library Integrations
Native Integration
Add AGW as the native wallet connection option to your React application.
Privy
Integrate AGW into an existing Privy application.
ConnectKit
Integrate AGW as a wallet connection option to an existing ConnectKit application.
Dynamic
Integrate AGW as a wallet connection option to an existing Dynamic application.
RainbowKit
Integrate AGW as a wallet connection option to an existing RainbowKit application.
Thirdweb
Integrate AGW as a wallet connection option to an existing thirdweb application.
Native Integration
Alternatively, integrate AGW into an existing React application using the steps below, or watch the video tutorial for a step-by-step walkthrough.
1. Install agw-react
To install the agw-react package
, run the following command:
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. Use React Hooks
With the provider setup, you can now use any of the available hooks
from the agw-react
package inside
any component within your application. To prompt the user to sign in with AGW, use the
useLoginWithAbstract hook.
4. Use wagmi hooks
Once the user has signed in, you can begin to use any of the agw-react
hooks,
such as useWriteContractSponsored
as well as all of the existing wagmi hooks; such as useAccount,
useBalance, etc.
All transactions will be sent from the connected AGW smart contract wallet (i.e. the tx.from
address will be the AGW smart contract wallet address).
5. Use the client directly
The AbstractClient also exposes a set of actions you can use to interact with the wallet, including deploying a contract, sending a transaction, or calling a contract function.
Was this page helpful?