web3. JS how to monitor the specific contract interaction of pending status

Q & A of Denglian community 2022-05-14 13:31:16 阅读数:447

web3.webjsmonitorspecific
// Log monitoring of contracts :subscribe('logs');// Contract event monitoring :contract.events.myevent("...");

web3.js Inside, I use event monitoring or log to monitor specific contracts , But every time you monitor contract trading Events A after , Then I started the deal B Will be better than other people's transactions B Late confirmation 1-2 Block .

1, In trade B Inside , I set it up. gas I charge more than others 20% above .2, Others sometimes run away , Other people's events B Than monitoring events A Advance confirmation .

So it should be monitoring pending Contract event in status , But it seems that both methods I use can only set fromBlock block Number perhaps null.

Excuse me, boss ? How can I improve the handling of this demand ?

ps: I see that there is a following method , is this one? ? But I don't see the filter parameters for the contract .

web3.eth.subscribe('pendingTransactions')


Other answers 1:
版权声明:本文为[Q & A of Denglian community]所创,转载请带上原文链接,感谢。 https://netfreeman.com/2022/134/202205072101591873.html