my code
const providerWs = new ethers.providers.WebSocketProvider('quicknode wss provider');
providerWs.on('pending', async (txHash) => {
try {
const transaction = await providerWs.getTransaction(txHash);
console.log(Date.now(), 'Listing', transaction?.blockNumber);
if (transaction != null && transaction['data'].includes(MethodID2) && transaction['data'].includes(snipeId)
|| transaction != null && transaction['data'].includes(MethodID) && transaction['data'].includes(snipeId)) {
console.log(Date.now(), 'Listing to our token', transaction?.blockNumber);
}
When I started to my code, mempool is working good but
1641227827544 Listing null
1641227828778 Listing null
1641228360201 Listing undefined
But, then listener is broken, although listener worked
/Users/user/Desktop/code/pance/node_modules/@ethersproject/providers/lib/websocket-provider.js:112 request.callback(null, result.result); ^
TypeError: Cannot read property 'callback' of undefined
I don't know why do I have an error.