Skip to content

Commit

Permalink
Ingore legacy ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lok52 committed Feb 13, 2024
1 parent 1da9a24 commit 55a0a60
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 382 deletions.
1 change: 1 addition & 0 deletions zp-relayer/direct-deposit/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { redis } from '@/services/redisClient'
const serviceKey = 'direct-deposit'
const lastBlockRedisKey = `${serviceKey}:lastProcessedBlock`

// @ts-ignore
export let lastProcessedBlock = Math.max(config.startBlock - 1, 0)

export async function getLastProcessedBlock() {
Expand Down
17 changes: 6 additions & 11 deletions zp-relayer/direct-deposit/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ import { logger } from '@/services/appLogger'
import { EvmBackend, Network, NetworkBackend, TronBackend } from '@/services/network'
import { redis } from '@/services/redisClient'
import { validateDirectDeposit } from '@/validation/tx/validateDirectDeposit'
// @ts-ignore
import { Watcher } from '@/watcher/watcher'
import { BatchCache } from './BatchCache'
import { parseDirectDepositEvent } from './utils'

async function initNetwork() {
let networkBackend: NetworkBackend<Network>
// @ts-ignore
if (config.COMMITMENT_WATCHER_NETWORK === Network.Ethereum) {
networkBackend = new EvmBackend({
rpcRequestTimeout: '' as any,
rpcSyncCheckInterval: '' as any,
jsonRpcErrorCodes: '' as any,
poolAddress: '' as any,
tokenAddress: '' as any,
pk: '' as any,
rpcUrls: '' as any,
requireHTTPS: '' as any,
})
networkBackend = new EvmBackend({} as any)
// @ts-ignore
} else if (config.COMMITMENT_WATCHER_NETWORK === Network.Tron) {
networkBackend = new TronBackend({} as any)
} else {
Expand All @@ -44,6 +38,7 @@ async function init() {
logger.info('Adding direct-deposit events to queue', { count: ds.length })
directDepositQueue.add('', ds)
},
// @ts-ignore
dd => validateDirectDeposit(dd, DirectDepositQueueInstance),
redis
)
Expand All @@ -55,7 +50,7 @@ async function init() {
startBlock: config.COMMON_START_BLOCK,
eventPollingInterval: config.eventPollingInterval,
batchSize: config.COMMON_EVENTS_PROCESSING_BATCH_SIZE,
processor: async batch => {
processor: async (batch: any) => {
const directDeposits: [string, DirectDeposit][] = []
for (let event of batch) {
const dd = parseDirectDepositEvent(event.values)
Expand Down
2 changes: 1 addition & 1 deletion zp-relayer/guard/init.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-ignore
import config from '@/configs/guardConfig'
import { Network, NetworkContract } from '@/services/network'
import { EthereumContract } from '@/services/network/evm/EvmContract'
import { TronContract } from '@/services/network/tron/TronContract'
// @ts-ignore
import TronWeb from 'tronweb'
import Web3 from 'web3'
import PoolAbi from '../abi/pool-abi.json'
Expand Down
6 changes: 4 additions & 2 deletions zp-relayer/guard/router.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// @ts-ignore
import config from '@/configs/guardConfig'
import type { Network, NetworkContract } from '@/services/network'
import { buildTxData, TxData } from '@/txProcessor'
// @ts-ignore
import { TxData, buildTxData } from '@/txProcessor'
import { ENERGY_SIZE, TOKEN_SIZE, TRANSFER_INDEX_SIZE } from '@/utils/constants'
import { numToHex, packSignature } from '@/utils/helpers'
import { getTxProofField, parseDelta } from '@/utils/proofInputs'
import cors from 'cors'
import { getBytes, keccak256 } from 'ethers'
import express, { NextFunction, Request, Response } from 'express'
import { VK } from 'libzkbob-rs-node'
// @ts-ignore
import TronWeb from 'tronweb'
import { toBN } from 'web3-utils'
import { logger } from '../services/appLogger'
import { checkSignMPCSchema, validateBatch } from '../validation/api/validation'
// @ts-ignore
import { TxDataMPC, validateTxMPC } from '../validation/tx/validateTx'

function wrapErr(f: (_req: Request, _res: Response, _next: NextFunction) => Promise<void> | void) {
Expand Down
4 changes: 2 additions & 2 deletions zp-relayer/validation/api/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Ajv, { JSONSchemaType } from 'ajv'
import { Proof, SnarkProof } from 'libzkbob-rs-node'
import { isAddress } from 'web3-utils'
import { TxType } from 'zp-memo-parser'
import { TxDataMPC } from '../tx/validateTx'

const ajv = new Ajv({ allErrors: true, coerceTypes: true, useDefaults: true })

Expand Down Expand Up @@ -85,7 +84,8 @@ const AjvSendTransactionSchema: JSONSchemaType<BasePoolTx> = {
required: ['proof', 'memo', 'txType'],
}

const AjvSignMPCSchema: JSONSchemaType<TxDataMPC> = {
// @ts-ignore
const AjvSignMPCSchema: JSONSchemaType<any> = {
type: 'object',
properties: {
txProof: AjvProofSchema,
Expand Down
Loading

0 comments on commit 55a0a60

Please sign in to comment.