CDP Frontend SDK
    Preparing search index...

    Function sendUserOperation

    • Sends a user operation from a smart account.

      Parameters

      • options: SendUserOperationOptions

        The options for sending the user operation.

        Request parameters for sending a user operation.

        • evmSmartAccount: EvmAddress

          The EVM Smart Account to send the user operation with.

        • network: SendEvmTransactionWithEndUserAccountBodyNetwork

          The network to send the user operation on.

        • calls: EvmCall[]

          The calls to make from the user operation.

        • OptionaluseCdpPaymaster?: boolean

          Whether to use the CDP Paymaster for the user operation.

        • OptionalpaymasterUrl?: string

          The URL of the paymaster to use for the user operation. Get your free Base paymaster URL from the CDP Portal.

      Returns Promise<SendUserOperationResult>

      Promise that resolves to the user operation hash.

      const user = await getCurrentUser();
      const smartAccount = user?.evmSmartAccounts[0];

      const result = await sendUserOperation({
      evmSmartAccount: smartAccount,
      network: "base-sepolia",
      calls: [{
      to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      value: 0n,
      data: "0x",
      }],
      });
      console.log("User Operation Hash:", result.userOperationHash);