Jito Object

Jito object for submitting and validating Jito bundles.

Jito Object Documentation

The Jito object provides methods to interact with the Jito MEV (Maximal Extractable Value) infrastructure on the Solana blockchain. It supports submitting, signing, simulating, preparing, and modifying transaction bundles, as well as retrieving tip statistics. The class leverages the Roboqo client to make RPC calls for MEV-related operations.

Methods

submitBundle

Description Submits a bundle of transactions to Jito for processing.

Signature

public async submitBundle(
  transactions: (Transaction | VersionedTransaction)[]
): Promise<JitoBundle>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to include in the bundle.

Returns

  • Promise<JitoBundle>: A JitoBundle object containing the bundle ID and transaction signatures.


signAndSubmitBundle

Description Signs and submits a bundle of transactions to Jito.

Signature

public async signAndSubmitBundle(
  transactions: (Transaction | VersionedTransaction)[]
): Promise<JitoBundle>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to sign and submit.

Returns

  • Promise<JitoBundle>: A JitoBundle object containing the bundle ID and transaction signatures.

Example Usage

const bundle = await jito.signAndSubmitBundle([tx1, tx2]);
console.log("Bundle ID:", bundle.bundleId);
console.log("Signatures:", bundle.signatures);

signAndSimulateBundle

Description Signs and simulates a bundle of transactions to determine their outcome and potential success.

Signature

public async signAndSimulateBundle(
  transactions: (Transaction | VersionedTransaction)[]
): Promise<SimulateBundleResponse>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to sign and simulate.

Returns

  • Promise<SimulateBundleResponse>: The simulation results, including execution logs and errors (if any).

Example Usage

const simulation = await jito.signAndSimulateBundle([tx1, tx2]);
console.log("Simulation summary:", simulation.summary);

simulateBundle

Description Simulates a bundle of transactions to determine if they would succeed and to analyze the outcome.

Signature

public async simulateBundle(
  transactions: (Transaction | VersionedTransaction)[]
): Promise<SimulateBundleResponse>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to simulate.

Returns

  • Promise<SimulateBundleResponse>: The simulation results, including execution logs and errors (if any).

Example Usage

const simulation = await jito.simulateBundle([tx1, tx2]);
console.log("Simulation summary:", simulation.summary);

prepareBundle

Description Prepares a bundle of transactions with a specified tip amount in lamports.

Signature

public async prepareBundle(
  transactions: (Transaction | VersionedTransaction)[],
  lamports: string
): Promise<Transaction[]>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to prepare.

  • lamports (string): The tip amount in lamports.

Returns

  • Promise<Transaction[]>: An array of deserialized transactions prepared with the specified tip.

Example Usage

const preparedTxs = await jito.prepareBundle([tx1, tx2], "5000");
console.log("Prepared Transactions:", preparedTxs);

prepareBundlePercentile

Description Prepares a bundle of transactions with a tip based on a specified percentile.

Signature

public async prepareBundlePercentile(
  transactions: (Transaction | VersionedTransaction)[],
  percentile: number
): Promise<Transaction[]>

Parameters

  • transactions ((Transaction | VersionedTransaction)[]): An array of transactions to prepare.

  • percentile (number): The percentile for determining the tip amount.

Returns

  • Promise<Transaction[]>: An array of deserialized transactions prepared with the percentile-based tip.

Example Usage

const preparedTxs = await jito.prepareBundlePercentile([tx1, tx2], 75);
console.log("Prepared Transactions:", preparedTxs);

addTip

Description Adds a specific tip amount in lamports to a transaction.

Signature

public async addTip(
  transaction: Transaction | VersionedTransaction,
  lamports: string
): Promise<Transaction>

Parameters

  • transaction (Transaction | VersionedTransaction): The transaction to modify.

  • lamports (string): The tip amount in lamports.

Returns

  • Promise<Transaction>: The deserialized transaction with the tip added.

Example Usage

const tippedTx = await jito.addTip(tx, "5000");
console.log("Transaction with Tip:", tippedTx);

addTipPercentile

Description Adds a tip to a transaction based on a specified percentile.

Signature

public async addTipPercentile(
  transaction: Transaction | VersionedTransaction,
  percentile: number
): Promise<Transaction>

Parameters

  • transaction (Transaction | VersionedTransaction): The transaction to modify.

  • percentile (number): The percentile for determining the tip amount.

Returns

  • Promise<Transaction>: The deserialized transaction with the percentile-based tip added.

Example Usage

const tippedTx = await jito.addTipPercentile(tx, 95);
console.log("Transaction with Percentile Tip:", tippedTx);

getTipStats

Description Retrieves the latest tip statistics, including various percentiles and exponential moving averages (EMA).

Signature

public async getTipStats(): Promise<JitoTipStats>

Returns

  • Promise<JitoTipStats>: The tip statistics, including various percentiles and EMA values.

Example Usage

const stats = await jito.getTipStats();
console.log("Tip Statistics:", stats);

Sample Return Value

{
  "id": 1,
  "p25": 1000,
  "p50": 2000,
  "p75": 3000,
  "p95": 5000,
  "p99": 10000,
  "slot": 12345678
}

Types

JitoTipStats

Represents the statistics for Jito tips.

type JitoTipStats = {
  id: number;
  p25: number;
  p50: number;
  p75: number;
  p95: number;
  p99: number;
  slot: number;
};

SimulateBundleResponse

Represents the response from simulating a bundle of transactions.

type SimulateBundleResponse = {
  failed: boolean;
  summary:
    | "succeeded"
    | {
        failed: {
          error: {
            TransactionFailure: [number[], string];
          };
          tx_signature: string;
        };
      };
  transactionResults: Array<{
    err: null | unknown;
    logs: string[];
    postExecutionAccounts: null | unknown;
    preExecutionAccounts: null | unknown;
    returnData: null | unknown;
    unitsConsumed: number;
  }>;
};

Last updated