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