Discointed Spot Trading API Documentation
    Discointed Spot Trading API Documentation
    • Discounted Spot Trading API Documentation

    Discounted Spot Trading API Documentation

    Quote Endpoint#

    Returns the best depth-based quote and expected output for swapping a specified amount of tokenA to tokenB.
    Name(Type)Description
    tokenA(string)Input token
    tokenB(string)Output token
    amount(string)Amount to swap
    x-api-keyYour API key

    Sample Request (TRY OUT)#

    Sample Response#

    {
      "quote": {
        "amountA": 15.1,
        "amountB": 15.095621,
        "amountIn": 15.1,
        "evmDecimalsA": 8,
        "evmDecimalsB": 8,
        "feeAmount": 0.0,
        "feeMaker": 0.0,
        "feeTaker": 0.0006999999999999999,
        "grossAmountB": 15.095621,
        "marketA": "@166",
        "marketB": "USDC",
        "priceA": 0.99972,
        "priceB": 1.0,
        "priceImpact": 0.0,
        "route": {
          "unwrap": false,
          "wrap": false
        },
        "sizeDecimalA": 2,
        "sizeDecimalB": 8,
        "spotIndexA": 10268,
        "spotIndexB": 10000,
        "systemAddressA": "0x200000000000000000000000000000000000010c",
        "systemAddressB": "0x2000000000000000000000000000000000000000",
        "tokenA": "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb",
        "tokenAName": "USDT0:0x25faedc3f054130dbb4e4203aca63567",
        "tokenB": "usdc",
        "tokenBName": "USDC:0x6d1e7cde53ba9467b783cb7c530ce054",
        "weiDecimalsA": 8,
        "weiDecimalsB": 8
      },
      "success": true
    }

    Swap Endpoint#

    Submits a signed swap request to the Router. The Router verifies the signatures, forwards the hlTxn as a sendAsset action to Hyperliquid, and enqueues the order for processing.
    Parameters:
    Name (Type)Description
    txn (object)Swap intent (order + tokens + amount + user + timestamp).
    signature (object)EIP-712 signature for txn (r, s, v).
    hlTxn (object)Hyperliquid sendAsset transaction payload.
    hlSignature (object)Hyperliquid EIP-712 signature for hlTxn (r, s, v).
    txn fields:
    Name (Type)Description
    orderId (string)UUID string.
    tokenIn (string)Input token address (0x...).
    tokenOut (string)Output token address (0x...).
    amountIn (string)Input amount as string.
    amountInDecimals (number)Optional decimals hint.
    userAddress (string)User EVM address (0x...).
    timestamp (string)Timestamp string (included in signature).
    signature / hlSignature fields:
    Name (Type)Description
    r (string)32-byte hex (0x...).
    s (string)32-byte hex (0x...).
    v (string)Recovery id (commonly "0x1b" / "0x1c").
    hlTxn fields:
    Name (Type)Description
    hyperliquidChain (string)Hyperliquid chain label (string).
    signatureChainId (string)Hex chain id for HL EIP-712 domain (e.g. "0xa4b1").
    destination (string)Must equal the Router solver address.
    sourceDex (string)Source venue label (commonly "spot").
    destinationDex (string)Destination venue label (commonly "spot").
    token (string)Token identifier string (as used by HL).
    amount (string)Amount string (as used by HL).
    fromSubAccount (string)Subaccount identifier string.
    nonce (number)Nonce (uint64).

    Signing Requirements#

    Signature #1: txn EIP-712#

    Domain:
    name: AnthiasRouter
    version: 1
    Primary type:
    Txn(bytes32 order_id,address user_address,address token_in,address token_out,uint256 amount_in,string timestamp)

    Signature #2: hlTxn EIP-712 (Hyperliquid SendAsset)#

    Domain
    name: HyperliquidSignTransaction
    version: 1
    chainId: parsed from hlTxn.signatureChainId 
    verifyingContract: 0x0000000000000000000000000000000000000000
    Primary type:
    HyperliquidTransaction:SendAsset(string hyperliquidChain,string destination,string sourceDex,string destinationDex,string token,string amount,string fromSubAccount,uint64 nonce)

    Sample Request(TRY OUT) :#

    Use the actual signed transaction to send swap
    field "token" in /swap request should be replaced with the "tokenAName" received from /quote endpoint
    Refer - https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#send-asset

    Sample Response:#

    {
      "orderId": "4d42476d-3a94-48d7-ad7b-fd3e458bfc3d",
      "status": "enqueued"
    }
    Modified at 2025-12-22 19:18:56
    Built with