Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Getting error in Batch request #6224

@alison84r

Description

@alison84r

web3.eth.getBlock.request

I am getting error in batch request.
" web3.eth.getBlock.request is not a function"

My Implementation:

`async function checkTransactionCount(startBlockNumber, endBlockNumber) {
const batch = new web3.BatchRequest();
const transactions = [];

for (let i = startBlockNumber; i <= endBlockNumber; i++) {
const request = web3.eth.getBlock(i, function(error, block) {
if (block != null && block.transactions != null && block.transactions.length !== 0) {
transactions.push(...block.transactions);
}
});
batch.add(request);
}

await batch.execute();

return transactions;
}`

my version of web3 is 4.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions