2020-09-30 10:03:13 +02:00
|
|
|
const { getTornadoWithdrawInputError } = require('./validator')
|
2020-09-28 04:28:34 +02:00
|
|
|
const { postJob } = require('./queue')
|
|
|
|
|
|
|
|
async function tornadoWithdraw(req, res) {
|
2020-09-28 16:54:54 +02:00
|
|
|
const inputError = getTornadoWithdrawInputError(req.body)
|
2020-09-28 04:28:34 +02:00
|
|
|
if (inputError) {
|
|
|
|
console.log('Invalid input:', inputError)
|
|
|
|
return res.status(400).json({ error: inputError })
|
|
|
|
}
|
|
|
|
|
|
|
|
const { proof, args, contract } = req.body
|
|
|
|
const id = await postJob({
|
2020-09-30 17:35:48 +02:00
|
|
|
type: 'tornadoWithdraw',
|
2020-09-28 04:28:34 +02:00
|
|
|
data: { proof, args, contract },
|
|
|
|
})
|
|
|
|
return res.json({ id })
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
tornadoWithdraw,
|
|
|
|
}
|