Jupiter Swap icon

Jupiter Swap

Jupiter Swap API operations

Overview

This node interacts with the Jupiter Swap API to facilitate various operations related to token swaps on the Solana blockchain. Specifically, it can:

  • Retrieve program ID to label mappings.
  • Get swap quotes for potential token exchanges.
  • Generate swap transactions.
  • Obtain detailed swap instructions for custom transaction building.

A common use case is integrating decentralized exchange (DEX) functionality into workflows, allowing users to programmatically obtain swap quotes or execute swaps between tokens by specifying mint addresses and amounts. For example, a user might want to get a quote for swapping SOL to USDC or generate the necessary instructions to perform that swap within a larger automated process.

Properties

Name Meaning
Base URL The base URL of the Jupiter Swap API endpoint. Default: https://lite-api.jup.ag/swap/v1
Input Mint The mint address of the input token to swap from.
Output Mint The mint address of the output token to swap to.
Amount The amount to swap, specified in the smallest unit (e.g., lamports or atoms).
Slippage BPS Allowed slippage in basis points (default 50 bps = 0.5%).
User Public Key The public key of the user performing the swap (required for swap and swap instructions operations).
Wrap and Unwrap SOL Whether to wrap and unwrap SOL during the swap (boolean).
Use Shared Accounts Whether to use shared accounts for the swap (boolean).
Fee Account Optional fee account address to receive fees.
Compute Unit Price Micro Lamports Optional compute unit price in micro lamports to prioritize transaction processing.

Additional properties relevant only for the "quote" operation:

Name Meaning
Swap Mode Swap mode option: "Exact In" or "Exact Out".
DEXes Comma-separated list of DEXes to include (optional).
Exclude DEXes Comma-separated list of DEXes to exclude (optional).
Restrict Intermediate Tokens Whether to restrict intermediate tokens in routing (boolean).
Only Direct Routes Whether to only use direct routes without intermediates (boolean).
As Legacy Transaction Whether to return the quote as a legacy transaction format (boolean).
Platform Fee BPS Platform fee in basis points (optional).
Max Accounts Maximum number of accounts to consider (default 64).

Output

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

  • For swapInstructions, the output contains detailed instructions needed to build a custom swap transaction.
  • For swap, the output includes the generated swap transaction details.
  • For quote, the output provides pricing and route information for the requested token swap.
  • For programIdToLabel, the output returns a mapping of program IDs to their labels.

If binary data were involved, it would typically represent serialized transactions or signatures, but this node primarily outputs JSON responses from the API.

Dependencies

  • Requires access to the Jupiter Swap API, which may optionally use an API key credential for authentication.
  • The node uses HTTP requests to communicate with the API endpoint defined by the Base URL property.
  • No other external dependencies are required.

Troubleshooting

  • Common issues:

    • Invalid or missing token mint addresses will cause the API to reject requests.
    • Incorrect user public key format or missing required parameters for swap operations.
    • Network connectivity issues or incorrect Base URL configuration.
    • API rate limits or missing API key if the service requires authentication.
  • Error messages:

    • "Unknown operation": Occurs if an unsupported operation is selected; ensure the operation name matches one of the supported options.
    • HTTP errors from the API (e.g., 400 Bad Request) usually indicate invalid input parameters.
    • Authentication errors if the API key is required but not provided or invalid.
  • Resolutions:

    • Verify all required fields are correctly filled with valid values.
    • Check network connectivity and API endpoint correctness.
    • Provide a valid API key credential if the API requires authentication.
    • Use the "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion