diff --git a/src/app/routes.ts b/src/app/routes.ts index bbe558a..dd28997 100644 --- a/src/app/routes.ts +++ b/src/app/routes.ts @@ -1,9 +1,9 @@ import { FastifyInstance } from 'fastify'; -import { jobsSchema, statusSchema, withdrawBodySchema, withdrawSchema } from './schema'; -import { FromSchema } from 'json-schema-to-ts'; +import { jobsSchema, statusSchema, withdrawSchema } from './schema'; import { relayerVersion, rewardAccount, tornadoServiceFee } from '../config'; import { configService, getHealthService, getJobService, getPriceService } from '../services'; import { RelayerJobType } from '../types'; +import { WithdrawalData } from '../services/tx.service'; export function mainHandler(server: FastifyInstance, options, next) { const jobService = getJobService(); @@ -46,14 +46,10 @@ export function relayerHandler(server: FastifyInstance, options, next) { res.send({ ...job.data, failedReason: job.failedReason }); }); - server.post<{ Body: FromSchema }>( - '/tornadoWithdraw', - { schema: withdrawSchema }, - async (req, res) => { - console.log(req.body); - const id = await jobService.postJob(RelayerJobType.TORNADO_WITHDRAW, req.body); - res.send({ id }); - }, - ); + server.post<{ Body: WithdrawalData }>('/tornadoWithdraw', { schema: withdrawSchema }, async (req, res) => { + server.log.info(`Withdrawal request: ${JSON.stringify(req.body)}`); + const id = await jobService.postJob(RelayerJobType.TORNADO_WITHDRAW, req.body); + res.send({ id }); + }); next(); } diff --git a/src/queue/index.ts b/src/queue/index.ts index 8bec150..1a23d2c 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -174,7 +174,7 @@ export class HealthQueueHelper { }); await this.queue.add('checkUpdate', null, { repeat: { - every: this.interval * 2, + every: this.interval * 2 * 60, // once per hour immediately: true, }, });