Skip to main content

canSponsorUserOperation

Checks if a user operation can be sponsored by the configured paymaster. Works for both single transactions and batch transactions. This is useful to determine if the user will need to pay gas fees or if the operation qualifies for gas sponsorship.

Usage

Parameters

You must provide either a walletAccount or a kernelClient, but not both.

Returns

Promise<boolean> - Returns true if the user operation can be sponsored, false otherwise.

Examples

Single transaction with wallet account

Batch transaction

Using existing kernel client

Error handling

React

Use canSponsorUserOperation inside a button handler to conditionally show a “gasless” badge or adjust UI before sending:
Last modified on June 24, 2026