I'm building a Safe app where the users can execute transactions with their Safe Wallets. I use viem to trigger the transaction, it correctly prompts the user to execute the transaction and after the user signs it and the transaction is complete, my app resumes correctly the rest of the function call.
Now, my problem is when the user decides to execute the transaction later and clicks on "add to batch", that action closes the safe execution window but doesn't return anything, my function gets stuck waiting to be resolved.
I'm doing a simple viem contract transaction, but I have no idea what I should do in order to intercept the "batch" action when the users selects it, so that I could react accordingly in the app.
This is the code:
const { request } = await client.simulateContract({
account,
address,
abi,
args,
functionName
});
const hash = await walletClient.writeContract(request);
Does anyone have any idea on this? Do I need to use the safe sdk to trigger the transactions in order to achieve this?