I am trying to listen to a UniSwap v3 Swap event but I get no response from the network. I am connected to polygon network via websocket and after firing up the listener I get no callbacks even though Polygonscan shows recent emitted events. I even log the active listeners and it shows "1".
Any thoughts?
Polygonscan address events: https://polygonscan.com/address/0x45dDa9cb7c25131DF268515131f647d726f50608#events UniSwap v3 documentation: https://docs.uniswap.org/protocol/reference/core/interfaces/pool/IUniswapV3PoolEvents#swap
const wsProvider = new ethers.providers.WebSocketProvider(WS_ALCHEMY);
const wallet = new ethers.Wallet(PRIVATE_KEY);
const signer = wallet.connect(wsProvider);
const address = "0x45dDa9cb7c25131DF268515131f647d726f50608";
const abi = "event Swap(address sender, address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)";
const contract = new ethers.Contract(address, [abi], signer);
contract.on("Swap", (sender: string, recipient: string, amount0: number, amount1: number, sqrtPriceX96: number, liquidity: number, tick: number) => {
console.log("asd");
});
console.log(contract.listenerCount("Swap"));