What You’ll Learn
In this tutorial, you’ll learn how to:- Set up a Para developer account
- Create a React + Vite project with Para integration
- Implement Para’s authentication modal
- Create a Swig account using the Para-generated wallet
Live Demos
Time Commitment
This tutorial is designed to be completed in approximately 45 minutes.Prerequisites
Before starting this tutorial:- Set up a Para account on their developer portal
- Generate an API Key
- Enable Solana as a supported network
Tutorial Sections
- Project Setup
- Para SDK Integration
- Creating the UI Components
- Implementing Swig Account Creation
1. Project Setup
First, let’s create a new Vite project and install the necessary dependencies.Create a Vite Project
Follow the Vite docs to create a new project.Install Dependencies
Set up Vite Polyfills
Install the polyfills package:vite.config.ts:
2. Para SDK Integration
Set up the Para Provider
Create a file calledproviders.tsx in your src directory:
Add TypeScript Environment Types
Create a file calledvite-env-d.ts in your src directory:
Configure Environment Variables
Create a.env.local file in your project root:
🔒 Never commit your API key to version control!
3. Creating the UI Components
Update App Component
Modify yourApp.tsx:
Create the Main Component
CreateAppContent.tsx in src/components/:
Create the Login Button Component
CreateLoginButton.tsx in src/components/:
4. Understanding the Implementation
Para Modal Integration
The Para modal handles:- User authentication via OAuth providers
- Wallet creation and management
- Secure key storage
💡 Para abstracts away the complexity of wallet creation and management
Swig Account Creation
ThecreateSwigAccount function:
- Generates a unique ID for the Swig account
- Creates a Para Solana signer
- Sets up root authority with full permissions
- Builds and signs the transaction using Para’s signer
- Sends the transaction to create the Swig account
🔒 The Para-generated wallet becomes the root authority for the Swig account
Important Notes
- Devnet SOL: Before creating the Swig account, you need to send devnet SOL to the Para-generated wallet address.
- Error Handling: The implementation includes proper error handling and loading states.
- Balance Display: The UI shows the wallet’s SOL balance and Swig address after creation.
Running the Application
- Start the development server:
-
Open your browser to the displayed URL (usually
http://localhost:5173) - Click “Sign in with Para” to authenticate
- After authentication, send some devnet SOL to your wallet address
- Click “Create Swig” to create your Swig account
Next Steps
Now that you have a Swig account with Para integration, you can:- Implement additional Swig functionality (transfers, token management, etc.)
- Customize the Para modal appearance
- Add more OAuth providers
- Implement additional security features

