limestone_client/pda.rs
1use solana_program::pubkey::Pubkey;
2
3/// Return the PDA and bump seed for the given `from` and `slot` derivation.
4pub fn find_pda(from: &Pubkey, slot: u64) -> (Pubkey, u8) {
5 Pubkey::find_program_address(&[from.as_ref(), &slot.to_le_bytes()], &crate::ID)
6}
7
8/// Return the PDA and bump seed for the given `from`, `slot`, and `base` derivation.
9pub fn find_pda_with_seed(from: &Pubkey, slot: u64, base: &Pubkey) -> (Pubkey, u8) {
10 Pubkey::find_program_address(
11 &[from.as_ref(), &slot.to_le_bytes(), base.as_ref()],
12 &crate::ID,
13 )
14}