Gateway Swaps

Execute a swap transaction via router (Jupiter, 0x).

Example: connector: 'jupiter' network: 'solana-mainnet-beta' trading_pair: 'SOL-USDC' side: 'BUY' amount: 1 slippage_pct: 1 (optional; omit to use the connector's configured slippagePct) wallet_address: (optional, uses default if not provided) extra_params: {"approximateIfNoExactOut": false} # Solana routers

Returns: Transaction hash and swap details

post/gateway/swap/execute

Request

  • Base URL
    http://localhost:8000
  • URL
    http://localhost:8000/gateway/swap/execute
  • Auth
    HTTP basic

Request body

connectorstring required

DEX router connector (e.g., 'jupiter', '0x')

networkstring required

Network ID in 'chain-network' format (e.g., 'solana-mainnet-beta')

trading_pairstring required

Trading pair (e.g., 'SOL-USDC')

sidestring required

Trade side: 'BUY' or 'SELL'

wallet_addressstring nullable

Wallet address (optional, uses default if not provided)

extra_paramsobject nullable

Connector-specific params passed through to Gateway under its own names: approximateIfNoExactOut (Solana routers). Unknown keys are rejected.

Response

Successful Response

transaction_hashstring required

Transaction hash

trading_pairstring required

Trading pair

sidestring required

Trade side

amountstring required

Amount REQUESTED, denominated in the base token (SELL: base sold; BUY: base wanted). This is the request echoed back, not the fill — see input_amount / output_amount for what actually moved.

input_amountstring nullable

Amount actually spent, denominated in the input token (quote for BUY, base for SELL). None until the transaction confirms.

output_amountstring nullable

Amount actually received, denominated in the output token (base for BUY, quote for SELL). None until the transaction confirms.

pricestring nullable

Executed price in quote per base, computed from the amounts that moved. None until the transaction confirms.

statusstring

Transaction status

Changes

    • info

      added the new optional request property

    • info

      the request property default value 1 was removed

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status