carbon_stake_program_decoder/instructions/
authorize_with_seed.rs

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