carbon_stake_program_decoder/instructions/
authorize.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 = "0xadc166d2db897178")]
9pub struct Authorize {
10    pub new_authority: solana_pubkey::Pubkey,
11    pub stake_authorize: StakeAuthorize,
12}
13
14pub struct AuthorizeInstructionAccounts {
15    pub stake: solana_pubkey::Pubkey,
16    pub clock: solana_pubkey::Pubkey,
17    pub authority: solana_pubkey::Pubkey,
18}
19
20impl carbon_core::deserialize::ArrangeAccounts for Authorize {
21    type ArrangedAccounts = AuthorizeInstructionAccounts;
22
23    fn arrange_accounts(
24        accounts: &[solana_instruction::AccountMeta],
25    ) -> Option<Self::ArrangedAccounts> {
26        let [stake, clock, authority, _remaining @ ..] = accounts else {
27            return None;
28        };
29
30        Some(AuthorizeInstructionAccounts {
31            stake: stake.pubkey,
32            clock: clock.pubkey,
33            authority: authority.pubkey,
34        })
35    }
36}