Skip to main content
This documentation provides a comprehensive guide to building a NextJS application that leverages the Solana Agent Kit to create a Wormhole agent for cross-chain operations. This integration enables a chat-based interface for interacting with Wormhole’s cross-chain messaging protocol.

Features Overview

  • Interactive Chat Interface for natural language interaction
  • Cross-Chain Token Transfers between supported blockchains
  • CCTP Transfers for USDC between compatible chains
  • Real-Time Transaction Tracking with visual feedback
  • Transaction History for reviewing past operations
  • Responsive Design with dark mode support
  • Debug Panel showing agent operations in real-time

Setup Guide

Prerequisites

  • Node.js (v18 or later recommended)
  • npm, yarn, pnpm, or bun
  • Solana wallet with private key
  • API keys for supported blockchains

Installation

  1. Clone the repository or create a new NextJS application:
  1. Install dependencies:
  1. Configure environment variables:
  1. Start the development server:

Project Structure

Integration Steps

1. Configure Solana Agent Kit

2. Create API Route for Chat

3. Create Chat Interface Component

4. Implement Message Bubble Component

Cross-Chain Operations

Token Transfers

CCTP Transfers

UI Components

Token Transfer UI

Example Prompts

Here are some example prompts that can be handled by the Wormhole agent:

Styling Guide

The application uses Tailwind CSS for styling with the following Wormhole brand color palette:

Error Handling

Testing

Deployment

The application can be deployed on Vercel:
  1. Push your code to a Git repository
  2. Connect the repository to Vercel
  3. Configure environment variables in Vercel dashboard
  4. Deploy the application

Best Practices

  1. Error Handling: Implement comprehensive error handling for all blockchain operations
  2. Rate Limiting: Add rate limiting for API endpoints to prevent abuse
  3. Transaction Monitoring: Implement a robust transaction monitoring system
  4. User Feedback: Provide clear feedback during long-running operations
  5. Security: Store private keys securely and never expose them in client-side code

Resources