Skip to main content

carbon_swig_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{SwigDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod add_authority_v1;
11pub mod close_swig_v1;
12pub mod close_token_account_v1;
13pub mod create_session_v1;
14pub mod create_sub_account_v1;
15pub mod create_v1;
16pub mod deprecated_sign_v1;
17pub mod migrate_to_wallet_address_v1;
18pub mod remove_authority_v1;
19pub mod sign_v2;
20pub mod sub_account_sign_v1;
21pub mod toggle_sub_account_v1;
22pub mod transfer_assets_v1;
23pub mod update_authority_v1;
24pub mod withdraw_from_sub_account_v1;
25
26pub use self::{
27    add_authority_v1::*, close_swig_v1::*, close_token_account_v1::*, create_session_v1::*,
28    create_sub_account_v1::*, create_v1::*, deprecated_sign_v1::*, migrate_to_wallet_address_v1::*,
29    remove_authority_v1::*, sign_v2::*, sub_account_sign_v1::*, toggle_sub_account_v1::*,
30    transfer_assets_v1::*, update_authority_v1::*, withdraw_from_sub_account_v1::*,
31};
32
33#[derive(Debug, Clone, PartialEq)]
34#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
35#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
36pub enum SwigInstruction {
37    AddAuthorityV1 {
38        program_id: solana_pubkey::Pubkey,
39        data: AddAuthorityV1,
40        accounts: AddAuthorityV1InstructionAccounts,
41    },
42    CloseSwigV1 {
43        program_id: solana_pubkey::Pubkey,
44        data: CloseSwigV1,
45        accounts: CloseSwigV1InstructionAccounts,
46    },
47    CloseTokenAccountV1 {
48        program_id: solana_pubkey::Pubkey,
49        data: CloseTokenAccountV1,
50        accounts: CloseTokenAccountV1InstructionAccounts,
51    },
52    CreateSessionV1 {
53        program_id: solana_pubkey::Pubkey,
54        data: CreateSessionV1,
55        accounts: CreateSessionV1InstructionAccounts,
56    },
57    CreateSubAccountV1 {
58        program_id: solana_pubkey::Pubkey,
59        data: CreateSubAccountV1,
60        accounts: CreateSubAccountV1InstructionAccounts,
61    },
62    CreateV1 {
63        program_id: solana_pubkey::Pubkey,
64        data: CreateV1,
65        accounts: CreateV1InstructionAccounts,
66    },
67    DeprecatedSignV1 {
68        program_id: solana_pubkey::Pubkey,
69        data: DeprecatedSignV1,
70        accounts: DeprecatedSignV1InstructionAccounts,
71    },
72    MigrateToWalletAddressV1 {
73        program_id: solana_pubkey::Pubkey,
74        data: MigrateToWalletAddressV1,
75        accounts: MigrateToWalletAddressV1InstructionAccounts,
76    },
77    RemoveAuthorityV1 {
78        program_id: solana_pubkey::Pubkey,
79        data: RemoveAuthorityV1,
80        accounts: RemoveAuthorityV1InstructionAccounts,
81    },
82    SignV2 {
83        program_id: solana_pubkey::Pubkey,
84        data: SignV2,
85        accounts: SignV2InstructionAccounts,
86    },
87    SubAccountSignV1 {
88        program_id: solana_pubkey::Pubkey,
89        data: SubAccountSignV1,
90        accounts: SubAccountSignV1InstructionAccounts,
91    },
92    ToggleSubAccountV1 {
93        program_id: solana_pubkey::Pubkey,
94        data: ToggleSubAccountV1,
95        accounts: ToggleSubAccountV1InstructionAccounts,
96    },
97    TransferAssetsV1 {
98        program_id: solana_pubkey::Pubkey,
99        data: TransferAssetsV1,
100        accounts: TransferAssetsV1InstructionAccounts,
101    },
102    UpdateAuthorityV1 {
103        program_id: solana_pubkey::Pubkey,
104        data: UpdateAuthorityV1,
105        accounts: UpdateAuthorityV1InstructionAccounts,
106    },
107    WithdrawFromSubAccountV1 {
108        program_id: solana_pubkey::Pubkey,
109        data: WithdrawFromSubAccountV1,
110        accounts: WithdrawFromSubAccountV1InstructionAccounts,
111    },
112}
113
114impl carbon_core::instruction::InstructionDecoder<'_> for SwigDecoder {
115    type InstructionType = SwigInstruction;
116
117    fn decode_instruction(
118        &self,
119        instruction: &solana_instruction::Instruction,
120    ) -> Option<Self::InstructionType> {
121        if instruction.program_id != PROGRAM_ID {
122            return None;
123        }
124
125        carbon_core::try_decode_instructions!(
126            instruction,
127            PROGRAM_ID,
128            SwigInstruction::AddAuthorityV1 => AddAuthorityV1,
129            SwigInstruction::CloseSwigV1 => CloseSwigV1,
130            SwigInstruction::CloseTokenAccountV1 => CloseTokenAccountV1,
131            SwigInstruction::CreateSessionV1 => CreateSessionV1,
132            SwigInstruction::CreateSubAccountV1 => CreateSubAccountV1,
133            SwigInstruction::CreateV1 => CreateV1,
134            SwigInstruction::DeprecatedSignV1 => DeprecatedSignV1,
135            SwigInstruction::MigrateToWalletAddressV1 => MigrateToWalletAddressV1,
136            SwigInstruction::RemoveAuthorityV1 => RemoveAuthorityV1,
137            SwigInstruction::SignV2 => SignV2,
138            SwigInstruction::SubAccountSignV1 => SubAccountSignV1,
139            SwigInstruction::ToggleSubAccountV1 => ToggleSubAccountV1,
140            SwigInstruction::TransferAssetsV1 => TransferAssetsV1,
141            SwigInstruction::UpdateAuthorityV1 => UpdateAuthorityV1,
142            SwigInstruction::WithdrawFromSubAccountV1 => WithdrawFromSubAccountV1,
143        )
144    }
145}