I have doing a blockchain Transaction using the ERC 4337 by leveraging the Alchemy's Account Kit and I am stuck on how exactly do I get the event or the return values of the transaction execution, the deploy method emits an event which helps me get the deployed contract address using the factory and also returns the deployed contract address, the data is not coming as a part of the receipt.
const uoHash = await provider.sendUserOperation({
target: '0x71239f16229A48a847C8761Cf92A1909bFfa5E0B',
data: encodeFunctionData({
abi: DocumentStoreCreatorABI,
functionName: 'deploy',
args: ['My Document Store']
})
});
console.log('uoHash', uoHash);
let txHash;
try {
txHash = await provider.waitForUserOperationTransaction(uoHash.hash);
} catch (e) {
console.log('e', e);
return;
}
console.log('txHash', txHash);
const receiptTx = await provider?.getUserOperationReceipt(txHash);
console.log('receiptTx', receiptTx);
const receipt = await provider?.getUserOperationReceipt(uoHash.hash);
console.log('receipt', receipt);
const tx = await provider?.getTransaction(txHash);
console.log('tx', tx);