diff --git a/rust/switchboard-solana/Cargo.lock b/rust/switchboard-solana/Cargo.lock index a2de650..23ffc6c 100644 --- a/rust/switchboard-solana/Cargo.lock +++ b/rust/switchboard-solana/Cargo.lock @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "switchboard-solana" -version = "0.3.9" +version = "0.3.10" dependencies = [ "anchor-client", "anchor-lang", diff --git a/rust/switchboard-solana/src/lib.rs b/rust/switchboard-solana/src/lib.rs index 076a0e3..10a2f8d 100644 --- a/rust/switchboard-solana/src/lib.rs +++ b/rust/switchboard-solana/src/lib.rs @@ -13,6 +13,9 @@ pub use attestation_program::*; pub use switchboard_common::{Chain, Error as SwitchboardClientError, FunctionResult}; +pub mod seeds; +pub use seeds::*; + pub mod accounts; pub mod instructions; pub mod types; @@ -27,30 +30,6 @@ cfg_client! { pub use sgx::*; } -/// Seed used to derive the SbState PDA. -pub const STATE_SEED: &[u8] = b"STATE"; - -/// Seed used to derive the PermissionAccountData PDA. -pub const PERMISSION_SEED: &[u8] = b"PermissionAccountData"; - -/// Seed used to derive the LeaseAccountData PDA. -pub const LEASE_SEED: &[u8] = b"LeaseAccountData"; - -/// Seed used to derive the OracleAccountData PDA. -pub const ORACLE_SEED: &[u8] = b"OracleAccountData"; - -/// Seed used to derive the SlidingWindow PDA. -pub const SLIDING_RESULT_SEED: &[u8] = b"SlidingResultAccountData"; - -/// Discriminator used for Switchboard buffer accounts. -pub const BUFFER_DISCRIMINATOR: &[u8] = b"BUFFERxx"; - -/// Seed used to derive the FunctionAccountData PDA. -pub const FUNCTION_SEED: &[u8] = b"FunctionAccountData"; - -/// Seed used to derive the QuoteAccountData PDA. -pub const QUOTE_SEED: &[u8] = b"QuoteAccountData"; - /// Program id for the Switchboard oracle program /// SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f pub const SWITCHBOARD_PROGRAM_ID: anchor_lang::solana_program::pubkey::Pubkey = diff --git a/rust/switchboard-solana/src/macros.rs b/rust/switchboard-solana/src/macros.rs index 8495b2b..74d9508 100644 --- a/rust/switchboard-solana/src/macros.rs +++ b/rust/switchboard-solana/src/macros.rs @@ -12,6 +12,9 @@ macro_rules! cfg_client { #[macro_export] macro_rules! cfg_not_client { ($($item:item)*) => { - $( #[cfg(not(feature = "client"))] $item )* + $( + #[cfg(not(feature = "client"))] + $item + )* } } diff --git a/rust/switchboard-solana/src/prelude.rs b/rust/switchboard-solana/src/prelude.rs index 360bd7d..3d6ff62 100644 --- a/rust/switchboard-solana/src/prelude.rs +++ b/rust/switchboard-solana/src/prelude.rs @@ -2,6 +2,7 @@ use crate::{cfg_client, cfg_not_client}; pub use crate::accounts::*; pub use crate::instructions::*; +pub use crate::seeds::*; pub use crate::types::*; pub use crate::{SWITCHBOARD_ATTESTATION_PROGRAM_ID, SWITCHBOARD_PROGRAM_ID}; @@ -13,6 +14,7 @@ cfg_client! { pub use crate::client::*; pub use crate::sgx::*; + pub use anchor_client; pub use anchor_client::anchor_lang; pub use anchor_client::solana_client; diff --git a/rust/switchboard-solana/src/seeds.rs b/rust/switchboard-solana/src/seeds.rs new file mode 100644 index 0000000..0d43345 --- /dev/null +++ b/rust/switchboard-solana/src/seeds.rs @@ -0,0 +1,23 @@ +/// Seed used to derive the SbState PDA. +pub const STATE_SEED: &[u8] = b"STATE"; + +/// Seed used to derive the PermissionAccountData PDA. +pub const PERMISSION_SEED: &[u8] = b"PermissionAccountData"; + +/// Seed used to derive the LeaseAccountData PDA. +pub const LEASE_SEED: &[u8] = b"LeaseAccountData"; + +/// Seed used to derive the OracleAccountData PDA. +pub const ORACLE_SEED: &[u8] = b"OracleAccountData"; + +/// Seed used to derive the SlidingWindow PDA. +pub const SLIDING_RESULT_SEED: &[u8] = b"SlidingResultAccountData"; + +/// Discriminator used for Switchboard buffer accounts. +pub const BUFFER_DISCRIMINATOR: &[u8] = b"BUFFERxx"; + +/// Seed used to derive the FunctionAccountData PDA. +pub const FUNCTION_SEED: &[u8] = b"FunctionAccountData"; + +/// Seed used to derive the QuoteAccountData PDA. +pub const QUOTE_SEED: &[u8] = b"QuoteAccountData";