hopper/pda.rs
1//! PDA (Program Derived Address) helpers for Hopper programs.
2//!
3//! Re-exports the Hopper-owned PDA functions from hopper-native and provides
4//! additional ergonomic helpers for common patterns.
5//!
6//! PDA functions require Solana syscalls and are only available on BPF targets.
7
8/// Derive a PDA from seeds and a program ID.
9///
10/// Returns the derived address. Fails if the seed combination does not
11/// produce a valid off-curve point.
12#[cfg(target_os = "solana")]
13pub use hopper_runtime::pda::create_program_address;
14
15/// Find a PDA and its bump seed.
16///
17/// Iterates bump seeds from 255 down to 0 until a valid off-curve address
18/// is found. Returns `(address, bump)`.
19#[cfg(target_os = "solana")]
20pub use hopper_runtime::pda::find_program_address;
21
22/// Verify that an account's address matches the expected PDA.
23#[cfg(target_os = "solana")]
24pub use hopper_runtime::pda::verify_pda;
25
26/// Verify a PDA with an explicit bump seed appended to the seed list.
27#[cfg(target_os = "solana")]
28pub use hopper_runtime::pda::verify_pda_with_bump;