I have the following problem and have hard time to simulate it to get the answer.
Let say I have a 5 WETH tokens.
I sent transaction X with nonce 1 to transfer 5 tokens from Account A to Account B. This Transaction is in the pending pool and not mined yet.
Now I create another transaction Y with nonce 2 to transfer 5 tokens from Account A to Account B.
I want to simulate the transaction Y before sending it. I'm using staticCall from etherjs v5/6 to do this.
Will the simulation of transaction Y:
- Succeed because at the current time I have 5 tokens (transaction X not mined yet)
- Fails with low nonce
- Fails with insufficient balance because it calculate and consider the pending transaction X
If the answer is 1 or 2 Are there some other ways, libraries or tools, which consider the related pending transactions when the simulation happen.
Update: If this is not Standardised between all provider. Then maybe using Infura as provider