use solana_pubkey::Pubkey;
use crate::pda::SETTLEMENT_SEED;
pub const STATE_PDA_SEEDS: [&[u8]; 1] = [SETTLEMENT_SEED];
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::fixtures::pubkey_from_seed;
use crate::pda::tests::{assert_canonical_bump, assert_distinct_versions_yield_distinct_pdas};
#[test]
fn find_state_pda_uses_canonical_seeds() {
assert_canonical_bump(find_state_pda, STATE_PDA_SEEDS);
}
#[test]
fn distinct_versions_yield_distinct_state_pdas() {
let program_id = pubkey_from_seed("program id");
let (pda, _) = find_state_pda(&program_id);
assert_distinct_versions_yield_distinct_pdas(&program_id, &pda, &[]);
}
}