> ## Documentation Index
> Fetch the complete documentation index at: https://docs.passage.coinlist.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Encode an Ondo swap for broadcast

> Encodes the buy the user just confirmed and returns calldata their wallet can sign and broadcast, plus the amounts it commits to. This is the commit step: it consumes an attestation and the calldata expires, so call it once per confirmation and never poll it. Approve the swap contract for the full amount first; an allowance short of it is rejected here rather than reverting on-chain. The addresses are resolved from the offer, so the request names the asset, not the tokens.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/ondo/swap/transaction
openapi: 3.0.0
info:
  title: Frontline API
  version: 0.1.0
servers:
  - url: https://api.coinlist.co
    variables: {}
security: []
tags:
  - name: DocumentSubmissions
  - name: KYC
  - name: OAuth
  - name: Offers
  - name: Ondo
  - name: Participations
  - name: Pii
  - name: Requirements
  - name: Swap
  - name: Token
  - name: Wallet
  - name: Wallet Ownership
paths:
  /v1/ondo/swap/transaction:
    post:
      tags:
        - Ondo
      summary: Encode an Ondo swap for broadcast
      description: >-
        Encodes the buy the user just confirmed and returns calldata their
        wallet can sign and broadcast, plus the amounts it commits to. This is
        the commit step: it consumes an attestation and the calldata expires, so
        call it once per confirmation and never poll it. Approve the swap
        contract for the full amount first; an allowance short of it is rejected
        here rather than reverting on-chain. The addresses are resolved from the
        offer, so the request names the asset, not the tokens.
      operationId: createOndoSwapTransaction
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OndoSwapTransactionRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OndoSwapTransactionRequest'
        description: Ondo swap transaction params
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OndoSwapTransaction'
          description: Successful response.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error response.
      callbacks: {}
      security:
        - OAuth2: []
components:
  schemas:
    OndoSwapTransactionRequest:
      additionalProperties: false
      description: 'The buy to encode: an asset, the wallet buying it, and what it pays.'
      properties:
        amount:
          description: >-
            Gross amount to pay, as a uint256 decimal string in the funding
            token's smallest unit. This is the figure to approve: the CoinList
            fee comes off it, and Ondo prices the remainder.
          example: '100000000'
          type: string
        chain:
          description: >-
            The EVM chain to swap on. Only chains CoinList has deployed a swap
            contract on are accepted, which is narrower than both this enum and
            the chains the on-chain reads serve.
          enum:
            - ethereum_sepolia
            - base_sepolia
            - ethereum_mainnet
            - base_mainnet
          example: ethereum_sepolia
          type: string
        symbol:
          description: Ondo asset symbol to buy
          example: AAPLon
          type: string
        wallet_address:
          description: >-
            Wallet that will broadcast the transaction. The calldata is signed
            over it, so no other wallet can send it.
          example: '0x2c4c7082a135f6b980cdae4b40c3ebf72cd4a512'
          type: string
      required:
        - symbol
        - chain
        - wallet_address
        - amount
      title: OndoSwapTransactionRequest
      type: object
    OndoSwapTransaction:
      additionalProperties: false
      description: >-
        A signed, ready-to-broadcast Ondo swap and the amounts it commits to.
        Unlike the quote, this spends an attestation and expires, so call it
        once the user has confirmed and never on a timer.
      properties:
        action:
          enum:
            - broadcast_transaction
          type: string
        data:
          description: The encoded swap to broadcast on-chain
          example: '0x0c89df8c'
          type: string
        expires_at:
          description: >-
            When the signed calldata stops being accepted. Broadcast before this
            or request a new transaction; a late send reverts.
          example: '2025-01-01T00:00:00.000000Z'
          format: date-time
          nullable: false
          type: string
        fee:
          description: >-
            CoinList's cut of pay_input_amount, in the same units. Taken at
            execution, not on top, so the wallet never approves more than
            pay_input_amount.
          example: '0'
          type: string
        notional_value:
          description: >-
            The part of pay_input_amount that reaches Ondo, in the same units.
            This is what the quantity was priced against, and the signature
            commits to it.
          example: '100000000'
          type: string
        pay_input_amount:
          description: >-
            Total the purchase costs, fee included, as a uint256 decimal string
            in the funding token's smallest unit. The approval has to cover
            this.
          example: '100000000'
          type: string
        pay_input_decimals:
          description: >-
            Decimals pay_input_amount, fee and notional_value are denominated
            in, read on-chain from the funding token. The token is resolved from
            the offer rather than named by the caller, so this is the only place
            its scale is published.
          example: 6
          type: integer
        receive_output_amount:
          description: >-
            Quantity of the asset the wallet receives, as a uint256 decimal
            string in the asset's smallest unit. Divide by
            10^receive_output_decimals to display whole tokens.
          example: '264000000000000000'
          type: string
        receive_output_decimals:
          description: >-
            Decimals receive_output_amount is denominated in, reported by
            whatever priced the quantity rather than looked up separately.
          example: 18
          type: integer
        to:
          description: The swap contract to submit the transaction to
          example: '0xff9c5ade32d9b4102469bd5f3817cb0061b25fec'
          type: string
      required:
        - action
        - to
        - data
        - expires_at
        - pay_input_amount
        - pay_input_decimals
        - fee
        - notional_value
        - receive_output_amount
        - receive_output_decimals
      title: OndoSwapTransaction
      type: object
    Error:
      additionalProperties: false
      properties:
        code:
          description: A human-readable message providing more details about the error.
          type: string
        errors:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
        event_id:
          description: >-
            The unique identifier for the error event. This is useful for
            tracking and debugging.
          type: string
        message:
          description: >-
            For some errors that could be handled programmatically, a short
            string indicating the error code reported.
          type: string
        type:
          description: >-
            The type of error returned. One of `api_error`,
            `invalid_request_error`
          enum:
            - api_error
            - invalid_request_error
          type: string
      required:
        - type
        - message
      title: Error
      type: object
  securitySchemes:
    OAuth2:
      description: OAuth 2.0 authorization and token endpoints
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          refreshUrl: /oauth/token
          scopes: {}
          tokenUrl: /oauth/token
        clientCredentials:
          refreshUrl: /oauth/token
          scopes: {}
          tokenUrl: /oauth/token
      type: oauth2

````