Skip to content

Commit 79a0818

Browse files
authored
Merge pull request #944 from Web3Auth/aa-provider
2 parents 0a1c801 + e36a866 commit 79a0818

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/sdk/pnp/web/providers/aa-provider.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ transaction, you'll need to use the `BundlerClient` generated by the `AccountAbs
266266
The Web3Auth instance provider can't be used for this, as it's a proxy provider designed to ensure
267267
compatibility with your preferred signer package for basic operations.
268268

269+
The `BundlerClient.sendUserOperation` returns the UserOperation hash instead of transaction hash.
270+
UserOperation hash is just keccak256 hash of the entire user operation. To retreive the tranaction
271+
details, we need to use `waitForUserOperationReceipt`. The function will wait for the UserOperation
272+
to be included in a block, and will return a full UserOperation, with the addition of entryPoint,
273+
blockNumber, blockHash and transactionHash.
274+
269275
```ts
270276
// Use the same accountAbstractionProvider we created earlier.
271277
const bundlerClient = accountAbstractionProvider.bundlerClient!;
@@ -288,6 +294,13 @@ const userOperationHash = await bundlerClient.sendUserOperation({
288294
},
289295
],
290296
});
297+
298+
// Retrieve user operation receipt
299+
const receipt = await bundlerClient.waitForUserOperationReceipt({
300+
hash: userOpHash,
301+
});
302+
303+
const transactionHash = receipt.receipt.transactionHash;
291304
```
292305

293306
### Send transaction using ERC-20 Paymaster
@@ -314,7 +327,7 @@ const usdcAddress = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
314327

315328
const amount = ethers.parseEther("0.00001");
316329

317-
const tx = await bundlerClient.sendUserOperation({
330+
const userOpHash = await bundlerClient.sendUserOperation({
318331
account: smartAccount,
319332
calls: [
320333
// Approve USDC on Sepolia chain for Pimlico's ERC 20 Paymaster
@@ -336,4 +349,11 @@ const tx = await bundlerClient.sendUserOperation({
336349
},
337350
],
338351
});
352+
353+
// Retrieve user operation receipt
354+
const receipt = await bundlerClient.waitForUserOperationReceipt({
355+
hash: userOpHash,
356+
});
357+
358+
const transactionHash = receipt.receipt.transactionHash;
339359
```

0 commit comments

Comments
 (0)