MetaMask / test-dapp

The sample dapp used for e2e testing and metamask-extension QA
https://metamask.github.io/test-dapp/
MIT License
596 stars 349 forks source link

Implement batch transactions #18

Open rekmarks opened 4 years ago

rekmarks commented 4 years ago

We should add batch transaction functionality to the test dapp, for testing.

We should follow this: https://codesandbox.io/s/metamask-batchrequest-bug-demo-emnph

Zipped: metamask-batchrequest-bug-demo.zip

Contract on Rinkeby: https://rinkeby.etherscan.io/address/0xfac5d594548b1ab5fb724d8011187ec51919b92e#code

Context: https://github.com/MetaMask/metamask-extension/issues/5852#issuecomment-546554364

danjm commented 3 years ago

We will have to use ethers.providers.JsonRpcBatchProvider

It is not well documented, but as far as I can tell from the discussion here https://github.com/ethers-io/ethers.js/issues/62#issuecomment-872900726, the provider can be instantiated the way the ethers provider is within the current test dapp code.

Then you can create multiple transactions as is done in the example here: https://ethereum.stackexchange.com/a/77169

But instead of awaiting each of them, create them all and then await a Promise.all

david0xd commented 3 years ago

@danjm During the refinement we made a conclusion that the best approach to achieve this is to create a new button on the test-dapp which will call wrapped function that will perform few transactions in a batch which will target our deployed smart contract.

AC:

Couple of arguments for the proposal is:

danjm commented 2 years ago

This proposal sounds good to me. Are there any other blockers to this?

EHaracic commented 2 years ago

Blocked by PR: https://github.com/MetaMask/test-dapp/issues/137

david0xd commented 2 years ago

Because of limitation of ethers library we've decided to integrate web3 library into the test-dapp. Web3 library with its functionality will make batch transactions possible. This can be continued when https://github.com/MetaMask/test-dapp/pull/146 gets merged.