Slippage
Slippage is the maximum price difference you’re willing to accept between the quoted rate and the executed rate. It protects against price movement during the time between quoting and on-chain execution.Choosing a slippage value
Pass slippage as a percentage (not a fraction) to the partner quote endpoint:
0 to 5. Up to 4 decimal places are supported (for example 0.5 or 1.25).
What happens when slippage is exceeded
The on-chain transaction reverts. You pay gas but no tokens are swapped and no tokens are lost. The user keeps their full balance.Quote and execution timing
The partner quote returns both the output and transaction. Pool and RFQ state can still change before confirmation. Best practice: A display quote may be shown while the user reviews, but request a fresh partner quote when they click “Swap” and execute it immediately.Handling reverts
If a swap transaction reverts on-chain, it’s usually one of these:Safe retry pattern
Gas on HyperEVM
The partner response returnsgas plus either legacy or EIP-1559 fee fields. Inspect tx.type and never submit both fee models.
Rate limiting
Partner limits are assigned with the API key. Confirm the production quota during onboarding. To stay within it:- Debounce quote requests — Don’t re-fetch on every keystroke. Do not cache executable responses in a CDN, service worker, or persistent store.
- Poll at reasonable intervals — For price feeds, 15–30 seconds is sufficient. Prices refresh every ~5 seconds on the backend.
- Batch token lookups — Use
GET /{chainId}/tokensto fetch all tokens in one call instead of fetching individually.
Approval best practices
- Use the returned target — Approve only the
allowanceTargetreturned by the partner quote; never assume one router address applies forever. - Prefer exact approval — Approving
sellAmountlimits exposure. Partners may choose a larger allowance only after their own security review. - Wait and refresh — After approval confirmation, request a new partner quote before swapping.
- Native tokens skip approval — HYPE (
0xeeee...eeee) doesn’t need approval. Skip the allowance check for native tokens.
Amounts and decimals
All amounts in the API are in wei (the token’s smallest unit). Each token has its owndecimals value.
Use viem’s
parseUnits and formatUnits to convert:
