-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery.js
53 lines (49 loc) · 1.08 KB
/
query.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// const axios = require('axios');
import axios from "axios";
const uniswapURL = "https://api.studio.thegraph.com/query/43306/gld-token-wallet-app/v0.0.1" ; // https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2
let minBlockV = 0
const query = `
query GetProtocol($minBlock: Int!) {
tokenTransfers(first: 5, orderBy: blockTimestamp, orderDirection: desc) {
id
from
to
value
transactionHash
blockNumber
blockTimestamp
}
_meta {
block {
number
}
}
}`
const query2 = `
{
tokenTransfers(first: 5, orderBy: blockTimestamp, orderDirection: desc) {
id
from
to
value
transactionHash
blockNumber
blockTimestamp
}
}
`
const main = async () =>{
try {
const result = await axios.post(
uniswapURL,
{
query:query,
variables: {minBlock: minBlockV}
}
);
console.log ("Query result: \n", result.data.data);
} catch (err){
console.log(err);
}
}
main()