Build Abstraxn Smart Wallets in a new appIn this doc and the following ones, we will build a React application with Abstraxn Smart Wallets from scratch. This guide supports both Vite and Next.js setups.
Create a new React app
Choose your preferred framework:Option 1: Vite + React (Recommended)
Start by initializing a new React application with Vite:pnpm
yarn
Option 2: Next.js
Start by initializing a new Next.js app:Install Dependencies
You will need these core libraries:- @abstraxn/signer-react: Abstraxn Signer SDK React package for handling wallet interactions and transaction signing
- @abstraxn/signer-core: Abstraxn Signer SDK core package (required dependency)
- @tanstack/react-query: A required async state library for managing smart wallet state (learn more)
npm
pnpm
yarn
Setup AbstraxnProvider
The Abstraxn SDK requires wrapping your application with theAbstraxnProvider component. This provides the wallet context to all components in your app.
For Vite Projects
Update yoursrc/main.tsx (or src/main.jsx) file:
For Next.js Projects
Update yourapp/layout.tsx (App Router) or pages/_app.tsx (Pages Router):
app/layout.tsx (App Router):
Note: Replace YOUR_API_KEY with your actual Abstraxn API key. You can obtain one from your Abstraxn Dashboard.
Enable Solana Gasless Transactions (Optional)
If your app supports Solana, add thesolanaGasless option to your provider config. This sponsors transaction fees from your paymaster gas pool so users never need SOL for gas.
Next Steps
Now that you have the basic setup complete, you can:- Configure your environment - Set up environment variables and configuration
- Use the SDK hooks - Learn how to integrate wallet functionality in your app
- Customize the UI - Customize the onboarding and wallet UI components