Developer Docs
Recipes
Viem

Usage With Viem

If you're using Viem (opens in a new tab), this is how you initialize WalletClient (opens in a new tab) with the embedded wallet's EIP-1193 (opens in a new tab) provider:

import { createWallet } from '@passkeys/core';
import { createWalletClient, custom } from 'viem';
import { mainnet } from 'viem/chains';
 
const wallet = createWallet({
  providers: {
    ethereum: true,
  },
});
 
async function getClient() {
  const provider = await wallet.getProvider('ethereum');
 
  const client = createWalletClient({
    chain: mainnet,
    transport: custom(provider),
  });
 
  return client;
}

Start building

Sign up to ship the simplest web3 onboarding solution.