Skip to main content
Welcome to the Para Embedded Wallet tutorial! This guide will walk you through setting up a Swig account with Para’s solution for embedded wallets. Para provides a modal that makes authentication simple and easy for both developers and users.

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:
  1. Set up a Para account on their developer portal
  2. Generate an API Key
  3. Enable Solana as a supported network

Tutorial Sections

  1. Project Setup
  2. Para SDK Integration
  3. Creating the UI Components
  4. 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:
Create or update your vite.config.ts:

2. Para SDK Integration

Set up the Para Provider

Create a file called providers.tsx in your src directory:

Add TypeScript Environment Types

Create a file called vite-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 your App.tsx:

Create the Main Component

Create AppContent.tsx in src/components/:

Create the Login Button Component

Create LoginButton.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

The createSwigAccount function:
  1. Generates a unique ID for the Swig account
  2. Creates a Para Solana signer
  3. Sets up root authority with full permissions
  4. Builds and signs the transaction using Para’s signer
  5. Sends the transaction to create the Swig account
🔒 The Para-generated wallet becomes the root authority for the Swig account

Important Notes

  1. Devnet SOL: Before creating the Swig account, you need to send devnet SOL to the Para-generated wallet address.
  2. Error Handling: The implementation includes proper error handling and loading states.
  3. Balance Display: The UI shows the wallet’s SOL balance and Swig address after creation.

Running the Application

  1. Start the development server:
  1. Open your browser to the displayed URL (usually http://localhost:5173)
  2. Click “Sign in with Para” to authenticate
  3. After authentication, send some devnet SOL to your wallet address
  4. 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
For more information, check out: