useConnect
Description
This hook allows you to initiate a connection to a smart account with optional parameters and can handle the process both synchronously and asynchronously.
Parameters
The useConnect
hook itself does not take parameters. However, the primary functions returned by the hook, connect
and connectAsync
, accept the following optional parameters:
Returns
connect (
(params?: ConnectParameters) => void
): Initiates the connection process. It accepts an optionalparams
object to specify connection details. It handles state changes for pending status and errors internally.connectAsync (
(params?: ConnectParameters) => Promise<void>
): An asynchronous function similar toconnect
, but returns a promise, allowing for usage withasync/await
syntax.isPending (
boolean
): A boolean value indicating whether the connection process is currently pending (true
) or not (false
).error (
Error | null
): An error object if an error occurred during the connection process, otherwisenull
.
Example
Last updated