import dotenv from "dotenv";
import { parseEther } from "viem";
import { CdpClient } from "@coinbase/cdp-sdk";
dotenv.config();
const cdp = new CdpClient({
apiKeyId: process.env.CDP_API_KEY_ID,
apiKeySecret: process.env.CDP_API_KEY_SECRET,
walletSecret: process.env.CDP_WALLET_SECRET,
});
const account = await cdp.evm.createAccount();
const smartAccount = await cdp.evm.createSmartAccount({
owner: account,
});
const userOperation = await cdp.evm.sendUserOperation({
smartAccount: smartAccount,
network: "base-sepolia",
calls: [
{
to: "0x0000000000000000000000000000000000000000",
value: parseEther("0"),
data: "0x",
},
],
paymasterUrl: "https://some-paymaster-url.com",
});
console.log("User Operation Result:", userOperation);