permissionless
, and viem
libraries:config.embeddedWallets.createOnLogin
property of your PrivyProvider
to 'users-without-wallets'
.This will configure Privy to create an embedded wallet for users logging in via a web2 method (email, phone, socials), ensuring that all of your users have a wallet that can be used as an EOA.Your PrivyProvider
should then look like:useWallets
hook, and get its EIP1193 provider. You can find embedded wallet by finding the only entry in the useWallets
array with a walletClientType
of 'privy'
.provider
to the providerToSmartAccountSigner
method from permissionless
to create a SmartAccountSigner
. This signer corresponds to the user’s embedded wallet and authorizes actions for the user’s smart account.smartAccountSigner
from above, initialize a Kernel (ZeroDev) smart account for the user like so:kernelClient
is a drop-in replacement for a viem
Wallet Client, and requests to the smart account can be made using viem
’s API.sendTransaction
method.sendTransaction
method, and will automatically apply any smart account configurations (e.g. gas sponsorship) you configure in the middleware
before sending the transaction.That’s it! You’ve configured your app to create smart wallets for all of your users, and can seamlessly add in AA features like gas sponsorship, batched transactions, and more. 🎉