Connect 4337
Cometh ConnectCometh MarketplaceCometh Checkout
  • ๐Ÿš€Quick start
    • What is Connect 4337
    • Getting started
    • Supported Networks
  • ๐Ÿ› ๏ธCORE FEATURES
    • Create a Wallet
    • Send transactions
    • Go Gasless
    • Sign/Verify a message
    • Retrieve a wallet address
    • Handle owners
    • Import a safe into connect
  • ๐ŸฅทADVANCED
    • Session Keys
      • Tutorial
      • Policies
        • Sudo policy
        • Action policy
    • Social recovery
    • Add a passkey signer on a different OS
    • Capabilities
      • sendCalls
      • getCallsStatus
      • getCapabilities
      • grantPermissions
    • Other signers (Auth Providers)
      • EOA wallets (Metamask, Phantom...)
      • Magic signer
      • Web3Auth signer
      • Turnkey signer
      • Privy signer
  • ๐Ÿ”ŒIntegrations
    • React hooks
      • ConnectProvider
      • useAccount
      • useConnect
      • useDisconnect
      • useGetGasPrice
      • useSendTransaction
      • useSignMessage
      • useVerifyMessage
      • useWriteContract
      • Handle owners
        • useRemoveOwner
        • useValidateAddDevice
        • useCreateNewSigner
        • useAddOwner
        • useGetOwners/EnrichedOwners
      • Session Keys
        • useGrantPermission
        • useSendPermission
        • useSessionKeyClient
        • useSessionKeySigner
      • Recovery
        • useIsRecoveryActive
        • useSetUpRecovery
        • useGetRecoveryRequest
        • useCancelRecoveryRequest
    • Mobile SDKs
      • IOS
      • Android
      • React Native
    • Wagmi
  • SDK Core
    • Signers (Auth Providers)
      • EOA wallets (Metamask, Phantom...)
      • Magic signer
      • Web3Auth signer
      • Turnkey signer
      • Privy signer
    • Handle owners
    • Capabilities
      • sendCalls
      • getCallsStatus
      • getCapabilities
  • SDK Session Keys
    • Setup Smart Account Client
    • Manage session keys
    • Policies
      • Sudo policy
      • Action policy
  • ๐Ÿ“ฆBundler
    • Bundler API
      • eth_sendUserOperation
      • eth_estimateUserOperationGas
      • eth_getUserOperationByHash
      • eth_getUserOperationReceipt
      • eth_supportedEntryPoints
  • ๐Ÿ’ณPaymaster
    • Paymaster API
  • ๐Ÿ“–RESOURCES
    • Migrate from the connect legacy SDK
    • Connect Legacy SDKs (Unity, JS)
    • FAQ
Powered by GitBook
On this page
  • Create the Privy provider
  • Integration
  1. SDK Core
  2. Signers (Auth Providers)

Privy signer

PreviousTurnkey signerNextHandle owners

Last updated 1 month ago

is an embedded wallet provider that simplifies user onboarding for dApps, enabling seamless authentication and key management.

Create the Privy provider

Follow Privyโ€™s , 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

import { useWallets } from "@privy-io/react-auth";


const { wallets } = useWallets();
const embeddedWallet = wallets.find(
  (wallet) => wallet.walletClientType === "privy"
);

You will have access to a Privy signer object as shown below that you can pass as an owner to createSafeSmartAccount:

import {
    providerToSmartAccountSigner
} from "@cometh/connect-core-sdk";


if (!embeddedWallet) throw new Error("User does not have an embedded wallet");

const privyProvider = await embeddedWallet!.getEthereumProvider()
const signer = await providerToSmartAccountSigner(privyProvider);

In your app, set Privy's embedded wallet as the active wallet for wagmi by using the useWallets react hook (after).

Privy
quickstart guide
Privy login