Hook for opening the swap modal
UseSwapModalReturnType
(settings: SwapModalSettings) => void
Function to open the Swap modal with the specified settings.
Parameters:
The settings
object can include the following properties:
Parameter | Type | Description |
---|---|---|
chainId | number | Blockchain network ID where the swap will occur |
toTokenAddress | string | Address of the target token contract |
toTokenAmount | string | Amount of the target token in smallest units |
postSwapTransactions | Array<{to: string, data: string}> | (Optional) Transactions to execute after the swap completes |
disableMainCurrency | boolean | (Optional) If true, disables swapping using the main currency of the chain |
title | string | (Optional) Custom title for the swap modal |
description | string | (Optional) Custom description for the swap modal |
onSuccess | () => void | (Optional) Callback when swap is successful |
onError | (error: Error) => void | (Optional) Callback when an error occurs |
onClose | () => void | (Optional) Callback when the modal is closed |
blockConfirmations | number | (Optional) Number of block confirmations to wait for the swap to complete |
() => void
Function to close the Swap modal.
SwapModalSettings | undefined
The current settings configuration for the Swap modal.