Privy signer
Privy is an embedded wallet provider that simplifies user onboarding for dApps, enabling seamless authentication and key management.
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).
You will have access to a Privy signer object as shown below that you can pass as an owner to createSafeSmartAccount:
Last updated