Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/sdk/pnp/web/providers/aa-provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ transaction, you'll need to use the `BundlerClient` generated by the `AccountAbs
The Web3Auth instance provider can't be used for this, as it's a proxy provider designed to ensure
compatibility with your preferred signer package for basic operations.

The `BundlerClient.sendUserOperation` returns the UserOperation hash instead of transaction hash.
UserOperation hash is just keccak256 hash of the entire user operation. To retreive the tranaction
details, we need to use `waitForUserOperationReceipt`. The function will wait for the UserOperation
to be included in a block, and will return a full UserOperation, with the addition of entryPoint,
blockNumber, blockHash and transactionHash.

```ts
// Use the same accountAbstractionProvider we created earlier.
const bundlerClient = accountAbstractionProvider.bundlerClient!;
Expand All @@ -288,6 +294,13 @@ const userOperationHash = await bundlerClient.sendUserOperation({
},
],
});

// Retrieve user operation receipt
const receipt = await bundlerClient.waitForUserOperationReceipt({
hash: userOpHash,
});

const transactionHash = receipt.receipt.transactionHash;
```

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

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

const tx = await bundlerClient.sendUserOperation({
const userOpHash = await bundlerClient.sendUserOperation({
account: smartAccount,
calls: [
// Approve USDC on Sepolia chain for Pimlico's ERC 20 Paymaster
Expand All @@ -336,4 +349,11 @@ const tx = await bundlerClient.sendUserOperation({
},
],
});

// Retrieve user operation receipt
const receipt = await bundlerClient.waitForUserOperationReceipt({
hash: userOpHash,
});

const transactionHash = receipt.receipt.transactionHash;
```