tornado-relayer/src/status.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

const queue = require('./queue')
const { GasPriceOracle } = require('gas-price-oracle')
const gasPriceOracle = new GasPriceOracle()
2020-10-05 20:15:18 +03:00
const { netId, tornadoServiceFee, miningServiceFee, instances } = require('../config')
const { version } = require('../package.json')
2020-09-28 05:28:34 +03:00
async function status(req, res) {
const ethPrices = {
dai: '6700000000000000', // 0.0067
cdai: '157380000000000',
cusdc: '164630000000000',
usdc: '7878580000000000',
usdt: '7864940000000000',
2020-09-28 05:28:34 +03:00
}
res.json({
relayerAddress: require('../config').rewardAccount,
instances: instances.netId42,
2020-09-28 05:28:34 +03:00
gasPrices: await gasPriceOracle.gasPrices(),
netId,
ethPrices,
2020-10-05 20:15:18 +03:00
tornadoServiceFee,
miningServiceFee,
nonce: 123,
2020-09-28 05:28:34 +03:00
version,
latestBlock: 12312312,
2020-09-28 05:28:34 +03:00
})
}
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-10-01 16:08:33 +03:00
return res.json(status)
2020-09-28 05:28:34 +03:00
}
module.exports = {
status,
index,
getJob,
}