-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
77 lines (66 loc) · 1.74 KB
/
server.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const express = require('express');
const getBalanceAccount = require('./ethjs/getBalanceAccount');
const DAI = require('./test/DAI');
const daiToZkDai = require('./test/daiToZk');
const app = express()
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
app.get('/', (req,res) => {
res.send('ZkCompound')
})
app.get('/ethBalance', (req,res) => {
getBalanceAccount.getBalance(req.query.accountIndex, (bal) => {
res.send(bal);
})
})
app.get('/ethBalanceDai', (req,res) => {
DAI.getBalance(req.query.accountIndex, (bal) => {
res.send(bal);
})
})
app.get('/ethToDai', (req,res) => {
DAI.mintDAI(req.query.amount, req.query.eth, (txHash) => {
res.send(txHash);
})
})
app.get('/ethToDai2', (req,res) => {
DAI.mintDAI2(req.query.amount, (txHash) => {
res.send(txHash);
})
})
app.get('/daiToZkDai', (req,res) => {
daiToZkDai.convertToZk(req.query.amount, (note) => {
res.send(note);
})
})
app.get('/daiToZkDai2', (req,res) => {
daiToZkDai.convertToZk3(req.query.amount, (note) => {
res.send(note);
})
})
app.get('/ZkDaiTock', (req,res) => {
daiToZkDai.convertToZk2(req.query.amount, (note) => {
res.send(note);
})
})
app.get('/ZkDaiTock2', (req,res) => {
daiToZkDai.convertToZk4(req.query.amount, (note) => {
res.send(note);
})
})
app.get('/addDai', (req,res) => {
DAI.mintDAI(req.query.amount, (tx) => {
res.send(tx);
})
})
app.get('/recoverDAI', (req,res) => {
DAI.minDAI(req.query.amount, (tx) => {
res.send(tx);
})
})
app.listen(3000, () => {
console.log(`Server Started at 3000`);
})