Created
July 3, 2019 21:37
-
-
Save jjgonecrypto/eebcb7430a79c1cffb3377de3e71f1a5 to your computer and use it in GitHub Desktop.
Get all SynthExchange events in the last 24hours using The Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const graphAPI = 'https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix'; | |
| const ts = Math.floor(Date.now()/1e3); | |
| 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 } = json.data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment