Swap
Usage
The Swap
component allows users to exchange tokens seamlessly.
Swap
Sell
Buy
Props
Swap
Prop | Type | Description |
---|---|---|
children | React.ReactNode | The child components of the Swap container. |
className? | string | Optional additional class names. |
SwapToken
Prop | Type | Description |
---|---|---|
swapableTokens | SwapableTokens[] | List of tokens available for swapping. |
label | string | Label for the SwapToken (e.g., "Sell", "Buy"). |
type | "from" | "to" | Defines whether it's a "from" or "to" swap token field. |
SwapButton
Prop | Type | Description |
---|---|---|
onSwap | function | Callback function triggered when the swap button is clicked. |
className? | string | Optional additional class names. |
({
from: SwapableTokens | undefined,
to: SwapableTokens | undefined,
swapAmount: number,
balanceResponse: {
balance: string;
error: string;
response: UseReadContractReturnType;
}
}) => void;