swqos support flashblock
This commit is contained in:
+35
-1
@@ -6,6 +6,7 @@ pub mod zeroslot;
|
||||
pub mod temporal;
|
||||
pub mod bloxroute;
|
||||
pub mod node1;
|
||||
pub mod flashblock;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -14,7 +15,28 @@ use tokio::sync::RwLock;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{common::SolanaRpcClient, constants::swqos::{SWQOS_ENDPOINTS_BLOX, SWQOS_ENDPOINTS_JITO, SWQOS_ENDPOINTS_NEXTBLOCK, SWQOS_ENDPOINTS_TEMPORAL, SWQOS_ENDPOINTS_ZERO_SLOT, SWQOS_ENDPOINTS_NODE1}, swqos::{bloxroute::BloxrouteClient, jito::JitoClient, nextblock::NextBlockClient, solana_rpc::SolRpcClient, temporal::TemporalClient, zeroslot::ZeroSlotClient, node1::Node1Client}};
|
||||
use crate::{
|
||||
common::SolanaRpcClient,
|
||||
constants::swqos::{
|
||||
SWQOS_ENDPOINTS_BLOX,
|
||||
SWQOS_ENDPOINTS_JITO,
|
||||
SWQOS_ENDPOINTS_NEXTBLOCK,
|
||||
SWQOS_ENDPOINTS_TEMPORAL,
|
||||
SWQOS_ENDPOINTS_ZERO_SLOT,
|
||||
SWQOS_ENDPOINTS_NODE1,
|
||||
SWQOS_ENDPOINTS_FLASHBLOCK
|
||||
},
|
||||
swqos::{
|
||||
bloxroute::BloxrouteClient,
|
||||
jito::JitoClient,
|
||||
nextblock::NextBlockClient,
|
||||
solana_rpc::SolRpcClient,
|
||||
temporal::TemporalClient,
|
||||
zeroslot::ZeroSlotClient,
|
||||
node1::Node1Client,
|
||||
flashblock::FlashBlockClient
|
||||
}
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref TIP_ACCOUNT_CACHE: RwLock<Vec<String>> = RwLock::new(Vec::new());
|
||||
@@ -48,6 +70,7 @@ pub enum SwqosType {
|
||||
Temporal,
|
||||
Bloxroute,
|
||||
Node1,
|
||||
FlashBlock,
|
||||
Default,
|
||||
}
|
||||
|
||||
@@ -82,6 +105,7 @@ pub enum SwqosConfig {
|
||||
Temporal(String, SwqosRegion),
|
||||
ZeroSlot(String, SwqosRegion),
|
||||
Node1(String, SwqosRegion),
|
||||
FlashBlock(String, SwqosRegion),
|
||||
}
|
||||
|
||||
impl SwqosConfig {
|
||||
@@ -93,6 +117,7 @@ impl SwqosConfig {
|
||||
SwqosType::Temporal => SWQOS_ENDPOINTS_TEMPORAL[region as usize].to_string(),
|
||||
SwqosType::Bloxroute => SWQOS_ENDPOINTS_BLOX[region as usize].to_string(),
|
||||
SwqosType::Node1 => SWQOS_ENDPOINTS_NODE1[region as usize].to_string(),
|
||||
SwqosType::FlashBlock => SWQOS_ENDPOINTS_FLASHBLOCK[region as usize].to_string(),
|
||||
SwqosType::Default => "".to_string(),
|
||||
}
|
||||
}
|
||||
@@ -153,6 +178,15 @@ impl SwqosConfig {
|
||||
);
|
||||
Arc::new(node1_client)
|
||||
},
|
||||
SwqosConfig::FlashBlock(auth_token, region) => {
|
||||
let endpoint = SwqosConfig::get_endpoint(SwqosType::FlashBlock, region);
|
||||
let flashblock_client = FlashBlockClient::new(
|
||||
rpc_url.clone(),
|
||||
endpoint.to_string(),
|
||||
auth_token
|
||||
);
|
||||
Arc::new(flashblock_client)
|
||||
},
|
||||
SwqosConfig::Default(endpoint) => {
|
||||
let rpc = SolanaRpcClient::new_with_commitment(
|
||||
endpoint,
|
||||
|
||||
Reference in New Issue
Block a user