airdrop-api 0.1.0

Mint and Airdrop Framework on Solana for Sovereign Individuals
Documentation
use steel::*;

use crate::{
    consts::CONFIG_ADDRESS,
    state::{Campaign, Config},
};

pub trait AirdropAccountInfoValidation {
    fn is_config(&self) -> Result<&Self, ProgramError>;
    fn is_campaign(&self) -> Result<&Self, ProgramError>;
}

impl AirdropAccountInfoValidation for AccountInfo<'_> {
    fn is_config(&self) -> Result<&Self, ProgramError> {
        self.has_address(&CONFIG_ADDRESS)?
            .is_type::<Config>(&crate::ID)
    }

    fn is_campaign(&self) -> Result<&Self, ProgramError> {
        self.is_type::<Campaign>(&crate::ID)
    }
}