Create a Wallet
Onboard your user with a few lines of code
Install
npm i @cometh/connect-sdk-4337 @viemyarn @cometh/connect-sdk-4337 @viemCreate a new wallet
import { createSafeSmartAccount,
createSmartAccountClient } from "@cometh/connect-sdk-4337";
import { http } from "viem"
const apiKey = process.env.COMETH_API_KEY;
const bundlerUrl = process.env.4337_BUNDLER_URL;
const publicClient = createPublicClient({
chain,
transport: http(),
cacheTime: 60_000,
batch: {
multicall: { wait: 50 },
},
});
const smartAccount = await createSafeSmartAccount({
apiKey,
publicClient,
chain,
});
const walletAddress = smartAccount.address
const smartAccountClient = createSmartAccountClient({
account: smartAccount,
chain,
bundlerTransport: http(bundlerUrl),
})

Connect to an existing connect wallet
Advanced signer configuration
Last updated