carbon-raydium-launchpad-decoder 2.0.0

Raydium Launchpad Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use carbon_core::{account_utils::next_account, deserialize::ArrangeAccounts};
/// Claim the fee from the exclusive platform fee vault.
/// # Arguments
/// * `ctx` - The context of accounts
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct ClaimPlatformFeeFromVault {}

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ClaimPlatformFeeFromVaultInstructionAccounts {
    pub platform_fee_wallet: solana_pubkey::Pubkey,
    pub fee_vault_authority: solana_pubkey::Pubkey,
    pub platform_config: solana_pubkey::Pubkey,
    pub platform_fee_vault: solana_pubkey::Pubkey,
    pub recipient_token_account: solana_pubkey::Pubkey,
    pub quote_mint: solana_pubkey::Pubkey,
    pub token_program: solana_pubkey::Pubkey,
    pub system_program: solana_pubkey::Pubkey,
    pub associated_token_program: solana_pubkey::Pubkey,
    pub remaining: Vec<solana_instruction::AccountMeta>,
}

impl ClaimPlatformFeeFromVault {
    pub fn decode(data: &[u8]) -> Option<Self> {
        if data.len() < 8 {
            return None;
        }
        let discriminator = &data[0..8];
        if discriminator != [117, 241, 198, 168, 248, 218, 80, 29] {
            return None;
        }

        let mut data_slice = data;

        data_slice = &data_slice[8..];

        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
    }
}

impl ArrangeAccounts for ClaimPlatformFeeFromVault {
    type ArrangedAccounts = ClaimPlatformFeeFromVaultInstructionAccounts;

    fn arrange_accounts(
        accounts: &[solana_instruction::AccountMeta],
    ) -> Option<Self::ArrangedAccounts> {
        let mut iter = accounts.iter();

        let platform_fee_wallet = next_account(&mut iter)?;
        let fee_vault_authority = next_account(&mut iter)?;
        let platform_config = next_account(&mut iter)?;
        let platform_fee_vault = next_account(&mut iter)?;
        let recipient_token_account = next_account(&mut iter)?;
        let quote_mint = next_account(&mut iter)?;
        let token_program = next_account(&mut iter)?;
        let system_program = next_account(&mut iter)?;
        let associated_token_program = next_account(&mut iter)?;

        let remaining = iter.as_slice();

        Some(ClaimPlatformFeeFromVaultInstructionAccounts {
            platform_fee_wallet,
            fee_vault_authority,
            platform_config,
            platform_fee_vault,
            recipient_token_account,
            quote_mint,
            token_program,
            system_program,
            associated_token_program,
            remaining: remaining.to_vec(),
        })
    }
}