tornado-relayer/src/status.js

36 lines
926 B
JavaScript
Raw Normal View History

const queue = require('./queue')
2020-10-06 14:20:26 +03:00
const { netId, tornadoServiceFee, miningServiceFee, instances, redisUrl, rewardAccount } = require('./config')
const { version } = require('../package.json')
2020-10-06 14:20:26 +03:00
const Redis = require('ioredis')
const redis = new Redis(redisUrl)
2020-09-28 05:28:34 +03:00
async function status(req, res) {
2020-10-06 14:20:26 +03:00
const ethPrices = await redis.hgetall('prices')
2020-09-28 05:28:34 +03:00
res.json({
2020-10-06 14:20:26 +03:00
rewardAccount,
instances: instances[`netId${netId}`],
2020-09-28 05:28:34 +03:00
netId,
ethPrices,
2020-10-05 20:15:18 +03:00
tornadoServiceFee,
miningServiceFee,
2020-09-28 05:28:34 +03:00
version,
})
}
function index(req, res) {
res.send(
'This is <a href=https://tornado.cash>tornado.cash</a> Relayer service. Check the <a href=/v1/status>/status</a> for settings',
)
2020-09-28 05:28:34 +03:00
}
async function getJob(req, res) {
const status = await queue.getJobStatus(req.params.id)
2020-12-19 01:43:38 +03:00
return status ? res.json(status) : res.status(400).json({ error: "The job doesn't exist" })
2020-09-28 05:28:34 +03:00
}
module.exports = {
status,
index,
getJob,
}