본문으로 건너뛰기
샘플 앱으로 돌아가기

Jupiter Ultra Swap Demo

A single-page Solana swap UI demonstrating token swaps using Jupiter Ultra API

프론트엔드 프레임워크/라이브러리:
Next.js
언어:
TypeScript
빌드 도구/개발 서버:
npm
샘플 앱 미리 보기

개요

This Solana-based single-page application facilitates token exchanges through Jupiter Ultra API integration, paired with Quicknode RPC and Solana Wallet Adapter technologies. The application provides a seamless interface for users to swap tokens on the Solana blockchain with real-time balance updates and transaction tracking.

For a detailed walkthrough of the Jupiter Ultra API integration and implementation details, see the companion guide: How to Swap Tokens With Jupiter Ultra API.


Mainnet Only - Real Tokens & Fees

Jupiter Ultra Swap is only available on Solana mainnet-beta. This means executing swaps will trade real tokens and incur real network fees. You could lose value due to price movement, slippage, or selecting the wrong token pair. Test with small amounts first.

건축

┌─────────────────┐
│ Next.js UI │
│ (Client Side) │
└────────┬────────┘

├─ Wallet Adapter (Phantom, Backpack, Solflare)

├─ API Routes (Server Side)
│ ├─ /api/tokens
│ ├─ /api/balances
│ ├─ /api/quote
│ ├─ /api/execute
│ └─ /api/rpc

├─ Jupiter Ultra API
│ └─ Token swaps & quotes

└─ Quicknode RPC
└─ Solana blockchain interactions

주요 기능


  • Multi-Wallet Support: Connect with Phantom, Backpack, or Solflare wallets
  • Token Selection: Choose from a comprehensive list of verified Solana tokens for swap
  • Real-Time Balances: View live token balances directly from the blockchain
  • Swap Quotes: Get instant swap quotes before executing transactions
  • Transaction Execution: Use Jupiter Ultra's Quote → Order → Sign → Execute → Status lifecycle
  • Transaction Tracking: Monitor swap status and view transaction details on Solana Explorer

필수 조건


  • Node.js (v18 or higher)
  • A Quicknode Solana endpoint
  • A Jupiter API key for swap functionality
  • A Solana wallet (Phantom, Backpack, or Solflare) with mainnet access
  • A small amount of mainnet-beta SOL for transaction fees
  • A small amount of tokens to swap (USDC recommended for testing)

To get your Quicknode RPC URL:

  1. Sign up at Quicknode
  2. Create a new Solana endpoint
  3. Copy the HTTP Provider URL

프로젝트 구조

jupiter-ultra-swap/
├── app/
│ ├── api/ # Server-side API routes
│ │ ├── balances/ # Token balance queries
│ │ ├── execute/ # Swap execution
│ │ ├── quote/ # Swap quotes
│ │ ├── rpc/ # RPC proxy
│ │ └── tokens/ # Token list
│ ├── providers/ # React context providers
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main swap interface
├── components/ # Swap UI components
├── hooks/ # Custom React hooks
│ ├── useWallet.ts # Wallet connection logic
│ ├── useTokens.ts # Token data management
│ └── useSwap.ts # Swap orchestration
├── lib/ # Utility libraries
│ ├── jupiter-client.ts # Jupiter API client
│ ├── solana-kit.ts # Solana RPC client
│ └── types.ts # TypeScript definitions
└── .env.example # Environment variables template

시작하기

1. Clone the repository:

git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/solana/jupiter-ultra-swap

2. Install dependencies:

npm 설치

3. Configure environment variables:

cp .env.example .env.local

Edit .env.local and add your Quicknode RPC URL and Jupiter API key.

# Quicknode Solana RPC endpoint
QUICKNODE_RPC_URL=your_quicknode_rpc_endpoint_here

# Jupiter API key for swap functionality
JUPITER_API_KEY=your_jupiter_api_key_here

4. Run the development server:

npm run dev

5. Open the application:

Navigate to http://localhost:3000 in your browser.

API Endpoints


The application includes the following server-side API routes:

  • /api/tokens: Returns the list of available tokens for swapping
  • /api/balances: Fetches token balances for a connected wallet
  • /api/quote: Gets swap quotes from Jupiter Ultra API
  • /api/execute: Executes the swap transaction
  • /api/rpc: Proxies RPC requests to Quicknode

미리 보기

Jupiter Ultra Swap Demo Preview

기여 및 피드백
여러분의 의견을 듣고 싶으며, 이 샘플 앱에 대한 모든 기여를 환영합니다!
문제를 신고하거나 피드백을 공유하려면, 다음에서 GitHub 이슈를 생성해 주세요. qn-가이드-예시 저장소.
기여하시려면 다음 단계를 따르세요:
  1. 저장소를 포크하기
  2. 기능 브랜치 생성:
    git checkout -b feature/amazing-feature
  3. 변경 사항을 커밋하세요:
    git commit -m "멋진 기능 추가"
  4. 브랜치를 푸시하세요:
    git push origin feature/amazing-feature
  5. 풀 리퀘스트를 제출하세요.