Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get all SynthExchange events in the last 24hours using The Graph
const graphAPI = '';
const ts = Math.floor(;
const oneDayAgo = ts - (3600 * 24);
const response = await fetch(graphAPI, {
method: 'POST',
body: `{"query":"{synthExchanges(orderBy:timestamp, orderDirection:desc, where:{timestamp_gt: ${oneDayAgo}}){id,from,gasPrice,fromAmount,fromCurrencyKey,toCurrencyKey,block,timestamp,toAddress}}","variables":null}`
const json = await response.json();
const { synthExchanges } =;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.