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