You’re viewing the 2.0 (LTS) docs. View the current 3.0 version of this page.
Prerequisites
Before starting this integration:- Set up a Para account on their developer portal
- Generate an API Key
- Enable Solana as a supported network
- Basic understanding of React, TypeScript, and Solana
Installation
Install the required dependencies for SWIG integration:Setup
Vite Configuration
Update yourvite.config.ts for Solana compatibility:
Environment Variables
Create a.env.local file in your project root:
Para Provider Setup
Createproviders.tsx in your src directory:
Authentication
Create a login button component with Para modal integration:SWIG Account Creation
Create a SWIG account using Para’s Solana Web3.js integration:Complete Application
Here’s the complete App component that brings everything together:Key Implementation Details
SWIG Account Creation Process
ThecreateSwigAccount function performs these critical steps:
- Generate Random ID: Creates a unique 32-byte identifier for the SWIG account
- Create Para Signer: Initializes
ParaSolanaWeb3Signerwith Para client and wallet - Set Authority: Establishes the Para-generated wallet as root authority
- Configure Actions: Grants full permissions using
Actions.set().all().get() - Build Transaction: Creates and configures the Solana transaction
- Sign & Send: Uses Para’s signer to sign and broadcast the transaction
Important Notes
- Devnet SOL Required: You need devnet SOL in your Para-generated wallet before creating a SWIG account
- Root Authority: The Para-generated wallet becomes the root authority for the SWIG account
- Error Handling: The implementation includes proper error handling and loading states
- Balance Display: Shows wallet SOL balance and SWIG address after creation
Testing Your Integration
- Start your development server:
- Open your browser to the displayed URL
- Click “Sign in with Para” to authenticate
- Send devnet SOL to your wallet address
- Click “Create Swig Account” to create your SWIG account
Best Practices
- Never commit API keys to version control
- Use environment variables for sensitive configuration
- Test thoroughly on Solana devnet before mainnet
- Implement proper error handling throughout the flow
- Store SWIG account information securely
Resources
Next Steps
Now that you have SWIG working with Para, you can:- Implement additional SWIG functionality (transfers, token management)
- Customize the Para modal appearance and OAuth providers
- Add more complex transaction flows
- Implement additional security features like multi-signature support
- Integrate with other Solana protocols and applications