jito_bundle/config/
jito.rs1use crate::config::confirm_policy::ConfirmPolicy;
2use crate::config::network::Network;
3use crate::config::tip_strategy::TipStrategy;
4use crate::constants::DEFAULT_COMPUTE_UNIT_LIMIT;
5use solana_pubkey::Pubkey;
6
7#[derive(Debug, Clone)]
8pub struct JitoConfig {
9 pub network: Network,
10 pub rpc_url: String,
11 pub helius_rpc_url: Option<String>,
12 pub uuid: Option<String>,
13 pub tip_strategy: TipStrategy,
14 pub confirm_policy: ConfirmPolicy,
15 pub jitodontfront_pubkey: Option<Pubkey>,
16 pub compute_unit_limit: u32,
17}
18
19impl JitoConfig {
20 pub fn new(rpc_url: impl Into<String>) -> Self {
21 Self {
22 network: Network::Mainnet,
23 rpc_url: rpc_url.into(),
24 helius_rpc_url: None,
25 uuid: None,
26 tip_strategy: TipStrategy::default(),
27 confirm_policy: ConfirmPolicy::default(),
28 jitodontfront_pubkey: None,
29 compute_unit_limit: DEFAULT_COMPUTE_UNIT_LIMIT,
30 }
31 }
32
33 pub fn with_network(mut self, network: Network) -> Self {
34 self.network = network;
35 self
36 }
37
38 pub fn with_helius_rpc_url(mut self, url: impl Into<String>) -> Self {
39 self.helius_rpc_url = Some(url.into());
40 self
41 }
42
43 pub fn with_uuid(mut self, uuid: impl Into<String>) -> Self {
44 self.uuid = Some(uuid.into());
45 self
46 }
47
48 pub fn with_tip_strategy(mut self, strategy: TipStrategy) -> Self {
49 self.tip_strategy = strategy;
50 self
51 }
52
53 pub fn with_confirm_policy(mut self, policy: ConfirmPolicy) -> Self {
54 self.confirm_policy = policy;
55 self
56 }
57
58 pub fn with_jitodontfront(mut self, pubkey: Pubkey) -> Self {
59 self.jitodontfront_pubkey = Some(pubkey);
60 self
61 }
62
63 pub fn with_compute_unit_limit(mut self, limit: u32) -> Self {
64 self.compute_unit_limit = limit;
65 self
66 }
67}