Can anybody suggests the way to retrieve an Uniswap pair sell or buy transactions, filtering the events logs. I know, it's possible to monitor an token transfers continuously scanning token Transfer events, while websocket connecting. Also, another option to achieve pair transactions is using thegraph and it's not accept an wss connection (subscription). As I understand, it needs to monitor an Swap event. It's not clear all technical details, but rather only partly.
1 Answer
Uniswap V3 emits a Swap event
/// @notice Emitted by the pool for any swaps between token0 and token1
/// @param sender The address that initiated the swap call, and that received the callback
/// @param recipient The address that received the output of the swap
/// @param amount0 The delta of the token0 balance of the pool
/// @param amount1 The delta of the token1 balance of the pool
/// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
/// @param liquidity The liquidity of the pool after the swap
/// @param tick The log base 1.0001 of price of the pool after the swap
event Swap(
address indexed sender,
address indexed recipient,
int256 amount0,
int256 amount1,
uint160 sqrtPriceX96,
uint128 liquidity,
int24 tick
);