Merge pull request #95 from mcoder9/master

Added Jito-RPC Executer
This commit is contained in:
Filip Dunđer
2024-04-22 18:31:22 +02:00
committed by GitHub
6 changed files with 177 additions and 20 deletions

View File

@ -41,13 +41,14 @@ import {
PRICE_CHECK_INTERVAL,
SNIPE_LIST_REFRESH_INTERVAL,
TRANSACTION_EXECUTOR,
WARP_FEE,
CUSTOM_FEE,
FILTER_CHECK_INTERVAL,
FILTER_CHECK_DURATION,
CONSECUTIVE_FILTER_MATCHES,
} from './helpers';
import { version } from './package.json';
import { WarpTransactionExecutor } from './transactions/warp-transaction-executor';
import { JitoTransactionExecutor } from './transactions/jito-rpc-transaction-executor';
const connection = new Connection(RPC_ENDPOINT, {
wsEndpoint: RPC_WEBSOCKET_ENDPOINT,
@ -80,9 +81,11 @@ function printDetails(wallet: Keypair, quoteToken: Token, bot: Bot) {
logger.info('- Bot -');
logger.info(`Using warp: ${bot.isWarp}`);
if (bot.isWarp) {
logger.info(`Warp fee: ${WARP_FEE}`);
logger.info(
`Using ${TRANSACTION_EXECUTOR} executer: ${bot.isWarp || bot.isJito || (TRANSACTION_EXECUTOR === 'default' ? true : false)}`,
);
if (bot.isWarp || bot.isJito) {
logger.info(`${TRANSACTION_EXECUTOR} fee: ${CUSTOM_FEE}`);
} else {
logger.info(`Compute Unit limit: ${botConfig.unitLimit}`);
logger.info(`Compute Unit price (micro lamports): ${botConfig.unitPrice}`);
@ -144,7 +147,11 @@ const runListener = async () => {
switch (TRANSACTION_EXECUTOR) {
case 'warp': {
txExecutor = new WarpTransactionExecutor(WARP_FEE);
txExecutor = new WarpTransactionExecutor(CUSTOM_FEE);
break;
}
case 'jito': {
txExecutor = new JitoTransactionExecutor(CUSTOM_FEE, connection);
break;
}
default: {