updates and fixes
This commit is contained in:
parent
e997d4d07e
commit
b48a44ae4e
@ -24,7 +24,7 @@
|
|||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"ethers": "^5.6.4",
|
"ethers": "^5.6.4",
|
||||||
"fastify": "^3.28.0",
|
"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",
|
"ioredis": "^5.0.6",
|
||||||
"json-schema-to-ts": "^2.2.0",
|
"json-schema-to-ts": "^2.2.0",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"telegraf": "^4.8.2",
|
"telegraf": "^4.8.2",
|
||||||
"torn-token": "^1.0.8",
|
"torn-token": "^1.0.8",
|
||||||
"tsyringe": "^4.6.0",
|
"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"
|
"uuid": "^8.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -6,7 +6,6 @@ export const relayerProcessor: RelayerProcessor = async (job) => {
|
|||||||
try {
|
try {
|
||||||
await job.update({ ...job.data, status: JobStatus.ACCEPTED });
|
await job.update({ ...job.data, status: JobStatus.ACCEPTED });
|
||||||
console.log(`Start processing a new ${job.data.type} job ${job.id}`);
|
console.log(`Start processing a new ${job.data.type} job ${job.id}`);
|
||||||
|
|
||||||
const txService = getTxService();
|
const txService = getTxService();
|
||||||
txService.currentJob = job;
|
txService.currentJob = job;
|
||||||
const withdrawalData = job.data;
|
const withdrawalData = job.data;
|
||||||
|
@ -103,10 +103,10 @@ export class HealthService {
|
|||||||
} else if (value.lt(this.config.balances[currency].warn)) {
|
} else if (value.lt(this.config.balances[currency].warn)) {
|
||||||
level = 'WARN';
|
level = 'WARN';
|
||||||
}
|
}
|
||||||
|
const msg = { WARN: 'Please refill your balance', CRITICAL: 'Insufficient balance' };
|
||||||
const alert = {
|
const alert = {
|
||||||
type: `${type}_${currency}_${level}`,
|
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,
|
level,
|
||||||
time,
|
time,
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Telegram } from 'telegraf';
|
import { Telegram } from 'telegraf';
|
||||||
import { autoInjectable, container } from 'tsyringe';
|
import { autoInjectable, container } from 'tsyringe';
|
||||||
import { RedisStore } from '../modules/redis';
|
import { RedisStore } from '../modules/redis';
|
||||||
|
import { ExtraReplyMessage } from 'telegraf/typings/telegram-types';
|
||||||
|
|
||||||
export type Levels = keyof typeof AlertLevel;
|
export type Levels = keyof typeof AlertLevel;
|
||||||
|
|
||||||
@ -19,8 +20,8 @@ export enum AlertType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MockTelegram {
|
class MockTelegram {
|
||||||
async sendMessage(chatId, text: string, extra?: any) {
|
async sendMessage(chatId, text: string, extra?: ExtraReplyMessage) {
|
||||||
console.log(text);
|
console.log(text, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMe() {
|
async getMe() {
|
||||||
@ -70,7 +71,7 @@ export class NotifierService {
|
|||||||
return this.telegram.sendMessage(this.chatId, text, { parse_mode: 'HTML' });
|
return this.telegram.sendMessage(this.chatId, text, { parse_mode: 'HTML' });
|
||||||
}
|
}
|
||||||
|
|
||||||
sendError(e: any) {
|
sendError(e: Error) {
|
||||||
return this.telegram.sendMessage(this.chatId, `Error: ${e}`);
|
return this.telegram.sendMessage(this.chatId, `Error: ${e}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { TransactionData, TxManager } from 'tx-manager';
|
import { TransactionData, TxManager } from 'tx-manager';
|
||||||
import { GasPriceOracle } from 'gas-price-oracle';
|
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 { formatEther, parseUnits } from 'ethers/lib/utils';
|
||||||
import { BigNumber, BigNumberish, BytesLike } from 'ethers';
|
import { BigNumber, BigNumberish, BytesLike } from 'ethers';
|
||||||
import { ProxyLightABI, TornadoProxyABI } from '../contracts';
|
import { ProxyLightABI, TornadoProxyABI } from '../contracts';
|
||||||
@ -44,12 +44,11 @@ export class TxService {
|
|||||||
const { privateKey, rpcUrl, netId } = this.config;
|
const { privateKey, rpcUrl, netId } = this.config;
|
||||||
this.tornadoProxy = this.config.proxyContract;
|
this.tornadoProxy = this.config.proxyContract;
|
||||||
this.provider = this.tornadoProxy.provider;
|
this.provider = this.tornadoProxy.provider;
|
||||||
const prov = new AlchemyProvider(netId);
|
|
||||||
this.txManager = new TxManager({
|
this.txManager = new TxManager({
|
||||||
privateKey,
|
privateKey,
|
||||||
rpcUrl,
|
rpcUrl,
|
||||||
config: { THROW_ON_REVERT: true },
|
config: { THROW_ON_REVERT: true },
|
||||||
provider: prov,
|
provider: this.provider,
|
||||||
});
|
});
|
||||||
this.oracle = new GasPriceOracle({
|
this.oracle = new GasPriceOracle({
|
||||||
defaultRpc: rpcUrl,
|
defaultRpc: rpcUrl,
|
||||||
@ -137,7 +136,7 @@ export class TxService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getGasPrice(): Promise<BigNumber> {
|
async getGasPrice(): Promise<BigNumber> {
|
||||||
const gasPrices = await this.oracle.gasPrices({});
|
const gasPrices = await this.oracle.gasPrices();
|
||||||
let gasPrice = gasPrices['fast'];
|
let gasPrice = gasPrices['fast'];
|
||||||
if ('maxFeePerGas' in gasPrices) gasPrice = gasPrices['maxFeePerGas'];
|
if ('maxFeePerGas' in gasPrices) gasPrice = gasPrices['maxFeePerGas'];
|
||||||
return parseUnits(String(gasPrice), 'gwei');
|
return parseUnits(String(gasPrice), 'gwei');
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -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"
|
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==
|
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"
|
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:
|
dependencies:
|
||||||
axios "^0.21.2"
|
axios "^0.21.2"
|
||||||
bignumber.js "^9.0.0"
|
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"
|
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596"
|
||||||
integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==
|
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"
|
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:
|
dependencies:
|
||||||
async-mutex "^0.2.4"
|
async-mutex "^0.2.4"
|
||||||
ethers "^5.4.6"
|
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"
|
web3-core-promievent "^1.3.0"
|
||||||
|
|
||||||
type-check@^0.4.0, type-check@~0.4.0:
|
type-check@^0.4.0, type-check@~0.4.0:
|
||||||
|
Loading…
Reference in New Issue
Block a user