Overview

If you have account abstraction enabled on your global wallet, users will get a smart wallet created for them on login.

Custom Paymaster

If you need to use your own paymaster for a global wallet (smart wallet), you can do so by creating your own kernel client and interacting with it. If you are using the zerodev methods, make sure you have the @zerodev/sdk and @dynamic-labs/ethereum-aa packages as dependencies in your Global Wallets package.

Example

import { createKernelClient } from 'your-gw-wallet-package/zerodev';

const smartWallet = yourGlobalWallet.wallets[0];

const kernelClient = createKernelClient({
  wallet: smartWallet,
  paymaster: 'SPONSOR',
  paymasterRpc: 'https://some-paymaster-rpc.com',
});

const { account } = kernelClient;

  const hash = await kernelClient.sendUserOperation({
    account,
    callData: await account.encodeCalls([
      {
        data: encodeFunctionData({
          abi: contractABI,
          args: [primaryWallet.address],
          functionName: 'mint',
        }),
        to: contractAddress,
        value: BigInt(0),
      },
      {
        data: encodeFunctionData({
          abi: contractABI,
          args: [primaryWallet.address],
          functionName: 'mint',
        }),
        to: contractAddress,
        value: BigInt(0),
      },
    ]),
  })

  return hash