Jupiter Swap icon

Jupiter Swap

Jupiter Swap API operations

Overview

This node integrates with the Jupiter Swap API to perform various token swap-related operations on the Solana blockchain. It supports fetching program ID to label mappings, obtaining swap quotes, generating swap transactions, and retrieving swap instructions for custom transaction building.

Typical use cases include:

  • Converting a program ID into a human-readable label.
  • Getting price quotes for swapping one token to another.
  • Creating transactions to execute token swaps.
  • Fetching detailed instructions to build custom swap transactions.

For example, a user might want to get a quote for swapping SOL tokens to USDC tokens or generate a swap transaction that can be submitted to the Solana network.

Properties

Name Meaning
Base URL Base URL for Jupiter Swap API (default: https://lite-api.jup.ag/swap/v1)
Operation The action to perform:
- Program ID to Label
- Quote
- Swap
- Swap Instructions
Input Mint Input token mint address (required for Quote, Swap, Swap Instructions)
Output Mint Output token mint address (required for Quote, Swap, Swap Instructions)
Amount Amount in smallest unit (lamports/atoms) (required for Quote, Swap, Swap Instructions)
Slippage BPS Slippage in basis points (default: 50) (for Quote, Swap, Swap Instructions)
User Public Key User public key for the swap (required for Swap, Swap Instructions)
Wrap and Unwrap SOL Whether to wrap and unwrap SOL (boolean, default true) (Swap, Swap Instructions)
Use Shared Accounts Whether to use shared accounts (boolean, default true) (Swap, Swap Instructions)
Fee Account Fee account address (optional) (Swap, Swap Instructions)
Compute Unit Price Micro Lamports Compute unit price in micro lamports (optional) (Swap, Swap Instructions)
Swap Mode Swap mode options: Exact In, Exact Out (default: Exact In) (Quote only)
DEXes Comma-separated list of DEXes to use (optional) (Quote only)
Exclude DEXes Comma-separated list of DEXes to exclude (optional) (Quote only)
Restrict Intermediate Tokens Whether to restrict intermediate tokens (boolean, default false) (Quote only)
Only Direct Routes Whether to only use direct routes (boolean, default false) (Quote only)
As Legacy Transaction Whether to return as legacy transaction (boolean, default false) (Quote only)
Platform Fee BPS Platform fee in basis points (optional) (Quote only)
Max Accounts Maximum number of accounts (default: 64) (Quote only)

Output

The node outputs JSON data corresponding to the response from the Jupiter Swap API for the selected operation:

  • Program ID to Label: Returns a mapping of program IDs to their labels.
  • Quote: Returns a quote object detailing the swap parameters, expected amounts, routes, fees, etc.
  • Swap: Returns a generated swap transaction object ready for submission.
  • Swap Instructions: Returns detailed instructions for building a custom swap transaction.

No binary data output is produced by this node.

Dependencies

  • Requires access to the Jupiter Swap API endpoint specified by the Base URL.
  • Optionally uses an API key credential for authenticated requests via an HTTP header x-api-key.
  • No other external dependencies are required.

Troubleshooting

  • Unknown operation error: Occurs if an unsupported operation is selected. Ensure the operation property is set correctly.
  • HTTP request failures: Network issues or invalid API URLs may cause errors. Verify the Base URL and network connectivity.
  • Authentication errors: If using an API key, ensure it is valid and properly configured in the node credentials.
  • Invalid input parameters: Missing or malformed token mint addresses, amounts, or public keys will cause API errors. Double-check all required inputs.
  • Rate limiting or API quota exceeded: The Jupiter API may limit requests; consider adding delays or upgrading API access if needed.

Links and References

Discussion