Skip to main content

surfpool_core/
lib.rs

1#[macro_use]
2extern crate log;
3
4#[allow(unused_imports)]
5#[macro_use]
6extern crate serde_derive;
7
8#[allow(unused_imports)]
9#[cfg(test)]
10#[macro_use]
11extern crate serde_json;
12
13pub mod error;
14pub mod helpers;
15pub mod rpc;
16pub mod runloops;
17pub mod scenarios;
18pub mod storage;
19pub mod surfnet;
20#[cfg(feature = "prometheus")]
21pub mod telemetry;
22pub mod types;
23
24use crossbeam_channel::{Receiver, Sender};
25pub use jsonrpc_core;
26pub use jsonrpc_http_server;
27pub use litesvm;
28use solana_pubkey::Pubkey;
29pub use solana_rpc_client;
30use surfnet::{GeyserEvent, locker::SurfnetSvmLocker, svm::SurfnetSvm};
31use surfpool_types::{SimnetCommand, SurfpoolConfig};
32use uuid::Uuid;
33
34pub const SURFPOOL_IDENTITY_PUBKEY: Pubkey =
35    Pubkey::from_str_const("SUrFPooLSUrFPooLSUrFPooLSUrFPooLSUrFPooLSUr");
36
37pub async fn start_local_surfnet(
38    surfnet_svm: SurfnetSvm,
39    config: SurfpoolConfig,
40    simnet_commands_tx: Sender<SimnetCommand>,
41    simnet_commands_rx: Receiver<SimnetCommand>,
42    geyser_events_rx: Receiver<GeyserEvent>,
43) -> Result<(), Box<dyn std::error::Error>> {
44    let svm_locker = SurfnetSvmLocker::new(surfnet_svm);
45    runloops::start_local_surfnet_runloop(
46        svm_locker,
47        config,
48        simnet_commands_tx,
49        simnet_commands_rx,
50        geyser_events_rx,
51    )
52    .await
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(rename_all = "camelCase")]
57pub struct PluginInfo {
58    pub plugin_name: String,
59    pub uuid: String,
60}
61
62#[cfg(test)]
63mod tests;