Privy is an embedded wallet provider that simplifies user onboarding for dApps, enabling seamless authentication and key management.
By integrating Privy with Connect 4337, you can use Privy as a signer to create and manage smart wallets while using Connect 4337 gas sponsorship, batched transactions, and more.
Create the Privy provider
Follow Privy’s quickstart guide, to set up the Privy provider in your app.
import { PrivyProvider } from '@privy-io/react-auth';
import {WagmiProvider} from '@privy-io/wagmi';
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
import {createConfig} from '@privy-io/wagmi';
import { http } from "viem";
import { arbitrumSepolia } from "viem/chains";
const queryClient = new QueryClient();
const config = createConfig({
chains: [arbitrumSepolia],
transports: {
[arbitrumSepolia.id]: http(),
},
});
<PrivyProvider
appId={"<Privy-App-Id>"}
config={{
embeddedWallets: {
createOnLogin: "all-users",
},
}}
>
<QueryClientProvider client={queryClient}>
<WagmiProvider config={config}>
{children}
</WagmiProvider>
</QueryClientProvider>
</PrivyProvider>;
Integration
In your app, set Privy's embedded wallet as the active wallet for wagmi by using the useWallets react hook (after Privy login).