Respond with Self-Execution Quote
This mode enables users to request quotes that they can execute themselves. Upon request, solvers provide interaction details, in addition to quote amounts.
Request
Request from user for a quote.
{
'chain_id': 42161,
'msg_topic': 'taker_quote',
'msg_type': 'request',
'msg': {
'quote_id': 'dc8afe28-bc96-446e-a134-9e4de5704dc4',
'order_type': '121',
'base_settle_gas': 145000,
'approval_type': 'Standard',
'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 ignore this field for this mode.
Response
msg_topic
msg_topicAs per the request, the response msg_topic is taker_quote
msg
msgquote_id
quote_id As per the request.
amounts
amountsCalculate your quote for all tokens listed in buy_tokens and respond with amount in the response.
Respond with a list of TokenAmountResponse
class TokenAmountResponse:
address: str
amount: strfee
fee Must be "0" for self-execution mode.
executor
executor As opposed to gasless mode where the solver executes the order, in self-execution mode the executor is the taker. Respond with the address of taker from the request.
interactions
interactions The interactions of the solution, returned as a list of InteractionDetails .
The InteractionDetails are comprised of a data field, and a gas field which represents the gas cost of the InteractionData .
class InteractionDetails:
data: InteractionData
gas: int
class InteractionData:
result: bool
to: str
value: str
data: strBy default, the balance_recipient is the Jam Contract. The solvers can specify the recipient of the user's funds.
Example Response
{
'quote_id': 'ff3519e8-c7ef-4e3e-9b7b-615b26b4b12d',
'amounts': [
{
'address': '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
'amount': '388846147'
}
],
'fee': '0',
'executor': '0x5Bad996643a924De21b6b2875c85C33F3c5bBcB6',
'interactions': [
{
'data': {
'result': True,
'to': '0x5E325eDA8064b456f4781070C0738d849c824258',
'value': '0',
'data': '0x....0'
},
'gas': 264806
}
],
'balance_recipient': '0x5E325eDA8064b456f4781070C0738d849c824258'
}
Error Codes
In addition to a successful response, you may also return an error when the quote is unsuccessful.
unavailableUnavailable to provide quotes
not_supportedType of order or tokens not supported
gas_exceeds_sizeOrder size is too small to cover fee
unknownUnknown error
Example error response:
{
"chain_id": 137,
"msg_topic": "quote",
"msg_type": "error",
"msg": {
"quote_id": "1cb3301c-6bf6-4e70-be02-3838137ae2eb",
"error_type": "not_supported",
"error_msg": "token 0x00 not supported",
}
}Last updated