I have a dapp that, as part of one logical user operation, must issue an approve() call on a token contract followed by a call to another contract that will use the funds. Since these each require user-authorization I have to issue them at about the same time. Some options that I can see include:

  1. Submitting both sequentially but as fast as possible (the nonce will keep them ordered).
  2. Chaining (waiting) on the approve tx until I get its transaction hash and then submitting the transfer tx.
  3. Chaining as in #2 but introducing a short artificial delay between submissions.
  4. Using the batch API?

I am currently doing #2 (chaining). The effect that I see is that normally the user gets two popups to confirm and it is fine. (I have seen Metamask combine them into one dialog sometimes but I don’t know what triggered this - timing related?). The problem is that occasionally this just seems to fail and one of the transactions is never presented to the user. I’ve had reports of this happening on multiple platforms and in multiple wallets.

Is this what #4 (the batch API) is for? I did some experiments with it but it appeared to me that no one was using this API and it was a bit dated. I was concerned about how well supported it was in various wallets and I wasn’t sure it actually helped the issue.

EDIT: Another issue that may rule out the batch API is that it does not appear to provide a way to get the transaction hashes for the submitted transactions, making it impossible to monitor them properly.


1 Answer 1


I'm not sure it's a best practice, but I think I would incline to #2 in order to simplify exception handling. It's important to back out the approve appropriately in the case that doesn't mine, or the next transaction doesn't mine.

You can reduce the pop-ups with EIP-1102 which is definitely recommended. In summary, the dApp is approved instead of discrete transactions and that is more intuitive for users.

There is a how-to document for EIP-1102 over here: https://status.im/developer_tools/run_on_status/eip-1102.html

Hope it helps.

  • Thanks for the comment - two things: 1) In editing my question I broke my numbered references... meant to say that I was using #2 (chaining). 2) I'm not sure that EIP-1102 helps me here - What I meant by "approval" was not the dapp connection (which does only happen once for new users) but an ERC20 token contract approval call. So I definitely have two user approvals for this (one for the token contract and one for my contract) and I'm hoping to consolidate them somehow. Thanks! Jan 29, 2020 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.