Firm-Quote

Receiving Firm Quote request

If our router decides to route to you, your server will receive a Firm Quote message via WebSocket in the following format:

{
  "messageType": "firmQuote",
  "message": {
      "quoteId": string, // This is a unique quote ID generated by Native
      "chainId": number, // 1 for ETH L1
      "baseTokenAddress": string, // Base token (the token the trader sells)
      "quoteTokenAddress": string, // Quote token (the token the trader buys)
      "baseTokenAmount": string, // In wei
      "seller": string, // The address that will send seller token to market maker
      "pool": string, // Native pool contract address that will execute this order
      
      // How much, in basis points, will be charged to you in fees if this order goes through.
      "feeBps": number,
      
      // Deadline UNIX timestamp passed by the user, you are free to accept, reject, or overwrite this request
      "quoteExpire": number,
      
      // <OPTIONAL> In wei, the amount that the market maker is allowed to borrow from native's credit pool
      "availableBorrowBalance": string
   }
}

Sending Firm Quote response

After receiving the Firm Quote message, you need to compute the quote you'd like to offer based on market conditions, internal balances, etc., and return it in the following format:

{
  "messageType": "quote",
  "message": {
    // Same as Firm Quote request
    "quoteId": string;
    "chainId": number, // 1 for ETH L1
    "baseTokenAddress": string,
    "quoteTokenAddress": string,
    
    // Amounts are in wei
    "baseTokenAmount": string,
    "quoteTokenAmount": string,

    // The unix timestamp when the quote expires, in seconds.
    "deadlineTimestamp": number,
    "isBorrowing": string // <OPTIONAL> boolean value to indicate whether you want to use native's credit pool
  }
}

Note:

  1. This transaction always involves the user selling the baseTokenAddress for the amount specified by baseTokenAmount and buying the quoteTokenAddress.

  2. The Native server will generally wait up to 500 milliseconds for a quote to be provided before the quote is flagged as invalid.

Last updated