#![allow(clippy::crate_in_macro_def)]
#![allow(clippy::repr_packed_without_abi)]
#![allow(clippy::manual_is_multiple_of)]
#![doc(html_logo_url = "https://i.imgur.com/2cZloJp.png")]
#![allow(unexpected_cfgs)]
#![allow(unused_attributes)]
#![allow(clippy::result_large_err)]
#[cfg(all(feature = "solana-v2", feature = "solana-v3"))]
compile_error!("Cannot enable both 'solana-v2' and 'solana-v3' features. Choose one: use 'solana-v2' for production or 'solana-v3' for experimental builds.");
#[cfg(all(feature = "client", feature = "client-v3"))]
compile_error!("Cannot enable both 'client' (v2) and 'client-v3' features. Use 'client' for Solana v2 or 'client-v3' for Solana v3.");
#[cfg(all(feature = "client-v2", feature = "client-v3"))]
compile_error!("Cannot enable both 'client-v2' and 'client-v3' features. Choose one client version.");
#[cfg(all(feature = "solana-v2", feature = "client"))]
pub mod v2_client_compat;
#[cfg(all(feature = "solana-v2", feature = "client"))]
pub mod instruction_compat;
#[cfg(all(feature = "solana-v2", feature = "client"))]
pub use instruction_compat::CompatInstruction;
#[cfg(all(feature = "solana-v2", feature = "client"))]
pub use v2_client_compat::IntoV2Instruction;
#[cfg(all(feature = "solana-v2", feature = "client"))]
impl instruction_compat::mixed_version::IntoInstructionBytes
for anchor_lang::solana_program::instruction::Instruction
{
fn into_bytes(self) -> ([u8; 32], Vec<([u8; 32], bool, bool)>, Vec<u8>) {
let program_id_bytes = self.program_id.to_bytes();
let accounts_data: Vec<([u8; 32], bool, bool)> = self
.accounts
.into_iter()
.map(|meta| (meta.pubkey.to_bytes(), meta.is_signer, meta.is_writable))
.collect();
(program_id_bytes, accounts_data, self.data)
}
}
mod macros;
#[allow(unused_imports)]
use std::sync::Arc;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const SDK_NAME: &str = "switchboard-on-demand";
pub const SUPPORTED_PROGRAM_VERSIONS: &[&str] = &["0.7.0"];
pub const MIN_SOLANA_VERSION: &str = "1.18.0";
pub mod decimal;
pub use decimal::*;
pub mod smallvec;
pub mod on_demand;
pub use on_demand::*;
pub mod utils;
pub use utils::*;
pub mod anchor_traits;
pub use anchor_traits::*;
pub mod program_id;
pub use program_id::*;
pub mod accounts;
pub mod instructions;
pub mod types;
pub mod prelude;
pub mod solana_compat;
pub use solana_compat::{solana_program, AccountMeta, Instruction, Pubkey, SYSTEM_PROGRAM_ID};
#[cfg(feature = "client")]
pub use solana_compat::solana_sdk;
pub mod sysvar;
pub use sysvar::*;
mod account_info_compat;
pub use account_info_compat::{AccountInfo, AsAccountInfo};
cfg_client! {
use anchor_client::solana_sdk::signer::keypair::Keypair;
pub type AnchorClient = anchor_client::Client<Arc<Keypair>>;
pub type RpcClient = anchor_client::solana_client::nonblocking::rpc_client::RpcClient;
pub mod client;
pub fn get_switchboard_on_demand_program_id() -> anchor_lang::prelude::Pubkey {
use anchor_lang::prelude::Pubkey;
if is_devnet() {
Pubkey::from(crate::ON_DEMAND_DEVNET_PID.to_bytes())
} else {
Pubkey::from(crate::ON_DEMAND_MAINNET_PID.to_bytes())
}
}
pub fn is_devnet() -> bool {
cfg!(feature = "devnet") || std::env::var("SB_ENV").unwrap_or_default() == "devnet"
}
pub const STATE_SEED: &[u8] = b"STATE";
pub const ORACLE_FEED_STATS_SEED: &[u8] = b"OracleFeedStats";
pub const ORACLE_RANDOMNESS_STATS_SEED: &[u8] = b"OracleRandomnessStats";
pub const ORACLE_STATS_SEED: &[u8] = b"OracleStats";
pub const LUT_SIGNER_SEED: &[u8] = b"LutSigner";
pub const DELEGATION_SEED: &[u8] = b"Delegation";
pub const DELEGATION_GROUP_SEED: &[u8] = b"Group";
pub const REWARD_POOL_VAULT_SEED: &[u8] = b"RewardPool";
}