- A slippage tolerance lets you set the maximum percentage difference you’re willing to accept between the estimated and actual swap amount, expressed in bps (for example, 100 bps = 1%).
- A stop limit lets you set the exact minimum amount you want to receive.
Prerequisites
Before you begin, ensure that you’ve: These are required so any example below runs with a validkit and adapter.
Set slippage tolerance
This example sets a slippage tolerance of 100 bps (1%):TypeScript
slippageBps as 100 as in the example, you’ll receive at least 99% of
the estimated amount. Meaning if the swap rate is 1 USDT to 1 USDC, you’ll
receive at least 0.99 USDC.
The
slippageBps default is 300 bps. 0 represents no tolerance, which
increases transaction failure rates.Set stop limit
stopLimit defines the minimum amount of the token type specified in tokenOut
that you’ll receive on a swap.
This example sets a stop limit of 0.95 USDC, meaning you won’t receive any less
than that on a swap:
TypeScript