test.js
1.3 KB
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
const express = require('express');
const app = express();
const fetch = require('node-fetch');
const api_key = '';//Delete before commit API ddaro bonae jum.
const url = 'https://api.whale-alert.io/v1/status?api_key=' + api_key;
const options = {method: 'GET', headers: {Accept: 'application/json'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));
const url2 = 'https://api.whale-alert.io/v1/transactions?api_key=' + api_key;
function data_collector(data){
var ret = '';
var str = '';
for(var i = 0; i < data.transactions.length; i++){
str = '#' + (i+1)+' ChainName: '+data.transactions[i].blockchain+'\tAmount: '+data.transactions[i].amount+' USD'
if(data.transactions[i].amount > 1000000){
str = '=====!WARNING!=====\n</br>' + str + '\n</br>=====!WARNING!====='
console.log(str)
}
else{
console.log(str)
}
ret += '</br>' + str;
}
console.log(data.transactions)
console.log(typeof(data.transactions))
return ret;
}
app.get('/', function (req, res) {
result = ""
if(req.query.hi == "hi"){
result = "yes!"
}
else{
result = "no!"
}
res.send(result)
})
var server = app.listen(23023)