carbon_token_program_decoder/instructions/
revoke.rs

1use alloc::vec::Vec;
2use carbon_core::{borsh, CarbonDeserialize};
3#[derive(
4    CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
5)]
6#[carbon(discriminator = "0x05")]
7pub struct Revoke {}
8
9pub struct RevokeAccounts {
10    pub source: solana_pubkey::Pubkey,
11    pub owner: solana_pubkey::Pubkey,
12    pub remaining_accounts: Vec<solana_instruction::AccountMeta>,
13}
14
15impl carbon_core::deserialize::ArrangeAccounts for Revoke {
16    type ArrangedAccounts = RevokeAccounts;
17
18    fn arrange_accounts(
19        accounts: &[solana_instruction::AccountMeta],
20    ) -> Option<Self::ArrangedAccounts> {
21        let [source, owner, remaining_accounts @ ..] = accounts else {
22            return None;
23        };
24
25        Some(RevokeAccounts {
26            source: source.pubkey,
27            owner: owner.pubkey,
28            remaining_accounts: remaining_accounts.to_vec(),
29        })
30    }
31}