Price or Quote
A price is the way to show live fees. Each quote counts against the open quote limits until its order is submitted or its
deadline passes. Prices skip those limits, so polling prices never counts against them. Before you decide when your app requests quotes, read Quote Limits.
Prerequisites
- A route identified from Route Discovery
Step 1: Get an Order Price
GET /v1/transit/orders/price
Send the parameters you will send with the quote, without permitSignature, permitDeadline, and responseFormat. Get Order Quote describes each parameter.
userAddressis optional and does not change the price, so you can show fees before your user connects a wallet.- Send the same
integratorFee,integratorFeeReceiver, anddistributorCodethat the quote will carry. They change the fees.
@paxoslabs/amplify-sdk, call client.transit.getOrderPrice with the same parameters.
nativeFee and pricedAt.
Step 2: Show the Fees
ShowamountOut, totalFees, and nativeFee on the same screen. totalFees is in the offer asset and nativeFee is in the source chain’s native token, and the order costs both amounts. Response Fields describes each field.
Your user can now see all three values before they ask to place the order.
Step 3: Keep the Price Current
A price is correct as of itspricedAt. Fees move with live liquidity and gas.
- Request a new price each time your user changes the amount, the route, or any other parameter.
- While the fee is on screen, refresh it on a timer set to the longest interval your users accept for a stale fee, and no shorter than 10 seconds. Stop the timer when the fee leaves the screen.
Step 4: Request a Quote
When your user is ready to place the order, request a quote and follow Order Submission. The quote’s fees can differ from the last price, so show the quote’s fees for your user to confirm. Your user confirms the order against the quote’s fees.Response Fields
A price has the same fields as a quote, withouttransaction and with two more. Understand the Response describes the shared fields.
Rate Limits
A price counts against the same rate limit as every other request, quotes included. Without an API key, each IP address has a lower limit, so send an API key when you poll prices in production. Every response carries three headers that show where you stand against the limit. Read them to slow your polling before a price is refused.
A refused price returns
429 with error.status RESOURCE_EXHAUSTED. Retry after the number of seconds in the Retry-After header.
Common Errors
A price is refused for the same reasons and with the same errors as a quote for the same order, apart from the open quote limits, which apply to quotes only. See Common Errors in Order Submission. A price refused with400, 403 or 404 means your user cannot place that order right now, so show the error in place of a fee. A 429 or 503 refuses only the price request: show fees as temporarily unavailable and retry after Retry-After (for 429) or with backoff (for 503), because the order itself may still be placeable.
Next Steps
Order Submission
Get quote calldata and submit the order when your user is ready.