Skip to content

Documentation / react-auth / useConnectWallet

Function: useConnectWallet()

useConnectWallet(callbacks?): Object

Use this hook to connect the user's external wallet, and to attach callbacks after a user successfully connects their wallet, or if there is an error during the connection attempt.

Parameters

callbacks?: Object

callbacks.onError?: CallbackError

Callback that will execute in the case of a non-successful wallet connection.

Param [PrivyErrorCode]([object Object]) - the corresponding error code

callbacks.onSuccess?: (wallet) => void

Callback that will execute once a successful connectWallet completes. This will not run in the case of a wallet-based authentication or link flow.

Param [BaseConnectedWallet]([object Object]) the wallet object correspending to the connection

Returns

Object

connectWallet - opens the Privy modal and prompts the user to connect an external wallet

connectWallet

connectWallet: (options?) => void

Parameters

options?: Object

options.suggestedAddress?: string

Returns

void