Added Jito-RPC Executer

This commit is contained in:
engmabdulwahab
2024-04-22 07:27:59 +04:00
parent 95ae801a53
commit 39ef59f5a6
6 changed files with 174 additions and 18 deletions

5
bot.ts
View File

@ -22,6 +22,7 @@ import { createPoolKeys, logger, NETWORK, sleep } from './helpers';
import { Mutex } from 'async-mutex';
import BN from 'bn.js';
import { WarpTransactionExecutor } from './transactions/warp-transaction-executor';
import { JitoTransactionExecutor } from './transactions/jito-rpc-transaction-executor';
export interface BotConfig {
wallet: Keypair;
@ -63,6 +64,7 @@ export class Bot {
private readonly mutex: Mutex;
private sellExecutionCount = 0;
public readonly isWarp: boolean = false;
public readonly isJito: boolean = false;
constructor(
private readonly connection: Connection,
@ -72,6 +74,7 @@ export class Bot {
readonly config: BotConfig,
) {
this.isWarp = txExecutor instanceof WarpTransactionExecutor;
this.isJito = txExecutor instanceof JitoTransactionExecutor;
this.mutex = new Mutex();
this.poolFilters = new PoolFilters(connection, {
@ -324,7 +327,7 @@ export class Bot {
payerKey: wallet.publicKey,
recentBlockhash: latestBlockhash.blockhash,
instructions: [
...(this.isWarp
...(this.isWarp || this.isJito
? []
: [
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: this.config.unitPrice }),