Skip to content

Commit

Permalink
docs: add swap router information (#1919)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessey authored Feb 4, 2025
1 parent 26643de commit c6e1b22
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
8 changes: 7 additions & 1 deletion site/docs/pages/buy/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ type BuyReact = {
maxSlippage: number; // Maximum acceptable slippage for a swap (e.g., 3 for 3%). This is a percentage, not basis points.
};
experimental?: {
useAggregator: boolean; // Whether to use a DEX aggregator. (default: false)
/**
* Whether to use a DEX aggregator.
* true - 0x Aggregator
* false - Uniswap V3
* @default false
*/
useAggregator: boolean;
};
isSponsored?: boolean; // An optional setting to sponsor swaps with a Paymaster. (default: false)
onError?: (error: SwapError) => void; // An optional callback function that handles errors within the provider.
Expand Down
9 changes: 9 additions & 0 deletions site/docs/pages/swap/swap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ export default function SwapComponents() {
The swap will execute and work out of the box when you implement the component in your own app.
:::

### Supported Swap Routers

The `Swap` component supports two swap routers:

- [Uniswap V3](https://app.uniswap.org/) (default)
- [0x Aggregator](https://0x.org/)

To use the 0x Aggregator, set the `experimental.useAggregator` prop to `true`.

### Sponsor gas with Paymaster

To sponsor swap transactions for your users, toggle the Paymaster using the `isSponsored` prop.
Expand Down
8 changes: 7 additions & 1 deletion site/docs/pages/swap/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ type SwapReact = {
maxSlippage: number; // Maximum acceptable slippage for a swap (e.g., 3 for 3%). This is a percentage, not basis points;
};
experimental?: {
useAggregator: boolean; // Whether to use a DEX aggregator. (default: false)
/**
* Whether to use a DEX aggregator.
* true - 0x Aggregator
* false - Uniswap V3
* @default false
*/
useAggregator: boolean;
};
isSponsored?: boolean; // An optional setting to sponsor swaps with a Paymaster. (default: false)
onError?: (error: SwapError) => void; // An optional callback function that handles errors within the provider.
Expand Down

0 comments on commit c6e1b22

Please sign in to comment.