This example demonstrates how to integrate and use Solana Agent Kit v2 with Para plugins in your application.
VIDEO
Features
Para Plugin Integration Integration of solana-plugin-para for both backend and frontend environments
Wallet Management Complete example of Para wallet creation, management, and transaction handling
Best Practices Real-world usage patterns and implementation best practices
Full-stack Implementation Includes both server-side and client-side integration examples
Prerequisites
Node.js 16.x or higher
pnpm or bun package manager
Solana development environment
Para API credentials
Installation
Clone the repository
git clone < repository-ur l >
Install Para plugin dependencies
First, clone and build the Para plugin:
npx gitpick sendaifun/solana-agent-kit/examples/embedded-wallets/para-plugin-example
cd solana-plugin-para
pnpm install
pnpm build
cd ..
Then install the example project dependencies:
cd < this-repository-folde r > /examples/para-plugin-example
pnpm install
Set up environment variables
Copy the example environment file:
Update the .env
file with your credentials:
LANGCHAIN_CALLBACKS_BACKGROUND=false
OPENAI_API_KEY=#optional
RPC_URL=
SOLANA_PRIVATE_KEY=
PARA_API_KEY=
PARA_ENV=BETA | PROD
GROQ_API_KEY=
NEXT_PUBLIC_PARA_ENV=BETA | PROD
NEXT_PUBLIC_PARA_API_KEY=
Running the Example
Start the development server:
Open http://localhost:3000 in your browser to view the application.
Implementation Details
Server-Side Integration
Para can be integrated on the server side by using the Para Server Plugin:
import { SolanaAgentKit } from "solana-agent-kit" ;
import ParaServerPlugin from "@getpara/plugin-para-server" ;
// Initialize Solana Agent Kit with your configuration
const solanaAgent = new SolanaAgentKit (
wallet ,
process . env . RPC_URL ,
{
// Optional configuration options
}
);
// Extend the agent with Para Server Plugin
export const solanaAgentWithPara = solanaAgent . use ( ParaServerPlugin );
Web Integration
For client-side integration, use the Para Web Plugin:
import ParaWebPlugin from "@getpara/plugin-para-web" ;
import { solanaAgent } from "./solana" ;
// Extend the agent with Para Web Plugin
export const solanaAgentWithPara = solanaAgent . use ( ParaWebPlugin );
// Access the Para instance directly
export const para = solanaAgentWithPara . methods . getParaInstance ();
Para Plugin Features
The Para plugin adds the following capabilities to your Solana Agent:
Create embedded wallets for your users without requiring them to manage private keys or install extensions.
// Create a new wallet
const wallet = await para . createWallet ({
name: "User Wallet" ,
email: "user@example.com"
});
Sign transactions securely through Para’s infrastructure:
// Sign a transaction
const signedTx = await para . signTransaction ( transaction );
// Sign and send a transaction
const signature = await para . signAndSendTransaction ( transaction );
Para handles all key management securely, allowing you to focus on building your application logic.
// Retrieve wallet information
const walletInfo = await para . getWallet ( walletId );
// Update wallet settings
await para . updateWallet ( walletId , {
name: "Updated Wallet Name"
});
Project Structure
app/
├── api/ # API routes for Para operations
│ └── agent/ # Agent endpoints for Para integration
├── components/ # React components
│ ├── ui/ # UI components
│ └── wallet/ # Wallet-specific components
├── utils/ # Utility functions
│ ├── para.ts # Para configuration
│ └── solana.ts # Solana agent setup
└── pages/ # Application pages
Integration Benefits
Using Para with Solana Agent Kit provides several advantages:
User-friendly onboarding - Create wallets for users without requiring technical knowledge
Enhanced security - Para’s secure infrastructure manages keys and signing
Developer simplicity - Abstract away complex wallet management
Flexible deployment - Works in both server and client environments
Seamless AI integration - Para works naturally with the Agent Kit’s AI capabilities
Resources
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Responses are generated using AI and may contain mistakes.