TransWikia.com

Typechain and Batch Requests

Ethereum Asked by slider on December 2, 2020

I’m trying to send a batch request of transactions to my contract from web3. Using Typechain, my contract’s methods are of type NonPayableTransactionObject<void>, which doesn’t appear to support typing for that pesky .request method required of batch.add(). For example…

let batch = new web3.eth.BatchRequest();
for (let id of tokenIDs) {
    batch.add(myContract.methods.myMethod(id).send.request({ from: defaultAccount })   
}
batch.execute();

This produces Property 'request' does not exist on type '(tx?: NonPayableTx | undefined) => PromiEvent<TransactionReceipt>'.ts(2339).

Is there another way of sending transactions to a contract via Batch Request using Typescript/Typechain?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP