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