I'm currently trying to listen to contract events from a contract address but on pending transactions. But I only got confirmed transaction on the instead of pending. Here my code
let subscription = web3.eth.subscribe("logs", {
fromBlock: "pending",
address: ["0x0eD7e52944161450477ee417DE9Cd3a859b14fD0"],
topics: [],
});
subscription.on("data", async (event) => {
const tx = await web3.eth.getTransaction(event.transactionHash);
console.log("tx", tx); //this is confirmed transaction because it has block number in it
});
How to listen events only for pending transactions ?