0

I have this, in ethers.js, where provider is a WebSocketProvider connected to a full node, which is working fine for getting the tx's (quite a lot of them per second):

provider.on('pending', async (txhash) => {
    console.log(`pending tx ${txhash}`);
    const tx = await provider.getTransaction(txhash);
    console.log(tx);
    const resp = await provider.call(tx);
    console.log(resp);
});

call works for return values, but I want to be able to get events from pending transactions in the mempool, as if they are ran at the top of the block.

I also have hardhat, but I'm having a hard time with this use case because I want to keep up with incoming blocks and also simulate each transaction independently (not affecting each other).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.