updates and fixes

This commit is contained in:
smart_ex 2022-06-30 12:10:43 +10:00
parent e997d4d07e
commit b48a44ae4e
6 changed files with 16 additions and 17 deletions

View File

@ -24,7 +24,7 @@
"dotenv": "^8.2.0",
"ethers": "^5.6.4",
"fastify": "^3.28.0",
"gas-price-oracle": "git+https://github.com/peppersec/gas-price-oracle.git#da3de92dea7c75afc2c8ba141f23c4eea597a614",
"gas-price-oracle": "git+https://github.com/peppersec/gas-price-oracle.git#de97ca2d154480aebbe9130778a69727f3a0f00b",
"ioredis": "^5.0.6",
"json-schema-to-ts": "^2.2.0",
"node-fetch": "^2.6.7",
@ -32,7 +32,7 @@
"telegraf": "^4.8.2",
"torn-token": "^1.0.8",
"tsyringe": "^4.6.0",
"tx-manager": "git+https://github.com/tornadocash/tx-manager.git#b4235ec8f7d4937a088ae862ca82f3866cd2aaee",
"tx-manager": "git+https://github.com/tornadocash/tx-manager.git#e223c22791b5887012f24c4b15917001fc649dfe",
"uuid": "^8.3.0"
},
"devDependencies": {

View File

@ -6,7 +6,6 @@ export const relayerProcessor: RelayerProcessor = async (job) => {
try {
await job.update({ ...job.data, status: JobStatus.ACCEPTED });
console.log(`Start processing a new ${job.data.type} job ${job.id}`);
const txService = getTxService();
txService.currentJob = job;
const withdrawalData = job.data;

View File

@ -103,10 +103,10 @@ export class HealthService {
} else if (value.lt(this.config.balances[currency].warn)) {
level = 'WARN';
}
const msg = { WARN: 'Please refill your balance', CRITICAL: 'Insufficient balance' };
const alert = {
type: `${type}_${currency}_${level}`,
message: `Insufficient balance ${formatEther(value)} ${currency === 'MAIN' ? this.config.nativeCurrency : 'torn'}`,
message: `${msg[level]} ${formatEther(value)} ${currency === 'MAIN' ? this.config.nativeCurrency : 'torn'}`,
level,
time,
};

View File

@ -1,6 +1,7 @@
import { Telegram } from 'telegraf';
import { autoInjectable, container } from 'tsyringe';
import { RedisStore } from '../modules/redis';
import { ExtraReplyMessage } from 'telegraf/typings/telegram-types';
export type Levels = keyof typeof AlertLevel;
@ -19,8 +20,8 @@ export enum AlertType {
}
class MockTelegram {
async sendMessage(chatId, text: string, extra?: any) {
console.log(text);
async sendMessage(chatId, text: string, extra?: ExtraReplyMessage) {
console.log(text, extra);
}
async getMe() {
@ -70,7 +71,7 @@ export class NotifierService {
return this.telegram.sendMessage(this.chatId, text, { parse_mode: 'HTML' });
}
sendError(e: any) {
sendError(e: Error) {
return this.telegram.sendMessage(this.chatId, `Error: ${e}`);
}

View File

@ -1,6 +1,6 @@
import { TransactionData, TxManager } from 'tx-manager';
import { GasPriceOracle } from 'gas-price-oracle';
import { AlchemyProvider, Provider } from '@ethersproject/providers';
import { Provider } from '@ethersproject/providers';
import { formatEther, parseUnits } from 'ethers/lib/utils';
import { BigNumber, BigNumberish, BytesLike } from 'ethers';
import { ProxyLightABI, TornadoProxyABI } from '../contracts';
@ -44,12 +44,11 @@ export class TxService {
const { privateKey, rpcUrl, netId } = this.config;
this.tornadoProxy = this.config.proxyContract;
this.provider = this.tornadoProxy.provider;
const prov = new AlchemyProvider(netId);
this.txManager = new TxManager({
privateKey,
rpcUrl,
config: { THROW_ON_REVERT: true },
provider: prov,
provider: this.provider,
});
this.oracle = new GasPriceOracle({
defaultRpc: rpcUrl,
@ -137,7 +136,7 @@ export class TxService {
}
async getGasPrice(): Promise<BigNumber> {
const gasPrices = await this.oracle.gasPrices({});
const gasPrices = await this.oracle.gasPrices();
let gasPrice = gasPrices['fast'];
if ('maxFeePerGas' in gasPrices) gasPrice = gasPrices['maxFeePerGas'];
return parseUnits(String(gasPrice), 'gwei');

View File

@ -2826,9 +2826,9 @@ functional-red-black-tree@^1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==
"gas-price-oracle@git+https://github.com/peppersec/gas-price-oracle.git#da3de92dea7c75afc2c8ba141f23c4eea597a614":
"gas-price-oracle@git+https://github.com/peppersec/gas-price-oracle.git#de97ca2d154480aebbe9130778a69727f3a0f00b":
version "0.5.0"
resolved "git+https://github.com/peppersec/gas-price-oracle.git#da3de92dea7c75afc2c8ba141f23c4eea597a614"
resolved "git+https://github.com/peppersec/gas-price-oracle.git#de97ca2d154480aebbe9130778a69727f3a0f00b"
dependencies:
axios "^0.21.2"
bignumber.js "^9.0.0"
@ -4975,13 +4975,13 @@ tweetnacl@^1.0.0:
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596"
integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==
"tx-manager@git+https://github.com/tornadocash/tx-manager.git#b4235ec8f7d4937a088ae862ca82f3866cd2aaee":
"tx-manager@git+https://github.com/tornadocash/tx-manager.git#3a168c3c54a7d1ad77316476418927c21da22bb7":
version "0.4.8"
resolved "git+https://github.com/tornadocash/tx-manager.git#b4235ec8f7d4937a088ae862ca82f3866cd2aaee"
resolved "git+https://github.com/tornadocash/tx-manager.git#3a168c3c54a7d1ad77316476418927c21da22bb7"
dependencies:
async-mutex "^0.2.4"
ethers "^5.4.6"
gas-price-oracle "git+https://github.com/peppersec/gas-price-oracle.git#da3de92dea7c75afc2c8ba141f23c4eea597a614"
gas-price-oracle "git+https://github.com/peppersec/gas-price-oracle.git#de97ca2d154480aebbe9130778a69727f3a0f00b"
web3-core-promievent "^1.3.0"
type-check@^0.4.0, type-check@~0.4.0: