For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Bundler Client actions reference

These actions extend the Viem Bundler Client to support ERC-7710 utilities.

sendUserOperationWithDelegation​

Sends a user operationUser operation A pseudo-transaction object defined by ERC-4337 that describes what a smart account should execute. User operations are submitted to the alternate mempool managed by bundlers. with redeem permissions according to the ERC-7710 specifications.

info

To use sendUserOperationWithDelegation, the Viem Bundler Client must be extended with erc7710BundlerActions.

Parameters​

See the Viem sendUserOperation parameters. This function has the same parameters, except it does not accept callData.

Objects in the calls array also require the following parameters:

NameTypeRequiredDescription
delegationManagerAddressYesThe address of the Delegation ManagerDelegation Manager The ERC-7710 component that validates and redeems delegations, including signature checks and caveat enforcer hooks..
permissionContextPermissionContextYesAn encoded delegation chain (Hex) or a decoded delegation chain (Delegation[]) for redeeming permissions.

Example​

import { sessionAccount, bundlerClient, publicClient } from './client.ts'

// These properties must be extracted from the permission response.
const permissionContext = permissionsResponse[0].context
const delegationManager = permissionsResponse[0].delegationManager

// Calls without permissionContext and delegationManager will be executed
// as a normal user operation.
const userOperationHash = await bundlerClient.sendUserOperationWithDelegation({
publicClient,
account: sessionAccount,
calls: [
{
to: sessionAccount.address,
data: '0x',
value: 1n,
permissionContext,
delegationManager,
},
],
// Appropriate values must be used for fee-per-gas.
maxFeePerGas: 1n,
maxPriorityFeePerGas: 1n,
})