useDisconnect
Description
This hook provides functionality for disconnecting from a smart account. It handles the disconnection process and manages related states, such as whether the process is pending or if an error occurred. The hook can execute both synchronously and asynchronously.
Returns
The useDisconnect
hook returns an object containing the following properties and functions:
disconnect (
() => void
): A synchronous function to disconnect from the smart account. It manages internal states such as pending and error states.disconnectAsync (
() => Promise<void>
): An asynchronous function to disconnect from the smart account, returning a promise. This function allows the use ofasync/await
syntax for handling the disconnection process.isPending (
boolean
): A boolean indicating whether the disconnection process is currently pending.error (
Error | null
): An error object if an error occurred during the disconnection process, otherwisenull
.
Example
Last updated