Sign-Quote
After validating the firm quote, Native will request you to sign the quote, authorizing the swap for the approved amount. The sign quote endpoint must adhere to the following format:
Endpoint
Params
nonce
ID to prevent the transaction from being executed more than once. Incremental for each transaction by txOrigin
and pool
.
signer
Public address of the signer who will sign this order
seller
The address that will send the seller token to the 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 that will be sent to the market maker
buyerToken
The ERC20 token address that will be received from the market maker
chainId
Chain ID of the network (e.g., 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 firm-quote
. Used by the signer to verify the authenticity of the quote data. Native just relays the auth string from pricer to signer.
Example
In this example, a user requests to sign an order of 10,000 USDC for 10,100 USDT on Binance Smart Chain (BSC) to be transacted on the market maker's Native pool (0xaaE854bdd940cf402d79e8051DC7E3390e32A3ac
). The order must be signed by the signer (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
) for successful on-chain execution.
Order signing
Native uses EIP-712 signatures to ensure the order is endorsed only by the assigned signer. The inputs required to sign the order correspond to the data sent in the POST sign-quote
request. The code snippet below generates bytes encoded in hexadecimal to be returned in response to the POST /sign-quote
request.
Response
The response must be in the following format:
success
Indicates whether you can sign the firm quote (true/false)
signature
The signature from signing the EIP-712 order object
order
The order object that contains the order details, similar to Params
Example
In the response above, the market maker returns the generated signature and the corresponding order object to Native. With the signature, the customer can submit the transaction to execute the swap.
Note
The signature must start with
0x
and have a total of 132 characters.A full code sample for signing can be found here.
Congratulations! You have successfully integrated with Native and are now a Market Maker.
Last updated