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