-
Notifications
You must be signed in to change notification settings - Fork 22
/
flash.html
39 lines (39 loc) · 1.25 KB
/
flash.html
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
<!DOCTYPE html>
<html>
<body>
<h1>Flash</h1>
<pre id="log" style="width:100%;height:200px"></pre>
<script type="text/javascript">
function log(logstr) {
document.getElementById("log").innerHTML +=logstr+"\n";
}
async function f() {
const query=`
{
flashLoans(first: 10, orderBy: timestamp, orderDirection: desc) {
id
reserve {
name
symbol
}
amount,
target,
timestamp
}
}
`
const URL = 'https://api.thegraph.com/subgraphs/name/aave/protocol';
let body = JSON.stringify({query: query});
var res=await fetch(URL, {
method: 'post',
headers: {'Content-Type': 'application/json'},
body: body
})
var json=await res.json()
for (const flashsloan of json.data.flashLoans)
log(JSON.stringify(flashsloan) )
}
f();
</script>
</body>
</html>