Skip to content

waitForUserOperationTransaction

Attempts to fetch for UserOperationReceipt txMaxRetries amount of times, at an interval of txRetryIntervalMs milliseconds (with a multiplier of txRetryMultiplier) using the connected account.

Note: For more details on how to modify the retry configurations for this method, see the constructor parameters.

Usage

example.ts
import { smartAccountClient } from "./smartAccountClient";

const userOperationResult = await smartAccountClient.sendUserOperation({
  uo: {
    data: "0xCalldata",
    target: "0xTarget",
    value: 0n,
  },
});
 

const txHash = await smartAccountClient.waitForUserOperationTransaction({
  hash: userOperationResult.hash,
});

Returns

Promise<Hash>

A Promise containing the hash of the transaction the user operation was included in.

If txMaxRetries is exceeded without the user operation included in a block yet, this endpoint will throw an error. You should handle this by retrying with a higher fee and/or changing the retry configurations.

Parameters

hash: Hash

The hash of the user operation returned from sendUserOperation.