Sign-Quote
After we validate the firm quote, we will ask you to sign the quote to give permission for the swapper for the approved amount. The sign quote endpoint provided must adhere to the following format:
Sign Quote Endpoint
Params
Name | Description |
---|---|
nonce | ID to prevent transaction to be executed more than once. Incremental for each transaction by txOrigin and pool. |
signer | Public address of the signer that will sign this order. |
seller | The address that will send seller token to market maker. |
buyer | Native pool contract address that will execute this order. |
sellerTokenAmount | The token input amount of the order. In wei. |
buyerTokenAmount | The token output amount of the order. In wei. Can be modified by the signer to determine the final output amount. |
sellerToken | The ERC20 token address will be sent to market maker. |
buyerToken | The ERC20 token address will receive from market maker. |
chainId | Chain ID of the network. In integer. eg: 1 for Ethereum, 56 for BSC. |
deadlineTimestamp | The expiration time of the order, in block timestamp. Can be modified by the signer to determine the expiration time. |
txOrigin | Address of the trader who initiated the order. |
quoteId | Unique ID for this order request in UUID v5. |
auth | The auth string received from get-quote. Can be used by the signer to verify the authenticity of the quote data. Signer and pricer can decide what auth protocol to use. Native just relay the auth string from pricer to signer. |
Example body
In this example, a user requests to sign an order of 10,000 USDC to 10,100 USDT on Binance Smart Chain (BSC) to be transacted on market maker's Native pool (0xaaE854bdd940cf402d79e8051DC7E3390e32A3ac). The order has to be signed by the signer (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) to be successfully executed on-chain.
Order signing
Native utilises EIP-712 signature to ensure the order is endorsed only by the assigned signer. The inputs required to sign the order corresponds to the data sent in POST sign-quote above. The code snippet below generates bytes encoded in hexdecimal to be returned in response for the POST /sign-quote request.
Response
You need to provide a response in the following format:
Name | Description |
---|---|
success | Indicates true or false, whether you can sign the firm-quote. |
signature | The signature from signing the EIP712 order object. |
order | The order object that contains the order |
Example response:
In the response above, market maker returns the signature generated and the corresponding order object to Native. With the signature customer can submit the transaction to execute the swap.
Note that the signature must start with 0x
with 132 total characters.
Full code sample for signing can be found here.
Success!
Congratulations! You've successfully integrated with Native and you're now a Market Maker 🥳
Last updated