token_signer/
account_validators.rs

1use crate::InvokeSignedInstruction;
2use anchor_lang::prelude::*;
3use vipers::{assert_keys_eq, invariant, validate::Validate};
4
5impl<'info> Validate<'info> for InvokeSignedInstruction<'info> {
6    fn validate(&self) -> Result<()> {
7        // NFT account must be owned by the `owner_authority`.
8        assert_keys_eq!(
9            self.owner_authority,
10            self.nft_account.owner,
11            "owner_authority"
12        );
13
14        // Check NFT ownership.
15        invariant!(self.nft_account.amount == 1, Unauthorized);
16
17        Ok(())
18    }
19}