use steel::*;
use crate::{
consts::*,
state::{AuthorityTransfer, Config, SplitVault},
};
pub trait SettlementAccountInfoValidation {
fn is_config(&self) -> Result<&Self, ProgramError>;
fn is_split_vault(&self) -> Result<&Self, ProgramError>;
fn is_authority_transfer(&self) -> Result<&Self, ProgramError>;
}
impl SettlementAccountInfoValidation for AccountInfo<'_> {
fn is_config(&self) -> Result<&Self, ProgramError> {
self.has_address(&CONFIG_ADDRESS)?
.is_type::<Config>(&crate::ID)
}
fn is_split_vault(&self) -> Result<&Self, ProgramError> {
self.is_type::<SplitVault>(&crate::ID)
}
fn is_authority_transfer(&self) -> Result<&Self, ProgramError> {
self.is_type::<AuthorityTransfer>(&crate::ID)
}
}