carbon_system_program_decoder/instructions/
authorize_nonce_account.rs

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