use crate::{SwigDecoder, PROGRAM_ID};
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "graphql")]
pub mod graphql;
pub mod add_authority_v1;
pub mod close_swig_v1;
pub mod close_token_account_v1;
pub mod create_session_v1;
pub mod create_sub_account_v1;
pub mod create_v1;
pub mod deprecated_sign_v1;
pub mod migrate_to_wallet_address_v1;
pub mod remove_authority_v1;
pub mod sign_v2;
pub mod sub_account_sign_v1;
pub mod toggle_sub_account_v1;
pub mod transfer_assets_v1;
pub mod update_authority_v1;
pub mod withdraw_from_sub_account_v1;
pub use self::{
add_authority_v1::*, close_swig_v1::*, close_token_account_v1::*, create_session_v1::*,
create_sub_account_v1::*, create_v1::*, deprecated_sign_v1::*, migrate_to_wallet_address_v1::*,
remove_authority_v1::*, sign_v2::*, sub_account_sign_v1::*, toggle_sub_account_v1::*,
transfer_assets_v1::*, update_authority_v1::*, withdraw_from_sub_account_v1::*,
};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum SwigInstruction {
AddAuthorityV1 {
program_id: solana_pubkey::Pubkey,
data: AddAuthorityV1,
accounts: AddAuthorityV1InstructionAccounts,
},
CloseSwigV1 {
program_id: solana_pubkey::Pubkey,
data: CloseSwigV1,
accounts: CloseSwigV1InstructionAccounts,
},
CloseTokenAccountV1 {
program_id: solana_pubkey::Pubkey,
data: CloseTokenAccountV1,
accounts: CloseTokenAccountV1InstructionAccounts,
},
CreateSessionV1 {
program_id: solana_pubkey::Pubkey,
data: CreateSessionV1,
accounts: CreateSessionV1InstructionAccounts,
},
CreateSubAccountV1 {
program_id: solana_pubkey::Pubkey,
data: CreateSubAccountV1,
accounts: CreateSubAccountV1InstructionAccounts,
},
CreateV1 {
program_id: solana_pubkey::Pubkey,
data: CreateV1,
accounts: CreateV1InstructionAccounts,
},
DeprecatedSignV1 {
program_id: solana_pubkey::Pubkey,
data: DeprecatedSignV1,
accounts: DeprecatedSignV1InstructionAccounts,
},
MigrateToWalletAddressV1 {
program_id: solana_pubkey::Pubkey,
data: MigrateToWalletAddressV1,
accounts: MigrateToWalletAddressV1InstructionAccounts,
},
RemoveAuthorityV1 {
program_id: solana_pubkey::Pubkey,
data: RemoveAuthorityV1,
accounts: RemoveAuthorityV1InstructionAccounts,
},
SignV2 {
program_id: solana_pubkey::Pubkey,
data: SignV2,
accounts: SignV2InstructionAccounts,
},
SubAccountSignV1 {
program_id: solana_pubkey::Pubkey,
data: SubAccountSignV1,
accounts: SubAccountSignV1InstructionAccounts,
},
ToggleSubAccountV1 {
program_id: solana_pubkey::Pubkey,
data: ToggleSubAccountV1,
accounts: ToggleSubAccountV1InstructionAccounts,
},
TransferAssetsV1 {
program_id: solana_pubkey::Pubkey,
data: TransferAssetsV1,
accounts: TransferAssetsV1InstructionAccounts,
},
UpdateAuthorityV1 {
program_id: solana_pubkey::Pubkey,
data: UpdateAuthorityV1,
accounts: UpdateAuthorityV1InstructionAccounts,
},
WithdrawFromSubAccountV1 {
program_id: solana_pubkey::Pubkey,
data: WithdrawFromSubAccountV1,
accounts: WithdrawFromSubAccountV1InstructionAccounts,
},
}
impl carbon_core::instruction::InstructionDecoder<'_> for SwigDecoder {
type InstructionType = SwigInstruction;
fn decode_instruction(
&self,
instruction: &solana_instruction::Instruction,
) -> Option<Self::InstructionType> {
if instruction.program_id != PROGRAM_ID {
return None;
}
carbon_core::try_decode_instructions!(
instruction,
PROGRAM_ID,
SwigInstruction::AddAuthorityV1 => AddAuthorityV1,
SwigInstruction::CloseSwigV1 => CloseSwigV1,
SwigInstruction::CloseTokenAccountV1 => CloseTokenAccountV1,
SwigInstruction::CreateSessionV1 => CreateSessionV1,
SwigInstruction::CreateSubAccountV1 => CreateSubAccountV1,
SwigInstruction::CreateV1 => CreateV1,
SwigInstruction::DeprecatedSignV1 => DeprecatedSignV1,
SwigInstruction::MigrateToWalletAddressV1 => MigrateToWalletAddressV1,
SwigInstruction::RemoveAuthorityV1 => RemoveAuthorityV1,
SwigInstruction::SignV2 => SignV2,
SwigInstruction::SubAccountSignV1 => SubAccountSignV1,
SwigInstruction::ToggleSubAccountV1 => ToggleSubAccountV1,
SwigInstruction::TransferAssetsV1 => TransferAssetsV1,
SwigInstruction::UpdateAuthorityV1 => UpdateAuthorityV1,
SwigInstruction::WithdrawFromSubAccountV1 => WithdrawFromSubAccountV1,
)
}
}