Skip to main content
Privy provides embedded wallets with email, OAuth, and external wallet login. Privy exposes an EIP-1193 provider via wallet.getEthereumProvider(), which you wrap with viem’s createWalletClient and feed to toStartaleSmartAccount as a signer.

Install

1. Wrap the app in PrivyProvider

providers.tsx

2. Build the smart account from the embedded wallet

useWallets() returns the connected wallets. Take the first one (typically the embedded wallet), pull its EIP-1193 provider, and wrap it with viem.
useStartaleFromPrivy.ts

3. Send a sponsored UserOperation

Common adjustments

toStartaleSmartAccount accepts an EIP-1193 provider as a signer too. You can skip createWalletClient if you do not need viem’s wallet methods elsewhere:
wallets may contain external wallets (MetaMask, Rabby) alongside the embedded wallet. Pick the one whose walletClientType matches your needs before building the signer.
Replace paymasterId with token in paymasterContext. See ERC-20 paymaster.

Next steps

Dynamic integration

The same flow with Dynamic as the auth provider.

Smart account setup

Lift the smart account into a context provider.

Smart sessions

Reduce signature friction with scoped session keys.

Social recovery

Add guardian-based key rotation.