You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This is not a Bug Report, Feature Request, or related to Documentation
I have searched the existing issues
Is there an existing issue for this?
I have searched the existing issues
What's up?
I'm trying to make an RAW RPC call, it's working on my Network page I can see the request and the response, but the callback function of the web3.currentProvider.send method is returning error. I don't know why that's happening.
My code
const getTransactionFromTo = async () => {
let totalBlocks = await web3.eth.getBlockNumber();
let transactions = [];
for(let i = 0; i < 1; i++){
web3.currentProvider.send({
jsonrpc: "2.0",
id: 1,
method: "eth_getBlockRange",
params: ["0x" + (totalBlocks-10).toString(16), "0x" + totalBlocks.toString(16), true]
}, (err, res) => {
if (err) {
console.log(err)
console.log('res', res)
return;
}
const arrResult = res.result;
for(let i = 0; i < arrResult.length; i++){
let info = {};
let hour = new Date(arrResult[i].timestamp * 1000).getHours().toString();
info.hour = hour;
info.count = arrResult[i].transactions.length;
transactions.push(info);
}
resolve(transactions);
});
totalBlocks -= 1000;
}
};