> ## Documentation Index
> Fetch the complete documentation index at: https://digraphsas-docs-cli.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Market swap transaction

> Build calldata for an Augustus v6.2 swap from a Market priceRoute.



## OpenAPI

````yaml api-reference/specs/market.json POST /transactions/{chainId}
openapi: 3.0.3
info:
  title: Velora Market API
  version: 1.0.0
  description: Velora Market API — direct aggregator pricing and Augustus calldata.
servers:
  - url: https://api.velora.xyz
    description: Production
security: []
externalDocs:
  description: Market — how it works (prices → calldata → broadcast).
  url: https://velora.xyz/docs/market/how-it-works
paths:
  /transactions/{chainId}:
    post:
      summary: Build calldata for a Market Swap
      description: >-
        Build ready-to-broadcast transaction parameters from the `priceRoute`
        returned by GET /prices, passed verbatim. Unless `ignoreChecks=true`,
        the API verifies balances and allowances and simulates the transaction
        before returning calldata, so the response includes a `gas` estimate.
      operationId: marketTransactions
      parameters:
        - name: chainId
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ChainId'
          description: EVM chain ID. Matches `priceRoute.network`.
        - name: gasPrice
          in: query
          required: false
          schema:
            type: string
          description: Gas price to use for the transaction, in WEI.
        - name: ignoreChecks
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Skip on-chain balance, allowance, and transaction-failure checks.
            The response omits the `gas` field when enabled.
        - name: ignoreGasEstimate
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Skip the gas estimate. The response omits the `gas` field when
            enabled.
        - name: onlyParams
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Return only the contract call parameters instead of a full
            transaction object.
        - name: eip1559
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Return an EIP-1559 transaction with `maxFeePerGas` and
            `maxPriorityFeePerGas` in place of `gasPrice`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarketTransactionRequest'
      responses:
        '200':
          description: Augustus calldata + tx fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketTransactionResponse'
        '400':
          description: >-
            Invalid input or stale priceRoute. Documented examples:
            `InvalidInput`, `StalePriceRoute`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ChainId:
      type: integer
      description: >-
        EVM chain ID. Supported values today include 1 (Mainnet), 10 (Optimism),
        56 (BSC), 137 (Polygon), 8453 (Base), 42161 (Arbitrum), 43114
        (Avalanche), 100 (Gnosis). The set is open — call GET /chains for the
        live list.
      example: 1
    MarketTransactionRequest:
      type: object
      required:
        - srcToken
        - destToken
        - priceRoute
        - userAddress
      properties:
        priceRoute:
          allOf:
            - $ref: '#/components/schemas/MarketPriceRoute'
          description: >-
            The `priceRoute` block returned by GET /prices, passed verbatim — do
            not recompute or re-encode.
        srcToken:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            Source token address. A token symbol listed in /tokens can be used
            instead.
        srcDecimals:
          type: integer
          description: >-
            Source token decimals. Can be omitted if a token symbol is used in
            srcToken.
        destToken:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            Destination token address. A token symbol listed in /tokens can be
            used instead.
        destDecimals:
          type: integer
          description: >-
            Destination token decimals. Can be omitted if a token symbol is used
            in destToken.
        srcAmount:
          allOf:
            - $ref: '#/components/schemas/TokenAmount'
          description: >-
            Source amount in WEI/raw units. Required when `side=SELL`. On
            `side=BUY` it can be omitted if `slippage` is provided.
        destAmount:
          allOf:
            - $ref: '#/components/schemas/TokenAmount'
          description: >-
            Destination amount in WEI/raw units. Required when `side=BUY`. On
            `side=SELL` it can be omitted if `slippage` is provided.
        slippage:
          type: integer
          minimum: 0
          maximum: 10000
          description: >-
            Allowed slippage in basis points (0–10000). `250` = 2.5%. Required
            when the non-fixed amount (destAmount on SELL, srcAmount on BUY) is
            omitted.
        userAddress:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            Address of the transaction caller (msg.sender). When using an
            intermediary contract, userAddress should correspond to msg.sender
            and receiver to the recipient.
        txOrigin:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            When msg.sender differs from the transaction sender, pass the sender
            here along with userAddress.
        receiver:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            Recipient of the swap output, for Swap & Transfer. Omit when
            userAddress receives.
        partner:
          type: string
          example: my-app-name
          description: >-
            Partner string. Used for analytics and fee attribution on your
            project's swaps.
        partnerAddress:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: Address entitled to claim partner fees or surplus.
        partnerFeeBps:
          type: string
          description: Partner fee in basis points, used with partnerAddress. `200` = 2%.
        permit:
          type: string
          description: >-
            Signed permit payload (hex). Lets the swap skip the separate approve
            transaction.
        deadline:
          type: integer
          description: >-
            Unix timestamp (seconds) after which the transaction is no longer
            valid.
        isCapSurplus:
          type: boolean
          default: true
          description: Cap collected surplus at 1%.
        takeSurplus:
          type: boolean
          default: false
          description: Collect positive slippage as surplus. Works with partnerAddress.
        isSurplusToUser:
          type: boolean
          default: false
          description: >-
            Route positive slippage / surplus to the user instead of the
            partner.
        isDirectFeeTransfer:
          type: boolean
          default: false
          description: >-
            Transfer the partner fee directly rather than accruing it in the Fee
            Vault.
    MarketTransactionResponse:
      type: object
      description: Augustus calldata + tx envelope ready to broadcast.
      properties:
        from:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: End-user wallet address (the `userAddress` from the request).
        to:
          allOf:
            - $ref: '#/components/schemas/Address'
          description: >-
            The Augustus v6.2 router. Send the transaction here; it is also the
            ERC-20 spender to approve.
        value:
          type: string
          example: '0'
          description: >-
            Native token amount in WEI to send with the transaction. `"0"` for
            ERC-20 sources.
        data:
          type: string
          description: Encoded swap calldata.
        gasPrice:
          type: string
          example: '16000000000'
          description: >-
            Suggested gas price in WEI. Replaced by maxFeePerGas /
            maxPriorityFeePerGas when `eip1559=true`.
        maxFeePerGas:
          type: string
          description: EIP-1559 max fee per gas in WEI. Present when `eip1559=true`.
        maxPriorityFeePerGas:
          type: string
          description: >-
            EIP-1559 max priority fee per gas in WEI. Present when
            `eip1559=true`.
        gas:
          type: string
          description: >-
            Gas limit estimate from the API's transaction checks. Returned by
            POST /transactions unless `ignoreChecks` or `ignoreGasEstimate` is
            set; omitted by GET /swap, where you estimate locally before
            broadcasting.
        chainId:
          $ref: '#/components/schemas/ChainId'
    ErrorResponse:
      type: object
      description: Standard Velora error envelope.
      required:
        - errorType
      properties:
        errorType:
          $ref: '#/components/schemas/ErrorCode'
        details:
          type: string
          description: Human-readable description of the failure.
      example:
        errorType: PricingError
        details: Error getting price data
    MarketPriceRoute:
      type: object
      description: >-
        Market route block. Calldata-ready against Augustus v6.2 when
        `version=6.2`.
      properties:
        blockNumber:
          type: integer
        network:
          $ref: '#/components/schemas/ChainId'
        srcToken:
          $ref: '#/components/schemas/Address'
        srcDecimals:
          type: integer
        srcAmount:
          $ref: '#/components/schemas/TokenAmount'
        destToken:
          $ref: '#/components/schemas/Address'
        destDecimals:
          type: integer
        destAmount:
          $ref: '#/components/schemas/TokenAmount'
        bestRoute:
          type: array
          items:
            type: object
        gasCostUSD:
          type: string
        gasCost:
          type: string
        side:
          type: string
          enum:
            - SELL
            - BUY
        version:
          type: string
        contractAddress:
          $ref: '#/components/schemas/Address'
        tokenTransferProxy:
          $ref: '#/components/schemas/Address'
        contractMethod:
          type: string
        partnerFee:
          type: number
        srcUSD:
          type: string
        destUSD:
          type: string
        partner:
          type: string
        maxImpactReached:
          type: boolean
        hmac:
          type: string
    Address:
      type: string
      description: >-
        EVM address (20 bytes, hex-encoded with `0x` prefix). Use the mixed-case
        placeholder `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` for native ETH.
      pattern: ^0x[a-fA-F0-9]{40}$
      example: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
    TokenAmount:
      type: string
      description: >-
        Token amount in WEI / raw units (no decimal point). Serialized as a
        string to preserve precision for amounts that exceed JavaScript Number
        range.
      example: '1000000000000000000'
    ErrorCode:
      type: string
      description: >-
        Documented Velora error code (e.g. `PricingError`, `InvalidInput`,
        `UnsupportedChain`, `StalePriceRoute`, `InvalidSignature`). The set is
        open — handle codes you recognize and fall back to a generic error path
        for everything else. See /api-reference/troubleshooting for known codes.
      example: PricingError

````