mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
queued status
This commit is contained in:
parent
f011b6f9c5
commit
1af36c8475
@ -1,6 +1,6 @@
|
||||
require('dotenv').config()
|
||||
|
||||
const jobType = require('./jobTypes')
|
||||
const { jobType } = require('./constants')
|
||||
const tornConfig = require('torn-token')
|
||||
module.exports = {
|
||||
netId: Number(process.env.NET_ID) || 42,
|
||||
|
20
src/constants.js
Normal file
20
src/constants.js
Normal file
@ -0,0 +1,20 @@
|
||||
const jobType = Object.freeze({
|
||||
TORNADO_WITHDRAW: 'TORNADO_WITHDRAW',
|
||||
MINING_REWARD: 'MINING_REWARD',
|
||||
MINING_WITHDRAW: 'MINING_WITHDRAW',
|
||||
})
|
||||
|
||||
const status = Object.freeze({
|
||||
QUEUED: 'QUEUED',
|
||||
ACCEPTED: 'ACCEPTED',
|
||||
SENT: 'SENT',
|
||||
MINED: 'MINED',
|
||||
RESUBMITTED: 'RESUBMITTED',
|
||||
CONFIRMED: 'CONFIRMED',
|
||||
FAILED: 'FAILED',
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
jobType,
|
||||
status,
|
||||
}
|
@ -4,7 +4,7 @@ const {
|
||||
getMiningWithdrawInputError,
|
||||
} = require('./validator')
|
||||
const { postJob } = require('./queue')
|
||||
const jobType = require('./jobTypes')
|
||||
const { jobType } = require('./constants')
|
||||
|
||||
async function tornadoWithdraw(req, res) {
|
||||
const inputError = getTornadoWithdrawInputError(req.body)
|
||||
|
@ -1,5 +0,0 @@
|
||||
module.exports = Object.freeze({
|
||||
TORNADO_WITHDRAW: 'TORNADO_WITHDRAW',
|
||||
MINING_REWARD: 'MINING_REWARD',
|
||||
MINING_WITHDRAW: 'MINING_WITHDRAW',
|
||||
})
|
@ -2,6 +2,7 @@ const { v4: uuid } = require('uuid')
|
||||
const Queue = require('bull')
|
||||
const Redis = require('ioredis')
|
||||
const { redisUrl } = require('./config')
|
||||
const { status } = require('./constants')
|
||||
const redis = new Redis(redisUrl)
|
||||
|
||||
const queue = new Queue('proofs', redisUrl)
|
||||
@ -13,6 +14,7 @@ async function postJob({ type, request }) {
|
||||
{
|
||||
id,
|
||||
type,
|
||||
status: status.QUEUED,
|
||||
...request, // proof, args, ?contract
|
||||
},
|
||||
// { removeOnComplete: true },
|
||||
|
@ -12,7 +12,7 @@ const miningABI = require('../abis/mining.abi.json')
|
||||
const swapABI = require('../abis/swap.abi.json')
|
||||
const { queue } = require('./queue')
|
||||
const { poseidonHash2, getInstance, fromDecimals } = require('./utils')
|
||||
const jobType = require('./jobTypes')
|
||||
const { jobType, status } = require('./constants')
|
||||
const {
|
||||
netId,
|
||||
torn,
|
||||
@ -42,15 +42,6 @@ const redis = new Redis(redisUrl)
|
||||
const redisSubscribe = new Redis(redisUrl)
|
||||
const gasPriceOracle = new GasPriceOracle({ defaultRpc: httpRpcUrl })
|
||||
|
||||
const status = Object.freeze({
|
||||
ACCEPTED: 'ACCEPTED',
|
||||
SENT: 'SENT',
|
||||
MINED: 'MINED',
|
||||
CONFIRMED: 'CONFIRMED',
|
||||
FAILED: 'FAILED',
|
||||
RESUBMITTED: 'RESUBMITTED',
|
||||
})
|
||||
|
||||
async function fetchTree() {
|
||||
const elements = await redis.get('tree:elements')
|
||||
const convert = (_, val) => (typeof val === 'string' ? toBN(val) : val)
|
||||
|
Loading…
Reference in New Issue
Block a user