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