signer
field that contains a viem EIP1193Provider
for the Privy embedded wallet. It should then initialize a smart account, using the embedded wallet as a signer, and should return a Promise for a viem EIP1193Provider
for the smart account.The function should have the following type:
useEmbeddedSmartAccountConnector
hook from @privy-io/wagmi
. This hook allows you to register a smart account connector for wagmi that replaces the regular embedded wallet connector.
useEmbeddedSmartAccountConnector
hook to register a smart account connector with wagmi. As a parameter to the hook, pass an object with the following fields:
Field | Type | Description |
---|---|---|
getSmartAccountFromSigner | async ({signer}: {signer: EIP1193Provider}) => Promise<EIP1193Provider> | A function that takes an EIP1193Provider for the user’s embedded wallet and converts it to an EIP1193Provider for the smart account. This is the same function you implemented in step 1. |
useEmbeddedSmartAccountConnector
hook must be mounted at all times when using wagmi with
the smart account. We recommend calling the hook in a component close to the root of your
application.