carbon_stake_program_decoder/instructions/
authorize_checked.rs

1use super::super::types::*;
2
3use carbon_core::{borsh, CarbonDeserialize};
4
5#[derive(
6    CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
7)]
8#[carbon(discriminator = "0x9361431ae66b2df2")]
9pub struct AuthorizeChecked {
10    pub stake_authorize: StakeAuthorize,
11}
12
13pub struct AuthorizeCheckedInstructionAccounts {
14    pub stake: solana_pubkey::Pubkey,
15    pub clock: solana_pubkey::Pubkey,
16    pub authority: solana_pubkey::Pubkey,
17    pub new_authority: solana_pubkey::Pubkey,
18}
19
20impl carbon_core::deserialize::ArrangeAccounts for AuthorizeChecked {
21    type ArrangedAccounts = AuthorizeCheckedInstructionAccounts;
22
23    fn arrange_accounts(
24        accounts: &[solana_instruction::AccountMeta],
25    ) -> Option<Self::ArrangedAccounts> {
26        let [stake, clock, authority, new_authority, _remaining @ ..] = accounts else {
27            return None;
28        };
29
30        Some(AuthorizeCheckedInstructionAccounts {
31            stake: stake.pubkey,
32            clock: clock.pubkey,
33            authority: authority.pubkey,
34            new_authority: new_authority.pubkey,
35        })
36    }
37}