use solana_pubkey::Pubkey;
use crate::pda::SETTLEMENT_SEED;
pub fn state_pda_seeds<'a>() -> [&'a [u8]; 1] {
[SETTLEMENT_SEED]
}
pub fn state_pda_signer_seeds(bump: &[u8; 1]) -> [&[u8]; 2] {
let [seed] = state_pda_seeds();
[seed, bump]
}
pub fn find_state_pda(program_id: &Pubkey) -> (Pubkey, u8) {
Pubkey::find_program_address(&state_pda_seeds(), program_id)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::pda::tests::assert_distinct_versions_yield_distinct_pdas;
#[test]
fn find_state_pda_uses_canonical_seeds() {
crate::pda::tests::assert_canonical_bump(find_state_pda, state_pda_seeds());
}
#[test]
fn distinct_versions_yield_distinct_state_pdas() {
let (pda, _) = find_state_pda(&crate::ID);
assert_distinct_versions_yield_distinct_pdas(&pda, &[]);
}
}