Skip to main content

showSwap

Function to open the Swap interface using the Wallet Services Plugin.

Usage

await web3auth.showSwap({
show: true,
}); // Opens the Swap Modal

Parameters

NameTypeDescription
showbooleanControls whether the Swap UI is visible. Set to true to display the Swap interface, or false to hide it.
fromToken?stringSpecifies the token being swapped from. Optional field.
toToken?stringSpecifies the token being swapped to. Optional field.
fromValue?stringThe amount of the fromToken to be swapped. Optional field.
toAddress?stringThe 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.