Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

This guide is currently React only.

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 (see the dynamic-global-wallet repository for reference).

Example

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

// The wallet must be imported from your global wallet package
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