web3.js
web3.js copied to clipboard
Methods that require to use .request in batch calls fail typescript
Same issue as: https://github.com/ChainSafe/web3.js/issues/3144
Description
To perform batch requests and add to batches we need to append
.request
on methods i.ebatch.add(web3.eth.getBlock.request(blockNumber));
I believe type definitions don't have this
.request
option specified as it fails.Expected behavior
Appending
.request
in batches should not throw type errors.Actual behavior
Description
To perform batch requests and add to batches we need to append
.request
on methods i.ebatch.add(web3.eth.getBlock.request(blockNumber));
I believe type definitions don't have this
.request
option specified as it fails.Expected behavior
Appending
.request
in batches should not throw type errors.Actual behavior
![]()
Versions
- web3.js: 2.0.0-alpha.1
- nodejs: 10.16.3
- browser: Chrome latest
- ethereum node: Metamask
same issue here cannot batch.add sendSignedTransaction:
batch.add(web3.eth.sendSignedTransaction.request(signedtxObjectApproval.rawTransaction .... gives ERROR: the property "request" does not exist on type PromiEvent
@Nilotaviano Thanks for sharing this issue.
I tried the following code with 1.5.2
version and was able to reproduce the error.
import Web3 from "web3";
const web3 = new Web3(Web3.givenProvider || "http://localhost:8545");
const batch = new web3.BatchRequest();
batch.add(web3.eth.getBlock.request(1));
The detail error is:
error TS2339: Property 'request' does not exist on type '{ (blockHashOrBlockNumber: BlockNumber): Promise<BlockTransactionString>; (blockHashOrBlockNumber: BlockNumber, returnTransactionObjects: boolean): Promise<...>; (blockHashOrBlockNumber: BlockNumber, callback?: (error: Error, block: BlockTransactionString) => void): Promise<...>; (blockHashOrBlockNumber: BlockNumber...'.
We will look into this further.
Thank you for looking into it, @nazarhussain!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.
Just chiming in to say that this is still a problem 👍
same issue here cannot batch.add sendSignedTransaction:
batch.add(web3.eth.sendSignedTransaction.request(signedtxObjectApproval.rawTransaction .... gives ERROR: the property "request" does not exist on type PromiEvent
same issue when i using web3.eth.call.request(trans, callback)
.
@nazarhussain when will there be a new update for this issue?
Also running into this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.
According to the workload we will plan this in some future sprints. FYI @jdevcs
While waiting for the issue to be resolved, here’s a workaround :
var batch = new web3.BatchRequest();
var getBlock: any = web3.eth.getBlock;
batch.add(getBlock.request("latest"));
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.