Gold Logo

Jupiter API Integration

This guide provides detailed information on integrating with Jupiter's API for token swaps and liquidity access within the Gold Digger ecosystem.

REST API Endpoints

Jupiter provides several REST API endpoints for token swaps and price quotes. Here are the key endpoints used in the Gold Digger platform:

Quote API

The Quote API provides price quotes and route information for token swaps.

GET https://quote-api.jup.ag/v6/quote

Query Parameters

  • inputMint: The mint address of the input token
  • outputMint: The mint address of the output token
  • amount: The amount of input tokens in lamports
  • slippageBps: Slippage tolerance in basis points (1 basis point = 0.01%)
  • onlyDirectRoutes: (Optional) If true, only direct routes will be returned

Example Request

GET https://quote-api.jup.ag/v6/quote?inputMint=GOLD_TOKEN_ADDRESS&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000&slippageBps=50

Swap API

The Swap API allows you to execute token swaps based on the routes provided by the Quote API.

POST https://quote-api.jup.ag/v6/swap

Request Body

  • route: The route object returned by the Quote API
  • userPublicKey: The public key of the user's wallet
  • wrapUnwrapSOL: (Optional) Whether to wrap/unwrap SOL automatically
  • feeAccount: (Optional) The account to receive platform fees

Price API

The Price API provides current market prices for tokens without computing full swap routes.

GET https://price-api.jup.ag/v4/price

Query Parameters

  • ids: Comma-separated list of token mint addresses
  • vsToken: (Optional) The token to price against (default: USDC)

Gold Digger Integration Best Practices

When integrating Jupiter with Gold Digger, follow these best practices for optimal performance and user experience:

Caching

Implement client-side caching for price quotes to reduce API calls. Refresh quotes periodically (every 30 seconds) or when user actions require fresh data.

Error Handling

Implement robust error handling for network issues, rate limits, and transaction failures. Provide clear error messages to users and retry mechanisms where appropriate.

Transaction Monitoring

Track swap transactions and provide real-time updates to users. Implement a transaction history feature to allow users to view their past swaps.

Platform Fees

Configure platform fees to generate revenue for the Gold Digger ecosystem. Use the platformFeeBpsparameter to set a small fee (e.g., 0.25%) on swaps.

User Experience

Provide a seamless user experience with clear information about swap rates, fees, and slippage. Allow users to customize slippage tolerance and view multiple route options.