Showing
4 changed files
with
20 additions
and
37 deletions
... | @@ -4,6 +4,11 @@ | ... | @@ -4,6 +4,11 @@ |
4 | "lockfileVersion": 1, | 4 | "lockfileVersion": 1, |
5 | "requires": true, | 5 | "requires": true, |
6 | "dependencies": { | 6 | "dependencies": { |
7 | + "@types/node": { | ||
8 | + "version": "15.6.1", | ||
9 | + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz", | ||
10 | + "integrity": "sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==" | ||
11 | + }, | ||
7 | "accepts": { | 12 | "accepts": { |
8 | "version": "1.3.7", | 13 | "version": "1.3.7", |
9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", | 14 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", |
... | @@ -374,6 +379,11 @@ | ... | @@ -374,6 +379,11 @@ |
374 | "version": "1.1.2", | 379 | "version": "1.1.2", |
375 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", | 380 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", |
376 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" | 381 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" |
382 | + }, | ||
383 | + "ws": { | ||
384 | + "version": "7.4.6", | ||
385 | + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", | ||
386 | + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" | ||
377 | } | 387 | } |
378 | } | 388 | } |
379 | } | 389 | } | ... | ... |
... | @@ -13,7 +13,9 @@ | ... | @@ -13,7 +13,9 @@ |
13 | "author": "", | 13 | "author": "", |
14 | "license": "ISC", | 14 | "license": "ISC", |
15 | "dependencies": { | 15 | "dependencies": { |
16 | + "@types/node": "^15.6.1", | ||
16 | "express": "^4.17.1", | 17 | "express": "^4.17.1", |
17 | - "node-fetch": "^2.6.1" | 18 | + "node-fetch": "^2.6.1", |
19 | + "ws": "^7.4.6" | ||
18 | } | 20 | } |
19 | } | 21 | } | ... | ... |
1 | const express = require('express'); | 1 | const express = require('express'); |
2 | const app = express(); | 2 | const app = express(); |
3 | 3 | ||
4 | -const fetch = require('node-fetch'); | 4 | +app.get('/', function (req, res) { |
5 | -const api_key = '4h4PrjdPl04aplYHbM5xUK1xoGPffEfE';//Delete before commit API ddaro bonae jum. | 5 | + result = "" |
6 | - | 6 | + if(req.query.hi == "hi"){ |
7 | -const url = 'https://api.whale-alert.io/v1/status?api_key=' + api_key; | 7 | + result = "yes!" |
8 | -const options = {method: 'GET', headers: {Accept: 'application/json'}}; | ||
9 | - | ||
10 | -fetch(url, options) | ||
11 | - .then(res => res.json()) | ||
12 | - .then(json => console.log(json)) | ||
13 | - .catch(err => console.error('error:' + err)); | ||
14 | - | ||
15 | - | ||
16 | -const url2 = 'https://api.whale-alert.io/v1/transactions?api_key=' + api_key; | ||
17 | - | ||
18 | -function data_collector(data){ | ||
19 | - var ret = ''; | ||
20 | - var str = ''; | ||
21 | - for(var i = 0; i < data.transactions.length; i++){ | ||
22 | - str = '#' + (i+1)+' ChainName: '+data.transactions[i].blockchain+'\tAmount: '+data.transactions[i].amount+' USD' | ||
23 | - if(data.transactions[i].amount > 1000000){ | ||
24 | - str = '=====!WARNING!=====\n</br>' + str + '\n</br>=====!WARNING!=====' | ||
25 | - console.log(str) | ||
26 | } | 8 | } |
27 | else{ | 9 | else{ |
28 | - console.log(str) | 10 | + result = "no!" |
29 | - } | ||
30 | - ret += '</br>' + str; | ||
31 | } | 11 | } |
32 | - console.log(data.transactions) | 12 | + res.send(result) |
33 | - console.log(typeof(data.transactions)) | ||
34 | - return ret; | ||
35 | -} | ||
36 | - | ||
37 | -app.get('/', function (req, res) { | ||
38 | - fetch(url2, options) | ||
39 | - .then(res => res.json()) | ||
40 | - .then(json => res.send(data_collector(json))) | ||
41 | - .catch(err => console.error('error:' + err)); | ||
42 | }) | 13 | }) |
43 | 14 | ||
44 | var server = app.listen(23023) | 15 | var server = app.listen(23023) |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment