Skip to content

Instantly share code, notes, and snippets.

@limone-eth
Created December 17, 2023 11:00
Show Gist options
  • Save limone-eth/15fa907a02e2c1f1158b9cbdbac3c15c to your computer and use it in GitHub Desktop.
Save limone-eth/15fa907a02e2c1f1158b9cbdbac3c15c to your computer and use it in GitHub Desktop.
Alchemy Webhook - Tracking Uniswap Pool events
# With Alchemy GraphQL Webhooks you can ingest real-time updates for every block
# in a reliable, scalable, and secure way!
#
# If you're new to GraphQL, this editor has autocomplete enabled and will magically
# suggest fields as you start typing. If you get lost, you can always search the
# available queries in the docs tab on the right!
#
# To get you started, here's a GraphQL query that will get you all log events for
# every new block. Each log also includes a full transaction receipt!
#
# For more example use cases & queries visit
# https://docs.alchemy.com/reference/custom-webhooks-quickstart
#
{
block {
# Block hash is a great primary key to use for your data stores!
hash,
number,
timestamp,
# replace the address below with the uniswap pool where your token is being swapped - pick the main one
logs(filter: {addresses: ["<insert_uniswap_pool_address_here>"], topics: []}) {
data,
topics,
index,
account {
address
},
transaction {
hash,
nonce,
index,
from {
address
},
to {
address
},
value,
gasPrice,
maxFeePerGas,
maxPriorityFeePerGas,
gas,
status,
gasUsed,
cumulativeGasUsed,
effectiveGasPrice,
createdContract {
address
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment