Skip to content

Documentation / wagmi / useEmbeddedSmartAccountConnector

Function: useEmbeddedSmartAccountConnector()

useEmbeddedSmartAccountConnector(__namedParameters): void

Registers a smart account connector in wagmi for the Privy embedded wallet. As an argument, pass an object with a getSmartAccountFromSigner method that converts a viem EIP1193Provider object for the embedded wallet (EOA) to a viem EIP1193Provider object for the smart account implementation used by your app (e.g. Kernel, Safe, SimpleAccount, etc.).

Currently, this hook only supports:

  • creating a smart account connector for a Privy embedded wallet
  • using only the smart account connector if an embedded wallet exists. All other connectors (e.g. external wallets) will be removed while the user is using the embedded wallet.

Parameters

__namedParameters: useEmbeddedSmartAccountConnectorParams

Returns

void

Example

ts
useEmbeddedSmartAccountConnector({
  getSmartAccountFromSigner: async ({signer}: {signer: EIP1193Provider}) => {
     // Replace `eoaToSmartAccount` with logic that converts the `signer` for the user's
     // externally-owned account (EOA) to an `EIP1193Provider` object for the smart account
     // implementation of your choice
     return eoaToSmartAccount(signer);
  }
});