carbon_token_program_decoder/instructions/
set_authority.rs1use {
2 crate::types::*,
3 alloc::vec::Vec,
4 carbon_core::{borsh, CarbonDeserialize},
5};
6#[derive(
7 CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
8)]
9#[carbon(discriminator = "0x06")]
10pub struct SetAuthority {
11 pub authority_type: AuthorityType,
12 pub new_authority: Option<solana_pubkey::Pubkey>,
13}
14
15pub struct SetAuthorityAccounts {
16 pub account: solana_pubkey::Pubkey,
17 pub authority: solana_pubkey::Pubkey,
18 pub remaining_accounts: Vec<solana_instruction::AccountMeta>,
19}
20
21impl carbon_core::deserialize::ArrangeAccounts for SetAuthority {
22 type ArrangedAccounts = SetAuthorityAccounts;
23
24 fn arrange_accounts(
25 accounts: &[solana_instruction::AccountMeta],
26 ) -> Option<Self::ArrangedAccounts> {
27 let [account, authority, remaining_accounts @ ..] = accounts else {
28 return None;
29 };
30
31 Some(SetAuthorityAccounts {
32 account: account.pubkey,
33 authority: authority.pubkey,
34 remaining_accounts: remaining_accounts.to_vec(),
35 })
36 }
37}