Skip to content

Documentation / react-auth / useCreateWallet

Function: useCreateWallet()

useCreateWallet(callbacks?): Object

Use this hook to create a privy wallet for a user, and to attach a callback after successful wallet creation.

Parameters

callbacks?: Object

callbacks.onError?: (error) => void

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

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

callbacks.onSuccess?: (wallet) => void

Callback that will execute once on a successful embedded wallet creation. This will run when createWallet is called manually, or when config.embeddedWallets.createOnLogin triggers an automatic wallet creation.

Param BaseConnectedWallet- the created wallet object

Returns

Object

createWallet - creates a privy wallet for the user.

createWallet

createWallet: (options?) => Promise<Wallet>

Parameters

options?: MouseEvent<any, any> | CreateWalletOptions

Returns

Promise<Wallet>