switchboard_on_demand/
program_id.rs

1#[allow(unused_imports)]
2use std::str::FromStr;
3
4use crate::solana_compat::solana_program::pubkey::pubkey;
5use crate::Pubkey;
6
7/// Program id for the Switchboard oracle program
8/// SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f
9pub const SWITCHBOARD_PROGRAM_ID: Pubkey = pubkey!("SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f");
10
11/// Switchboard On-Demand program ID for mainnet
12pub const ON_DEMAND_MAINNET_PID: Pubkey = pubkey!("SBondMDrcV3K4kxZR1HNVT7osZxAHVHgYXL5Ze1oMUv");
13/// Switchboard On-Demand program ID for devnet
14pub const ON_DEMAND_DEVNET_PID: Pubkey = pubkey!("Aio4gaXjXzJNVLtzwtNVmSqGKpANtXhybbkhtAC94ji2");
15
16pub const QUOTE_PROGRAM_ID: Pubkey = pubkey!("orac1eFjzWL5R3RbbdMV68K9H6TaCVVcL6LjvQQWAbz");
17
18/// Gets the Switchboard on-demand program ID based on the current network
19pub fn get_switchboard_on_demand_program_id() -> Pubkey {
20    if crate::utils::is_devnet() {
21        ON_DEMAND_DEVNET_PID
22    } else {
23        ON_DEMAND_MAINNET_PID
24    }
25}
26
27/// Gets the Switchboard program ID for a specific cluster
28pub fn get_sb_program_id(cluster: &str) -> Pubkey {
29    if !cluster.starts_with("mainnet") {
30        ON_DEMAND_DEVNET_PID
31    } else {
32        ON_DEMAND_MAINNET_PID
33    }
34}