Skip to content

Using a third-party paymaster

The SmartAccountClient within @alchemy/aa-core is unopinionated about which paymaster you use, so you can connect to any paymaster really simply. Configuration is done using the paymasterAndData config option when you call createSmartAccountClient.


import { createSmartAccountClient } from "@alchemy/aa-core";
import { sepolia } from "viem";
const chain = sepolia;
const client = createSmartAccountClient({
  transport: http("RPC_URL"),
  paymasterAndData: {
    // sets the dummy paymasterAndData with paymaster address appended with some dummy paymasterData
    // that looks like a valid paymasterData
    dummyPaymasterAndData: () =>
    paymasterAndData: async (userop, opts) => {
      // call your paymaster here to sponsor the userop
      // leverage the `opts` field to apply any overrides
      return {
        paymasterAndData: "0xresponsefromprovider",