Cometh
Cometh
  • 🚀Quick start
    • Cometh Documentation
    • 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

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).

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);
PreviousTurnkey signerNextHandle owners

Last updated 2 months ago