jito_bundle/bundler/bundle/
types.rs1use crate::bundler::types::{BundleInstructionSlots, BundleSlotView, TipMode};
2use solana_pubkey::Pubkey;
3use solana_sdk::transaction::VersionedTransaction;
4
5pub struct BuiltBundle {
7 pub transactions: Vec<VersionedTransaction>,
9 pub tip_account: Pubkey,
11 pub tip_lamports: u64,
13 pub tip_mode: TipMode,
15 pub instruction_slots: BundleInstructionSlots,
17}
18
19impl BuiltBundle {
20 pub fn new(
23 transactions: Vec<VersionedTransaction>,
24 tip_account: Pubkey,
25 tip_lamports: u64,
26 tip_mode: TipMode,
27 instruction_slots: BundleInstructionSlots,
28 ) -> Self {
29 Self {
30 transactions,
31 tip_account,
32 tip_lamports,
33 tip_mode,
34 instruction_slots,
35 }
36 }
37
38 pub fn instruction_slots(&self) -> &BundleInstructionSlots {
41 &self.instruction_slots
42 }
43}
44
45impl BundleSlotView for BuiltBundle {
46 fn instruction_slots(&self) -> &BundleInstructionSlots {
48 &self.instruction_slots
49 }
50
51 fn populated_count(&self) -> usize {
53 self.instruction_slots.iter().flatten().count()
54 }
55
56 fn last_populated_index(&self) -> Option<usize> {
58 self.instruction_slots
59 .iter()
60 .rposition(|slot| slot.is_some())
61 }
62}