carbon_stake_program_decoder/instructions/
merge.rs

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