DocsOpen app
Docs · Build

Integrate

Give your own users gas in USDC with a few lines of permissionless.js.

With permissionless.js

Build the Safe with the user's wallet as owner and USDC approved to the paymaster, then send any user operation with the paymaster fields.

const account = await toSafeSmartAccount({
  client,                               // Elysium, chain 99901
  owners: [window.ethereum],            // any EIP-1193 wallet, or a passkey
  version: "1.4.1",
  entryPoint: { address: entryPoint07Address, version: "0.7" },
  setupTransactions: [{ to: USDC, value: 0n, data: approve(PAYMASTER, maxUint256) }],
})

await bundler.sendUserOperation({
  account,
  calls: [{ to, value: 0n, data }],
  paymaster: PAYMASTER,
  paymasterData: encodeAbiParameters([{ type: "uint256" }], [250_000n]), // max 0.25 USDC of gas
  paymasterVerificationGasLimit: 150_000n,
  paymasterPostOpGasLimit: 80_000n,
})

The staked factory

Bundlers require the first operation of an account that touches USDC to come from a staked factory (ERC-7562). Use the Pitstop factory in the initCode: createAccountFor(owner, salt) for a wallet, createAccount(x, y, salt) for a passkey. It builds the exact Safe permissionless.js builds, at the same address.