Respond with Gasless Quote

Request

Request from user for a quote.

{
 'chain_id': 42161,
 'msg_topic': 'quote',
 'msg_type': 'request',
 'msg': {
   'quote_id': 'dc8afe28-bc96-446e-a134-9e4de5704dc4',
   'order_type': '121',
   'base_settle_gas': 145000,
   'approval_type': 'Permit2',
   'taker': '0x43c33c2e0f3E076793f51028D80a490b3BEb4C09',
   'receiver': '0x43c33c2e0f3E076793f51028D80a490b3BEb4C09',
   'expiry': 1734441089,
   'exclusivity_deadline': 1734441089,
   'nonce': '293151850998689970227469782035377180100',
   'slippage': 0.1,
   'hooks_data': '0x',
   'partner_info': '0',
   'sell_tokens': [
     {
       'address': '0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40',
       'amount': '83649370402483',
       'usd_price': 106695.0
     }
    ],
    'buy_tokens': [
      {
        'address': '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
        'amount': None,
        'usd_price': 3999.2
      }
    ],
    'native_token_price': 3999.2
  }
}

base_settle_gas is an estimate amount of gas the execution will use excluding any interactions. You may use this value as a basis for your fee calculation in the response.

Response

To respond to the quote, calculate your quote for all tokens listed in buy_tokens and respond with amounts in the response.

fee should indicate the expected gas fee in the native token for executing this swap.

executor should indicate the address that will execute the transaction for this quote on chain.

{
  "chain_id": 42161,
  "msg_topic": "quote",
  "msg_type": "response",
  "msg": {
    "quote_id": "1cb3301c-6bf6-4e70-be02-3838137ae2eb",
    "amounts": [
      {
        "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
        "amount": "1737694132774949632"
      }
    ],
    "fee": "51719193857400000",
    "executor": "0x0"
  }
}

Error Codes

In addition to a successful response, you may also return an error when the quote is unsuccessful.

Error
Descriptions
unavailable

Unavailable to provide quotes

not_supported

Type of order or tokens not supported

gas_exceeds_size

Order size is too small to cover fee

unknown

Unknown error

Example error response:

{
  "chain_id": 137,
  "msg_topic": "quote",
  "msg_type": "error",
  "msg": {
    "quote_id": "1cb3301c-6bf6-4e70-be02-3838137ae2eb",
    "error_type": "notsupported",
    "error_msg": "token 0x00 not supported",
  }
}

Last updated