showSwap
Function to open the swap interface using the Wallet Services plugin.
info
Please note that this function doesn't work for external wallet logins. It only works for social login embedded wallets.
Usage
await web3auth.showSwap({
show: true,
}) // Opens the Swap Modal
Parameters
| Name | Type | Description |
|---|---|---|
show | boolean | Controls whether the swap UI is visible. Set to true to display the swap interface, or false to hide it. |
fromToken? | string | Specifies the token being swapped from. Optional field. |
toToken? | string | Specifies the token being swapped to. Optional field. |
fromValue? | string | The amount of the fromToken to be swapped. Optional field. |
toAddress? | string | The recipient's address for the toToken. Optional field. |
Return type
Promise<void>
The function returns a Promise that resolves when the swap modal is successfully displayed.