carbon_jupiter_perpetuals_decoder/instructions/
decrease_position_with_internal_swap.rs1use super::super::types::*;
2
3use carbon_core::{borsh, CarbonDeserialize};
4
5#[derive(
6 CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone, Hash,
7)]
8#[carbon(discriminator = "0x8311996e77646126")]
9pub struct DecreasePositionWithInternalSwap {
10 pub params: DecreasePositionWithInternalSwapParams,
11}
12
13pub struct DecreasePositionWithInternalSwapInstructionAccounts {
14 pub keeper: solana_pubkey::Pubkey,
15 pub owner: solana_pubkey::Pubkey,
16 pub transfer_authority: solana_pubkey::Pubkey,
17 pub perpetuals: solana_pubkey::Pubkey,
18 pub pool: solana_pubkey::Pubkey,
19 pub position_request: solana_pubkey::Pubkey,
20 pub position_request_ata: solana_pubkey::Pubkey,
21 pub position: solana_pubkey::Pubkey,
22 pub custody: solana_pubkey::Pubkey,
23 pub custody_doves_price_account: solana_pubkey::Pubkey,
24 pub custody_pythnet_price_account: solana_pubkey::Pubkey,
25 pub collateral_custody: solana_pubkey::Pubkey,
26 pub collateral_custody_doves_price_account: solana_pubkey::Pubkey,
27 pub collateral_custody_pythnet_price_account: solana_pubkey::Pubkey,
28 pub collateral_custody_token_account: solana_pubkey::Pubkey,
29 pub dispensing_custody: solana_pubkey::Pubkey,
30 pub dispensing_custody_doves_price_account: solana_pubkey::Pubkey,
31 pub dispensing_custody_pythnet_price_account: solana_pubkey::Pubkey,
32 pub dispensing_custody_token_account: solana_pubkey::Pubkey,
33 pub token_program: solana_pubkey::Pubkey,
34 pub event_authority: solana_pubkey::Pubkey,
35 pub program: solana_pubkey::Pubkey,
36}
37
38impl carbon_core::deserialize::ArrangeAccounts for DecreasePositionWithInternalSwap {
39 type ArrangedAccounts = DecreasePositionWithInternalSwapInstructionAccounts;
40
41 fn arrange_accounts(
42 accounts: &[solana_instruction::AccountMeta],
43 ) -> Option<Self::ArrangedAccounts> {
44 let [keeper, owner, transfer_authority, perpetuals, pool, position_request, position_request_ata, position, custody, custody_doves_price_account, custody_pythnet_price_account, collateral_custody, collateral_custody_doves_price_account, collateral_custody_pythnet_price_account, collateral_custody_token_account, dispensing_custody, dispensing_custody_doves_price_account, dispensing_custody_pythnet_price_account, dispensing_custody_token_account, token_program, event_authority, program, _remaining @ ..] =
45 accounts
46 else {
47 return None;
48 };
49
50 Some(DecreasePositionWithInternalSwapInstructionAccounts {
51 keeper: keeper.pubkey,
52 owner: owner.pubkey,
53 transfer_authority: transfer_authority.pubkey,
54 perpetuals: perpetuals.pubkey,
55 pool: pool.pubkey,
56 position_request: position_request.pubkey,
57 position_request_ata: position_request_ata.pubkey,
58 position: position.pubkey,
59 custody: custody.pubkey,
60 custody_doves_price_account: custody_doves_price_account.pubkey,
61 custody_pythnet_price_account: custody_pythnet_price_account.pubkey,
62 collateral_custody: collateral_custody.pubkey,
63 collateral_custody_doves_price_account: collateral_custody_doves_price_account.pubkey,
64 collateral_custody_pythnet_price_account: collateral_custody_pythnet_price_account
65 .pubkey,
66 collateral_custody_token_account: collateral_custody_token_account.pubkey,
67 dispensing_custody: dispensing_custody.pubkey,
68 dispensing_custody_doves_price_account: dispensing_custody_doves_price_account.pubkey,
69 dispensing_custody_pythnet_price_account: dispensing_custody_pythnet_price_account
70 .pubkey,
71 dispensing_custody_token_account: dispensing_custody_token_account.pubkey,
72 token_program: token_program.pubkey,
73 event_authority: event_authority.pubkey,
74 program: program.pubkey,
75 })
76 }
77}