3

Is it possible to only subscribe to a specific contract for pendingtransactions using web3.eth.subscribe? The docs dont show any parameters besides a callback function, so the result shows all pending transactions not just for a contract address like LINK for example.

Regards

Chris S
  • 161
  • 1
  • 11

1 Answers1

0

You need to:

  1. use web3.eth.subscribe in order to get the list of tx hashes,
  2. feed the transaction hash to web3.eth.getTransaction to get the transaction object,
  3. inspect the resulting object via the to and input fields, which can be used to filter the specific contract & function.

More details here > https://ethereum.stackexchange.com/a/49431/89782

coccoinomane
  • 121
  • 4