pinocchio_token/instructions/
revoke.rs1use solana_account_view::AccountView;
2use solana_instruction_view::{
3 cpi::{invoke_signed, Signer},
4 InstructionAccount, InstructionView,
5};
6use solana_program_error::ProgramResult;
7
8pub struct Revoke<'a> {
14 pub source: &'a AccountView,
16 pub authority: &'a AccountView,
18}
19
20impl Revoke<'_> {
21 #[inline(always)]
22 pub fn invoke(&self) -> ProgramResult {
23 self.invoke_signed(&[])
24 }
25
26 #[inline(always)]
27 pub fn invoke_signed(&self, signers: &[Signer]) -> ProgramResult {
28 let instruction_accounts: [InstructionAccount; 2] = [
30 InstructionAccount::writable(self.source.address()),
31 InstructionAccount::readonly_signer(self.authority.address()),
32 ];
33
34 let instruction = InstructionView {
35 program_id: &crate::ID,
36 accounts: &instruction_accounts,
37 data: &[5],
38 };
39
40 invoke_signed(&instruction, &[self.source, self.authority], signers)
41 }
42}