Privy
Learn how to integrate Abstract Global Wallet into an existing Privy application
Privy powers the login screen and EOA creation of Abstract Global Wallet, meaning you can use Privy’s features and SDKs natively alongside AGW.
The agw-react
package provides an AbstractPrivyProvider
component,
which wraps your application with the PrivyProvider
as well as the Wagmi and TanStack Query providers; allowing you to use the features of each library with Abstract Global Wallet.
Installation
Install the required dependencies:
Usage
This section assumes you have already created an app on the Privy dashboard.
1. Enable Abstract Integration
From the Privy dashboard, navigate to Ecosystem > Integrations.
Scroll down to find Abstract and toggle the switch to enable the integration.
2. Configure the AbstractPrivyProvider
Wrap your application in the AbstractPrivyProvider
component, providing your
as the appId
prop.
3. Login users
Use the useAbstractPrivyLogin
hook to prompt users to login with Abstract Global Wallet.
-
The
login
function uses Privy’s loginWithCrossAppAccount function to authenticate users with their Abstract Global Wallet account. -
The
link
function uses Privy’s linkCrossAppAccount function to allow authenticated users to link their existing account to an Abstract Global Wallet.
4. Use hooks and functions
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).
Was this page helpful?