TL;DR, how can I get the address of the person calling an instruction inside my anchor program.
In my anchor program, I want to know the person who is calling my program.
Say I have an instruction that doesn't require a Signer
but I have a list of blocked addresses I don't want to be able to call this instruction, how can I do this in anchor.
I think in Ethereum msg.sender
. How can I do it in an anchor program?
#[derive(Accounts)]
pub struct Expire<'info> {
#[account(mut)]
pub dummy: AccountInfo<'info>,
#[account(
mut,
)]
pub token_account: Account<'info, TokenAccount>,
#[account(mut)]
pub mint: Box<Account<'info, Mint>>,
#[account(mut)]
pub dummyDataAccount: Box<Account<'info, DummyDataAccount>>,
pub system_program: Program<'info, System>,
pub metadata_program: Program<'info, Metadata>,
}
In the above program, dummy can be a user's address or a PDA.
The payer is the dummyDataAccount