From 4c26a1601a80167e2b32878cacdb6542d4c801bb Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 5 Dec 2025 19:43:25 +0530 Subject: [PATCH 1/5] feat: add versioned decoders support --- crates/core/src/account.rs | 132 ++++++++- crates/core/src/instruction.rs | 486 ++++++++++++++++++++++++++++++++- crates/proc-macros/src/lib.rs | 6 +- 3 files changed, 615 insertions(+), 9 deletions(-) diff --git a/crates/core/src/account.rs b/crates/core/src/account.rs index d37497a0a..78b808d24 100644 --- a/crates/core/src/account.rs +++ b/crates/core/src/account.rs @@ -52,7 +52,8 @@ use { crate::{ - error::CarbonResult, filter::Filter, metrics::MetricsCollection, processor::Processor, + error::CarbonResult, filter::Filter, instruction::SlotRange, metrics::MetricsCollection, + processor::Processor, }, async_trait::async_trait, solana_pubkey::Pubkey, @@ -124,6 +125,7 @@ pub trait AccountDecoder<'a> { fn decode_account( &self, account: &'a solana_account::Account, + metadata: Option<&'a AccountMetadata>, ) -> Option>; } @@ -191,7 +193,10 @@ impl AccountPipes for AccountPipe { ) -> CarbonResult<()> { log::trace!("AccountPipe::run(account_with_metadata: {account_with_metadata:?}, metrics)",); - if let Some(decoded_account) = self.decoder.decode_account(&account_with_metadata.1) { + if let Some(decoded_account) = self + .decoder + .decode_account(&account_with_metadata.1, Some(&account_with_metadata.0)) + { self.processor .process( ( @@ -210,3 +215,126 @@ impl AccountPipes for AccountPipe { &self.filters } } + +/// Routes to different account decoders based on slot ranges. +/// +/// `T`: The unified account type that all decoders must return. +/// For decoders with different types, use `VersionedAccountDecoderEnum` instead. +pub struct VersionedAccountDecoder { + versions: Vec<( + SlotRange, + Box AccountDecoder<'a, AccountType = T> + Send + Sync + 'static>, + )>, +} + +impl VersionedAccountDecoder { + /// Creates a new VersionedAccountDecoder. + pub fn new() -> Self { + Self { + versions: Vec::new(), + } + } + + /// Adds a decoder for a specific slot range + pub fn add_version( + mut self, + slot_range: SlotRange, + decoder: impl for<'a> AccountDecoder<'a, AccountType = T> + Send + Sync + 'static, + ) -> Self { + self.versions.push((slot_range, Box::new(decoder))); + self + } +} + +impl Default for VersionedAccountDecoder { + fn default() -> Self { + Self::new() + } +} + +impl<'a, T> AccountDecoder<'a> for VersionedAccountDecoder { + type AccountType = T; + + fn decode_account( + &self, + account: &'a solana_account::Account, + metadata: Option<&'a AccountMetadata>, + ) -> Option> { + let metadata = metadata?; + let slot = metadata.slot; + + for (range, decoder) in &self.versions { + if range.contains(slot) { + return decoder.decode_account(account, Some(metadata)); + } + } + None + } +} + +/// Routes to different account decoders based on slot ranges, wrapping results into a unified enum. +/// +/// `E`: The unified enum type that wraps all version-specific account types. +pub struct VersionedAccountDecoderEnum { + versions: Vec<( + SlotRange, + Box< + dyn for<'b> Fn( + &'b solana_account::Account, + Option<&'b AccountMetadata>, + ) -> Option> + + Send + + Sync, + >, + )>, +} + +impl VersionedAccountDecoderEnum { + /// Creates a new VersionedAccountDecoderEnum. + pub fn new() -> Self { + Self { + versions: Vec::new(), + } + } + + /// Adds a decoder for a specific slot range with a mapper function. + pub fn add_version(mut self, slot_range: SlotRange, decoder: D, mapper: F) -> Self + where + D: for<'a> AccountDecoder<'a, AccountType = T> + Send + Sync + 'static, + F: Fn(DecodedAccount) -> DecodedAccount + Send + Sync + 'static, + { + let mapper = Box::new( + move |account: &'_ solana_account::Account, metadata: Option<&'_ AccountMetadata>| { + decoder.decode_account(account, metadata).map(&mapper) + }, + ); + self.versions.push((slot_range, mapper)); + self + } +} + +impl Default for VersionedAccountDecoderEnum { + fn default() -> Self { + Self::new() + } +} + +impl<'a, E> AccountDecoder<'a> for VersionedAccountDecoderEnum { + type AccountType = E; + + fn decode_account( + &self, + account: &'a solana_account::Account, + metadata: Option<&'a AccountMetadata>, + ) -> Option> { + let metadata = metadata?; + let slot = metadata.slot; + + for (range, decoder_fn) in &self.versions { + if range.contains(slot) { + return decoder_fn(account, Some(metadata)); + } + } + None + } +} diff --git a/crates/core/src/instruction.rs b/crates/core/src/instruction.rs index af449984e..2930f81cf 100644 --- a/crates/core/src/instruction.rs +++ b/crates/core/src/instruction.rs @@ -177,6 +177,244 @@ impl InstructionMetadata { pub type InstructionsWithMetadata = Vec<(InstructionMetadata, solana_instruction::Instruction)>; +/// Slot range for filtering instructions. Both bounds are optional and inclusive. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct SlotRange { + pub min_slot: Option, + pub max_slot: Option, +} + +impl SlotRange { + /// Creates a new SlotRange. + pub fn new(min_slot: Option, max_slot: Option) -> Self { + Self { min_slot, max_slot } + } + + /// Checks if a slot is within this range. + pub fn contains(&self, slot: u64) -> bool { + if let Some(min) = self.min_slot { + if slot < min { + return false; + } + } + if let Some(max) = self.max_slot { + if slot > max { + return false; + } + } + true + } + + /// Creates a range that matches all slots. + pub fn all() -> Self { + Self { + min_slot: None, + max_slot: None, + } + } + + /// Creates a range from a minimum slot (inclusive). + pub fn from(min_slot: u64) -> Self { + Self { + min_slot: Some(min_slot), + max_slot: None, + } + } + + /// Creates a range up to a maximum slot (inclusive). + pub fn to(max_slot: u64) -> Self { + Self { + min_slot: None, + max_slot: Some(max_slot), + } + } + + /// Creates a range between two slots (inclusive). + pub fn between(min_slot: u64, max_slot: u64) -> Self { + Self { + min_slot: Some(min_slot), + max_slot: Some(max_slot), + } + } +} + +/// Routes to multiple decoder versions with two strategies: +/// 1. Slot-based routing: routes based on slot when ranges are provided +/// 2. Sequential fallback: tries decoders sequentially when ranges are `None` or metadata is missing +/// +/// `T`: The unified instruction type that all decoders must return. +/// For decoders with different types, use `VersionedDecoderEnum` instead. +pub struct VersionedDecoder { + versions: Vec<( + Option, + Box InstructionDecoder<'a, InstructionType = T> + Send + Sync + 'static>, + )>, +} + +impl VersionedDecoder { + /// Creates a new VersionedDecoder. + pub fn new() -> Self { + Self { + versions: Vec::new(), + } + } + + /// Adds a decoder with an optional slot range. If `None`, uses sequential fallback. + pub fn add_version( + mut self, + decoder: impl for<'a> InstructionDecoder<'a, InstructionType = T> + Send + Sync + 'static, + slot_range: Option, + ) -> Self { + self.versions.push((slot_range, Box::new(decoder))); + self + } +} + +impl Default for VersionedDecoder { + fn default() -> Self { + Self::new() + } +} + +impl<'a, T> InstructionDecoder<'a> for VersionedDecoder { + type InstructionType = T; + + fn decode_instruction( + &self, + instruction: &'a solana_instruction::Instruction, + metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + let mut slot_based_decoders = Vec::new(); + let mut fallback_decoders = Vec::new(); + + for (slot_range, decoder) in &self.versions { + if let Some(range) = slot_range { + slot_based_decoders.push((range, decoder)); + } else { + fallback_decoders.push(decoder); + } + } + + if let Some(metadata) = metadata { + let slot = metadata.transaction_metadata.slot; + for (range, decoder) in &slot_based_decoders { + if range.contains(slot) { + if let Some(result) = decoder.decode_instruction(instruction, Some(metadata)) { + return Some(result); + } + } + } + if !slot_based_decoders.is_empty() { + return None; + } + } + + for decoder in &fallback_decoders { + if let Some(result) = decoder.decode_instruction(instruction, metadata) { + return Some(result); + } + } + None + } +} + +/// Routes to multiple decoder versions, wrapping results into a unified enum type. +/// +/// `E`: The unified enum type that wraps all version-specific instruction types. +pub struct VersionedDecoderEnum { + versions: Vec<( + Option, + Box< + dyn for<'b> Fn( + &'b solana_instruction::Instruction, + Option<&'b InstructionMetadata>, + ) -> Option> + + Send + + Sync, + >, + )>, +} + +impl VersionedDecoderEnum { + /// Creates a new VersionedDecoderEnum. + pub fn new() -> Self { + Self { + versions: Vec::new(), + } + } + + /// Adds a decoder with a mapper function and an optional slot range. If `None`, uses sequential fallback. + pub fn add_version( + mut self, + decoder: D, + mapper: F, + slot_range: Option, + ) -> Self + where + D: for<'a> InstructionDecoder<'a, InstructionType = T> + Send + Sync + 'static, + F: Fn(DecodedInstruction) -> DecodedInstruction + Send + Sync + 'static, + { + let mapper = Box::new( + move |instruction: &'_ solana_instruction::Instruction, + metadata: Option<&'_ InstructionMetadata>| { + decoder + .decode_instruction(instruction, metadata) + .map(&mapper) + }, + ); + self.versions.push((slot_range, mapper)); + self + } +} + +impl Default for VersionedDecoderEnum { + fn default() -> Self { + Self::new() + } +} + +impl<'a, E> InstructionDecoder<'a> for VersionedDecoderEnum { + type InstructionType = E; + + fn decode_instruction( + &self, + instruction: &'a solana_instruction::Instruction, + metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + let mut slot_based_decoders = Vec::new(); + let mut fallback_decoders = Vec::new(); + + for (slot_range, decoder_fn) in &self.versions { + if let Some(range) = slot_range { + slot_based_decoders.push((range, decoder_fn)); + } else { + fallback_decoders.push(decoder_fn); + } + } + if let Some(metadata) = metadata { + let slot = metadata.transaction_metadata.slot; + for (range, decoder_fn) in &slot_based_decoders { + if range.contains(slot) { + if let Some(result) = decoder_fn(instruction, Some(metadata)) { + return Some(result); + } + } + } + } + + for decoder_fn in slot_based_decoders + .iter() + .map(|(_, d)| d) + .chain(fallback_decoders.iter()) + { + if let Some(result) = decoder_fn(instruction, metadata) { + return Some(result); + } + } + None + } +} + /// A decoded instruction containing program ID, data, and associated accounts. /// /// The `DecodedInstruction` struct represents the outcome of decoding a raw @@ -222,6 +460,7 @@ pub trait InstructionDecoder<'a> { fn decode_instruction( &self, instruction: &'a solana_instruction::Instruction, + metadata: Option<&'a InstructionMetadata>, ) -> Option>; } @@ -294,10 +533,10 @@ impl InstructionPipes<'_> for InstructionPipe { ) -> CarbonResult<()> { log::trace!("InstructionPipe::run(nested_instruction: {nested_instruction:?}, metrics)",); - if let Some(decoded_instruction) = self - .decoder - .decode_instruction(&nested_instruction.instruction) - { + if let Some(decoded_instruction) = self.decoder.decode_instruction( + &nested_instruction.instruction, + Some(&nested_instruction.metadata), + ) { self.processor .process( ( @@ -564,4 +803,243 @@ mod tests { .expect("decode base64") ); } + + #[test] + fn test_slot_range_all() { + let range = SlotRange::all(); + assert!(range.contains(0)); + assert!(range.contains(1000)); + assert!(range.contains(u64::MAX)); + } + + #[test] + fn test_slot_range_from() { + let range = SlotRange::from(100); + assert!(!range.contains(99)); + assert!(range.contains(100)); + assert!(range.contains(1000)); + assert!(range.contains(u64::MAX)); + } + + #[test] + fn test_slot_range_to() { + let range = SlotRange::to(100); + assert!(range.contains(0)); + assert!(range.contains(100)); + assert!(!range.contains(101)); + assert!(!range.contains(u64::MAX)); + } + + #[test] + fn test_slot_range_between() { + let range = SlotRange::between(100, 200); + assert!(!range.contains(99)); + assert!(range.contains(100)); + assert!(range.contains(150)); + assert!(range.contains(200)); + assert!(!range.contains(201)); + // Test single slot case (min == max) + let single_slot = SlotRange::between(100, 100); + assert!(!single_slot.contains(99)); + assert!(single_slot.contains(100)); + assert!(!single_slot.contains(101)); + } + + // Test helper: A decoder that always succeeds + struct TestDecoder; + + impl<'a> InstructionDecoder<'a> for TestDecoder { + type InstructionType = String; + + fn decode_instruction( + &self, + instruction: &'a solana_instruction::Instruction, + _metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + Some(DecodedInstruction { + program_id: instruction.program_id, + data: "decoded".to_string(), + accounts: instruction.accounts.clone(), + }) + } + } + + fn create_metadata_with_slot(slot: u64) -> InstructionMetadata { + InstructionMetadata { + transaction_metadata: Arc::new(TransactionMetadata { + slot, + ..Default::default() + }), + stack_height: 1, + index: 0, + absolute_path: vec![0], + } + } + + #[test] + fn test_versioned_decoder_filters_by_range() { + let range = SlotRange::between(100, 200); + let decoder = VersionedDecoder::new().add_version(TestDecoder, Some(range)); + let instruction = Instruction { + program_id: Pubkey::new_unique(), + accounts: vec![], + data: vec![], + }; + + // Slot within range - should decode + let metadata_in_range = create_metadata_with_slot(150); + let result = decoder.decode_instruction(&instruction, Some(&metadata_in_range)); + assert!(result.is_some()); + assert_eq!(result.unwrap().data, "decoded"); + + // Slot below range - should return None + let metadata_below = create_metadata_with_slot(99); + let result = decoder.decode_instruction(&instruction, Some(&metadata_below)); + assert!(result.is_none()); + + // Slot above range - should return None + let metadata_above = create_metadata_with_slot(201); + let result = decoder.decode_instruction(&instruction, Some(&metadata_above)); + assert!(result.is_none()); + + // Slot at boundary - should decode + let metadata_min = create_metadata_with_slot(100); + let result = decoder.decode_instruction(&instruction, Some(&metadata_min)); + assert!(result.is_some()); + + let metadata_max = create_metadata_with_slot(200); + let result = decoder.decode_instruction(&instruction, Some(&metadata_max)); + assert!(result.is_some()); + } + + #[test] + fn test_versioned_decoder_routes_to_correct_version() { + // Create two decoders with different ranges + struct V1Decoder; + struct V2Decoder; + + impl<'a> InstructionDecoder<'a> for V1Decoder { + type InstructionType = String; + + fn decode_instruction( + &self, + _instruction: &'a solana_instruction::Instruction, + _metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + Some(DecodedInstruction { + program_id: Pubkey::default(), + data: "v1".to_string(), + accounts: vec![], + }) + } + } + + impl<'a> InstructionDecoder<'a> for V2Decoder { + type InstructionType = String; + + fn decode_instruction( + &self, + _instruction: &'a solana_instruction::Instruction, + _metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + Some(DecodedInstruction { + program_id: Pubkey::default(), + data: "v2".to_string(), + accounts: vec![], + }) + } + } + + let decoder = VersionedDecoder::new() + .add_version(V1Decoder, Some(SlotRange::to(1000))) + .add_version(V2Decoder, Some(SlotRange::from(1001))); + + let instruction = Instruction { + program_id: Pubkey::new_unique(), + accounts: vec![], + data: vec![], + }; + + // Should route to v1 + let metadata_v1 = create_metadata_with_slot(500); + let result = decoder.decode_instruction(&instruction, Some(&metadata_v1)); + assert!(result.is_some()); + assert_eq!(result.unwrap().data, "v1"); + + // Should route to v2 + let metadata_v2 = create_metadata_with_slot(2000); + let result = decoder.decode_instruction(&instruction, Some(&metadata_v2)); + assert!(result.is_some()); + assert_eq!(result.unwrap().data, "v2"); + } + + #[test] + fn test_versioned_decoder_handles_none_metadata() { + let decoder = VersionedDecoder::new().add_version(TestDecoder, Some(SlotRange::all())); + let instruction = Instruction { + program_id: Pubkey::new_unique(), + accounts: vec![], + data: vec![], + }; + + // Should return None when metadata is None + let result = decoder.decode_instruction(&instruction, None); + assert!(result.is_none()); + } + + #[test] + fn test_versioned_decoder_first_match_wins() { + // Test overlapping ranges - first match should win + struct FirstDecoder; + struct SecondDecoder; + + impl<'a> InstructionDecoder<'a> for FirstDecoder { + type InstructionType = String; + + fn decode_instruction( + &self, + _instruction: &'a solana_instruction::Instruction, + _metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + Some(DecodedInstruction { + program_id: Pubkey::default(), + data: "first".to_string(), + accounts: vec![], + }) + } + } + + impl<'a> InstructionDecoder<'a> for SecondDecoder { + type InstructionType = String; + + fn decode_instruction( + &self, + _instruction: &'a solana_instruction::Instruction, + _metadata: Option<&'a InstructionMetadata>, + ) -> Option> { + Some(DecodedInstruction { + program_id: Pubkey::default(), + data: "second".to_string(), + accounts: vec![], + }) + } + } + + // Both ranges include slot 150 + let decoder = VersionedDecoder::new() + .add_version(FirstDecoder, Some(SlotRange::between(100, 200))) + .add_version(SecondDecoder, Some(SlotRange::between(150, 250))); + + let instruction = Instruction { + program_id: Pubkey::new_unique(), + accounts: vec![], + data: vec![], + }; + + let metadata = create_metadata_with_slot(150); + let result = decoder.decode_instruction(&instruction, Some(&metadata)); + assert!(result.is_some()); + // First match should win + assert_eq!(result.unwrap().data, "first"); + } } diff --git a/crates/proc-macros/src/lib.rs b/crates/proc-macros/src/lib.rs index e833f7e5d..e6c0644b9 100644 --- a/crates/proc-macros/src/lib.rs +++ b/crates/proc-macros/src/lib.rs @@ -717,7 +717,7 @@ pub fn instruction_decoder_collection(input: TokenStream) -> TokenStream { }); parse_instruction_arms.push(quote! { - if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction) { + if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction, None) { return Some(carbon_core::instruction::DecodedInstruction { program_id: instruction.program_id, accounts: instruction.accounts.clone(), @@ -834,7 +834,7 @@ pub fn instruction_decoder_collection_fast(input: TokenStream) -> TokenStream { if let Some(program_id_path) = explicit_program_id_path { parse_instruction_match_arms.push(quote! { #program_id_path => { - if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction) { + if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction, None) { Some(carbon_core::instruction::DecodedInstruction { program_id: instruction.program_id, accounts: instruction.accounts.clone(), @@ -848,7 +848,7 @@ pub fn instruction_decoder_collection_fast(input: TokenStream) -> TokenStream { } else { // No program id path: include in slow-path fallback. fallback_decode_blocks.push(quote! { - if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction) { + if let Some(decoded_instruction) = #decoder_expr.decode_instruction(&instruction, None) { return Some(carbon_core::instruction::DecodedInstruction { program_id: instruction.program_id, accounts: instruction.accounts.clone(), From a55d527a7e08d31eb1058b0019c2b825c2f63513 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 5 Dec 2025 19:51:35 +0530 Subject: [PATCH 2/5] upd: all existing decoders to have metadata changes --- .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 7 +- .../src/instructions/mod.rs | 1 + decoders/bonkswap-decoder/src/accounts/mod.rs | 3 +- .../bonkswap-decoder/src/instructions/mod.rs | 1 + decoders/boop-decoder/src/accounts/mod.rs | 3 +- decoders/boop-decoder/src/instructions/mod.rs | 1 + .../bubblegum_decoder/src/accounts/mod.rs | 3 +- .../bubblegum_decoder/src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + decoders/drift-v2-decoder/src/accounts/mod.rs | 3 +- .../drift-v2-decoder/src/instructions/mod.rs | 1 + decoders/fluxbeam-decoder/src/accounts/mod.rs | 7 +- .../fluxbeam-decoder/src/instructions/mod.rs | 8 +- decoders/gavel-decoder/src/accounts/mod.rs | 3 +- .../gavel-decoder/src/instructions/mod.rs | 1 + decoders/heaven-decoder/src/accounts/mod.rs | 3 +- .../heaven-decoder/src/instructions/mod.rs | 1 + .../jupiter-dca-decoder/src/accounts/mod.rs | 7 +- .../src/instructions/mod.rs | 15 ++-- .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../jupiter-swap-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../kamino-farms-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../kamino-vault-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 7 +- .../src/instructions/mod.rs | 8 +- .../marginfi-v2-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../meteora-dbc-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../meteora-dlmm-decoder/src/accounts/mod.rs | 19 ++-- .../src/instructions/mod.rs | 90 ++++++++++--------- .../meteora-pools-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../meteora-vault-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + decoders/moonshot-decoder/src/accounts/mod.rs | 11 ++- .../moonshot-decoder/src/instructions/mod.rs | 10 ++- decoders/mpl-core-decoder/src/accounts/mod.rs | 3 +- .../mpl-core-decoder/src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 3 +- .../name-service-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + decoders/okx-dex-decoder/src/accounts/mod.rs | 7 +- .../okx-dex-decoder/src/instructions/mod.rs | 1 + .../openbook-v2-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../pancake-swap-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../phoenix-v1-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../pump-fees-decoder/src/accounts/mod.rs | 3 +- .../pump-fees-decoder/src/instructions/mod.rs | 1 + .../pump-swap-decoder/src/accounts/mod.rs | 3 +- .../pump-swap-decoder/src/instructions/mod.rs | 1 + decoders/pump-swap-decoder/src/lib.rs | 4 +- decoders/pumpfun-decoder/src/accounts/mod.rs | 3 +- .../pumpfun-decoder/src/instructions/mod.rs | 8 +- .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../raydium-clmm-decoder/src/accounts/mod.rs | 23 +++-- .../src/instructions/mod.rs | 44 ++++----- .../raydium-cpmm-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 7 +- .../src/instructions/mod.rs | 1 + decoders/sharky-decoder/src/accounts/mod.rs | 3 +- .../sharky-decoder/src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../stake-program-decoder/src/accounts/mod.rs | 7 +- .../src/instructions/mod.rs | 1 + decoders/swig-decoder/src/accounts/mod.rs | 3 +- decoders/swig-decoder/src/instructions/mod.rs | 1 + .../src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 3 +- .../token-2022-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + .../token-program-decoder/src/accounts/mod.rs | 3 +- .../src/instructions/mod.rs | 1 + decoders/vertigo-decoder/src/accounts/mod.rs | 3 +- .../vertigo-decoder/src/instructions/mod.rs | 1 + decoders/virtuals-decoder/src/accounts/mod.rs | 3 +- .../virtuals-decoder/src/instructions/mod.rs | 1 + .../wavebreak-decoder/src/accounts/mod.rs | 3 +- .../wavebreak-decoder/src/instructions/mod.rs | 1 + decoders/zeta-decoder/src/accounts/mod.rs | 3 +- decoders/zeta-decoder/src/instructions/mod.rs | 1 + 122 files changed, 326 insertions(+), 171 deletions(-) diff --git a/decoders/address-lookup-table-decoder/src/accounts/mod.rs b/decoders/address-lookup-table-decoder/src/accounts/mod.rs index 0f7c6562e..bd6cdf8da 100644 --- a/decoders/address-lookup-table-decoder/src/accounts/mod.rs +++ b/decoders/address-lookup-table-decoder/src/accounts/mod.rs @@ -20,7 +20,8 @@ impl AccountDecoder<'_> for AddressLookupTableDecoder { fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/address-lookup-table-decoder/src/instructions/mod.rs b/decoders/address-lookup-table-decoder/src/instructions/mod.rs index 57284b802..e3abe94f2 100644 --- a/decoders/address-lookup-table-decoder/src/instructions/mod.rs +++ b/decoders/address-lookup-table-decoder/src/instructions/mod.rs @@ -30,6 +30,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for AddressLookupTableDeco fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/associated-token-account-decoder/src/accounts/mod.rs b/decoders/associated-token-account-decoder/src/accounts/mod.rs index a87ebeda6..8380fb3ce 100644 --- a/decoders/associated-token-account-decoder/src/accounts/mod.rs +++ b/decoders/associated-token-account-decoder/src/accounts/mod.rs @@ -1,13 +1,14 @@ use super::SplAssociatedTokenAccountDecoder; -use carbon_core::account::AccountDecoder; +use carbon_core::account::{AccountDecoder, AccountMetadata}; pub enum SplAssociatedTokenAccountAccount {} -impl AccountDecoder<'_> for SplAssociatedTokenAccountDecoder { +impl<'a> AccountDecoder<'a> for SplAssociatedTokenAccountDecoder { type AccountType = SplAssociatedTokenAccountAccount; fn decode_account( &self, - _account: &solana_account::Account, + _account: &'a solana_account::Account, + _metadata: Option<&'a AccountMetadata>, ) -> Option> { None } diff --git a/decoders/associated-token-account-decoder/src/instructions/mod.rs b/decoders/associated-token-account-decoder/src/instructions/mod.rs index 699735f6d..5d745937d 100644 --- a/decoders/associated-token-account-decoder/src/instructions/mod.rs +++ b/decoders/associated-token-account-decoder/src/instructions/mod.rs @@ -27,6 +27,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SplAssociatedTokenAcco fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/bonkswap-decoder/src/accounts/mod.rs b/decoders/bonkswap-decoder/src/accounts/mod.rs index fc008082f..b4a2999ed 100644 --- a/decoders/bonkswap-decoder/src/accounts/mod.rs +++ b/decoders/bonkswap-decoder/src/accounts/mod.rs @@ -41,7 +41,8 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for BonkswapDecoder { fn decode_account( &self, - account: &'a solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/decoders/bonkswap-decoder/src/instructions/mod.rs b/decoders/bonkswap-decoder/src/instructions/mod.rs index 54b534d3e..89103f7a3 100644 --- a/decoders/bonkswap-decoder/src/instructions/mod.rs +++ b/decoders/bonkswap-decoder/src/instructions/mod.rs @@ -84,6 +84,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for BonkswapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/boop-decoder/src/accounts/mod.rs b/decoders/boop-decoder/src/accounts/mod.rs index 5ff1ee374..adc16917f 100644 --- a/decoders/boop-decoder/src/accounts/mod.rs +++ b/decoders/boop-decoder/src/accounts/mod.rs @@ -20,7 +20,8 @@ impl AccountDecoder<'_> for BoopDecoder { type AccountType = BoopAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/boop-decoder/src/instructions/mod.rs b/decoders/boop-decoder/src/instructions/mod.rs index 5212a5a55..267e03d38 100644 --- a/decoders/boop-decoder/src/instructions/mod.rs +++ b/decoders/boop-decoder/src/instructions/mod.rs @@ -133,6 +133,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for BoopDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/bubblegum_decoder/src/accounts/mod.rs b/decoders/bubblegum_decoder/src/accounts/mod.rs index df524a017..765d7fba4 100644 --- a/decoders/bubblegum_decoder/src/accounts/mod.rs +++ b/decoders/bubblegum_decoder/src/accounts/mod.rs @@ -14,7 +14,8 @@ impl AccountDecoder<'_> for BubblegumDecoder { type AccountType = BubblegumAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = tree_config::TreeConfig::deserialize(account.data.as_slice()) { diff --git a/decoders/bubblegum_decoder/src/instructions/mod.rs b/decoders/bubblegum_decoder/src/instructions/mod.rs index 96da3b12a..9fa05d2a6 100644 --- a/decoders/bubblegum_decoder/src/instructions/mod.rs +++ b/decoders/bubblegum_decoder/src/instructions/mod.rs @@ -89,6 +89,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for BubblegumDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, BubblegumInstruction::Burn => burn::Burn, diff --git a/decoders/circle-message-transmitter-v2-decoder/src/accounts/mod.rs b/decoders/circle-message-transmitter-v2-decoder/src/accounts/mod.rs index d59b03de1..74dafc14a 100644 --- a/decoders/circle-message-transmitter-v2-decoder/src/accounts/mod.rs +++ b/decoders/circle-message-transmitter-v2-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for MessageTransmitterV2Decoder { type AccountType = MessageTransmitterV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = message_sent::MessageSent::deserialize(account.data.as_slice()) diff --git a/decoders/circle-message-transmitter-v2-decoder/src/instructions/mod.rs b/decoders/circle-message-transmitter-v2-decoder/src/instructions/mod.rs index 65f0c6b1d..8e7c681be 100644 --- a/decoders/circle-message-transmitter-v2-decoder/src/instructions/mod.rs +++ b/decoders/circle-message-transmitter-v2-decoder/src/instructions/mod.rs @@ -75,6 +75,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MessageTransmitterV2De fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, MessageTransmitterV2Instruction::AcceptOwnership => accept_ownership::AcceptOwnership, diff --git a/decoders/circle-token-messenger-v2-decoder/src/accounts/mod.rs b/decoders/circle-token-messenger-v2-decoder/src/accounts/mod.rs index f609d3936..85a083081 100644 --- a/decoders/circle-token-messenger-v2-decoder/src/accounts/mod.rs +++ b/decoders/circle-token-messenger-v2-decoder/src/accounts/mod.rs @@ -24,7 +24,8 @@ impl AccountDecoder<'_> for TokenMessengerMinterV2Decoder { type AccountType = TokenMessengerMinterV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = denylisted_account::DenylistedAccount::deserialize(account.data.as_slice()) diff --git a/decoders/circle-token-messenger-v2-decoder/src/instructions/mod.rs b/decoders/circle-token-messenger-v2-decoder/src/instructions/mod.rs index d31562fa9..c0fb89c10 100644 --- a/decoders/circle-token-messenger-v2-decoder/src/instructions/mod.rs +++ b/decoders/circle-token-messenger-v2-decoder/src/instructions/mod.rs @@ -119,6 +119,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for TokenMessengerMinterV2 fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, TokenMessengerMinterV2Instruction::AcceptOwnership => accept_ownership::AcceptOwnership, diff --git a/decoders/dflow-aggregator-v4-decoder/src/accounts/mod.rs b/decoders/dflow-aggregator-v4-decoder/src/accounts/mod.rs index 9a972b6f9..6c68f7084 100644 --- a/decoders/dflow-aggregator-v4-decoder/src/accounts/mod.rs +++ b/decoders/dflow-aggregator-v4-decoder/src/accounts/mod.rs @@ -22,7 +22,8 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for SwapOrchestratorDecoder { fn decode_account( &self, - account: &'a solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/decoders/dflow-aggregator-v4-decoder/src/instructions/mod.rs b/decoders/dflow-aggregator-v4-decoder/src/instructions/mod.rs index dd78ce9ed..e55e2425d 100644 --- a/decoders/dflow-aggregator-v4-decoder/src/instructions/mod.rs +++ b/decoders/dflow-aggregator-v4-decoder/src/instructions/mod.rs @@ -70,6 +70,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SwapOrchestratorDecode fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/drift-v2-decoder/src/accounts/mod.rs b/decoders/drift-v2-decoder/src/accounts/mod.rs index 5f122db93..e6ec7d700 100644 --- a/decoders/drift-v2-decoder/src/accounts/mod.rs +++ b/decoders/drift-v2-decoder/src/accounts/mod.rs @@ -48,7 +48,8 @@ impl AccountDecoder<'_> for DriftDecoder { type AccountType = DriftAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/drift-v2-decoder/src/instructions/mod.rs b/decoders/drift-v2-decoder/src/instructions/mod.rs index 7eb1098e4..f94b747a3 100644 --- a/decoders/drift-v2-decoder/src/instructions/mod.rs +++ b/decoders/drift-v2-decoder/src/instructions/mod.rs @@ -452,6 +452,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for DriftDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/fluxbeam-decoder/src/accounts/mod.rs b/decoders/fluxbeam-decoder/src/accounts/mod.rs index b39b42003..5edc722c2 100644 --- a/decoders/fluxbeam-decoder/src/accounts/mod.rs +++ b/decoders/fluxbeam-decoder/src/accounts/mod.rs @@ -14,7 +14,8 @@ impl AccountDecoder<'_> for FluxbeamDecoder { type AccountType = FluxbeamAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -88,7 +89,9 @@ mod tests { let decoder = FluxbeamDecoder; let account = carbon_test_utils::read_account("tests/fixtures/swap_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { diff --git a/decoders/fluxbeam-decoder/src/instructions/mod.rs b/decoders/fluxbeam-decoder/src/instructions/mod.rs index 63f3d88fd..ca05b06ed 100644 --- a/decoders/fluxbeam-decoder/src/instructions/mod.rs +++ b/decoders/fluxbeam-decoder/src/instructions/mod.rs @@ -37,6 +37,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for FluxbeamDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -163,7 +164,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/initialize_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = initialize::Initialize::arrange_accounts(&instruction.accounts) @@ -328,7 +329,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = swap::Swap::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -490,6 +491,7 @@ mod tests { "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", ), }; + use carbon_test_utils; // Act let decoder = FluxbeamDecoder; @@ -497,7 +499,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/withdraw_all_token_types_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = withdraw_all_token_types::WithdrawAllTokenTypes::arrange_accounts( diff --git a/decoders/gavel-decoder/src/accounts/mod.rs b/decoders/gavel-decoder/src/accounts/mod.rs index dfa0cec68..254d326d3 100644 --- a/decoders/gavel-decoder/src/accounts/mod.rs +++ b/decoders/gavel-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for GavelDecoder { type AccountType = GavelAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/gavel-decoder/src/instructions/mod.rs b/decoders/gavel-decoder/src/instructions/mod.rs index 473ad1ea5..5bb471731 100644 --- a/decoders/gavel-decoder/src/instructions/mod.rs +++ b/decoders/gavel-decoder/src/instructions/mod.rs @@ -41,6 +41,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for GavelDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/heaven-decoder/src/accounts/mod.rs b/decoders/heaven-decoder/src/accounts/mod.rs index 676aa6e73..686e87aa8 100644 --- a/decoders/heaven-decoder/src/accounts/mod.rs +++ b/decoders/heaven-decoder/src/accounts/mod.rs @@ -22,7 +22,8 @@ impl AccountDecoder<'_> for HeavenDecoder { type AccountType = HeavenAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/heaven-decoder/src/instructions/mod.rs b/decoders/heaven-decoder/src/instructions/mod.rs index 58fe7840d..62919bd73 100644 --- a/decoders/heaven-decoder/src/instructions/mod.rs +++ b/decoders/heaven-decoder/src/instructions/mod.rs @@ -88,6 +88,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for HeavenDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-dca-decoder/src/accounts/mod.rs b/decoders/jupiter-dca-decoder/src/accounts/mod.rs index 81adee5a9..0ca9cb72d 100644 --- a/decoders/jupiter-dca-decoder/src/accounts/mod.rs +++ b/decoders/jupiter-dca-decoder/src/accounts/mod.rs @@ -13,7 +13,8 @@ impl AccountDecoder<'_> for JupiterDcaDecoder { type AccountType = JupiterDcaAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -76,7 +77,9 @@ mod tests { let decoder = JupiterDcaDecoder; let account = carbon_test_utils::read_account("tests/fixtures/dca_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); match decoded_account.data { JupiterDcaAccount::Dca(dca_account) => { diff --git a/decoders/jupiter-dca-decoder/src/instructions/mod.rs b/decoders/jupiter-dca-decoder/src/instructions/mod.rs index f86624778..1ebd5e872 100644 --- a/decoders/jupiter-dca-decoder/src/instructions/mod.rs +++ b/decoders/jupiter-dca-decoder/src/instructions/mod.rs @@ -57,6 +57,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for JupiterDcaDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -219,7 +220,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/open_dca_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = open_dca::OpenDca::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -365,7 +366,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/open_dca_v2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = open_dca_v2::OpenDcaV2::arrange_accounts(&instruction.accounts) @@ -504,7 +505,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/close_dca_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = close_dca::CloseDca::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -599,7 +600,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/withdraw_fees_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = withdraw_fees::WithdrawFees::arrange_accounts(&instruction.accounts) @@ -714,7 +715,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initiate_flash_fill_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = initiate_flash_fill::InitiateFlashFill::arrange_accounts(&instruction.accounts) @@ -875,7 +876,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/fulfill_flash_fill_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = fulfill_flash_fill::FulfillFlashFill::arrange_accounts(&instruction.accounts) @@ -1033,7 +1034,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/end_and_close_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = end_and_close::EndAndClose::arrange_accounts(&instruction.accounts) diff --git a/decoders/jupiter-limit-order-2-decoder/src/accounts/mod.rs b/decoders/jupiter-limit-order-2-decoder/src/accounts/mod.rs index 2fe32076d..b14e429ac 100644 --- a/decoders/jupiter-limit-order-2-decoder/src/accounts/mod.rs +++ b/decoders/jupiter-limit-order-2-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for JupiterLimitOrder2Decoder { type AccountType = JupiterLimitOrder2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-limit-order-2-decoder/src/instructions/mod.rs b/decoders/jupiter-limit-order-2-decoder/src/instructions/mod.rs index d1b1a062e..273509bfe 100644 --- a/decoders/jupiter-limit-order-2-decoder/src/instructions/mod.rs +++ b/decoders/jupiter-limit-order-2-decoder/src/instructions/mod.rs @@ -39,6 +39,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for JupiterLimitOrder2Deco fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-limit-order-decoder/src/accounts/mod.rs b/decoders/jupiter-limit-order-decoder/src/accounts/mod.rs index 05d0c232c..03233d491 100644 --- a/decoders/jupiter-limit-order-decoder/src/accounts/mod.rs +++ b/decoders/jupiter-limit-order-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for JupiterLimitOrderDecoder { type AccountType = JupiterLimitOrderAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-limit-order-decoder/src/instructions/mod.rs b/decoders/jupiter-limit-order-decoder/src/instructions/mod.rs index 4fab4efad..fab8f43ca 100644 --- a/decoders/jupiter-limit-order-decoder/src/instructions/mod.rs +++ b/decoders/jupiter-limit-order-decoder/src/instructions/mod.rs @@ -45,6 +45,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for JupiterLimitOrderDecod fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-perpetuals-decoder/src/accounts/mod.rs b/decoders/jupiter-perpetuals-decoder/src/accounts/mod.rs index c55a3c008..79f7ff8cd 100644 --- a/decoders/jupiter-perpetuals-decoder/src/accounts/mod.rs +++ b/decoders/jupiter-perpetuals-decoder/src/accounts/mod.rs @@ -24,7 +24,8 @@ impl AccountDecoder<'_> for PerpetualsDecoder { type AccountType = PerpetualsAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-perpetuals-decoder/src/instructions/mod.rs b/decoders/jupiter-perpetuals-decoder/src/instructions/mod.rs index d62061539..07a00255b 100644 --- a/decoders/jupiter-perpetuals-decoder/src/instructions/mod.rs +++ b/decoders/jupiter-perpetuals-decoder/src/instructions/mod.rs @@ -145,6 +145,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PerpetualsDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/jupiter-swap-decoder/src/accounts/mod.rs b/decoders/jupiter-swap-decoder/src/accounts/mod.rs index 0d83a09ab..d92908fb9 100644 --- a/decoders/jupiter-swap-decoder/src/accounts/mod.rs +++ b/decoders/jupiter-swap-decoder/src/accounts/mod.rs @@ -22,7 +22,8 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for JupiterSwapDecoder { fn decode_account( &self, - account: &'a solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/decoders/jupiter-swap-decoder/src/instructions/mod.rs b/decoders/jupiter-swap-decoder/src/instructions/mod.rs index 459b195c2..b746b7447 100644 --- a/decoders/jupiter-swap-decoder/src/instructions/mod.rs +++ b/decoders/jupiter-swap-decoder/src/instructions/mod.rs @@ -74,6 +74,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for JupiterSwapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if instruction.program_id != PROGRAM_ID { return None; diff --git a/decoders/kamino-farms-decoder/src/accounts/mod.rs b/decoders/kamino-farms-decoder/src/accounts/mod.rs index 4b3af8c1b..e2593ef9d 100644 --- a/decoders/kamino-farms-decoder/src/accounts/mod.rs +++ b/decoders/kamino-farms-decoder/src/accounts/mod.rs @@ -19,7 +19,8 @@ impl AccountDecoder<'_> for KaminoFarmsDecoder { type AccountType = KaminoFarmsAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-farms-decoder/src/instructions/mod.rs b/decoders/kamino-farms-decoder/src/instructions/mod.rs index 559b2dba4..8775680eb 100644 --- a/decoders/kamino-farms-decoder/src/instructions/mod.rs +++ b/decoders/kamino-farms-decoder/src/instructions/mod.rs @@ -69,6 +69,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for KaminoFarmsDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-lending-decoder/src/accounts/mod.rs b/decoders/kamino-lending-decoder/src/accounts/mod.rs index 2e4f3211b..a4cc09bd0 100644 --- a/decoders/kamino-lending-decoder/src/accounts/mod.rs +++ b/decoders/kamino-lending-decoder/src/accounts/mod.rs @@ -27,7 +27,8 @@ impl AccountDecoder<'_> for KaminoLendingDecoder { type AccountType = KaminoLendingAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-lending-decoder/src/instructions/mod.rs b/decoders/kamino-lending-decoder/src/instructions/mod.rs index 783ec1417..3f5026bba 100644 --- a/decoders/kamino-lending-decoder/src/instructions/mod.rs +++ b/decoders/kamino-lending-decoder/src/instructions/mod.rs @@ -91,6 +91,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for KaminoLendingDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-limit-order-decoder/src/accounts/mod.rs b/decoders/kamino-limit-order-decoder/src/accounts/mod.rs index f836f2320..fa769703d 100644 --- a/decoders/kamino-limit-order-decoder/src/accounts/mod.rs +++ b/decoders/kamino-limit-order-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for KaminoLimitOrderDecoder { type AccountType = KaminoLimitOrderAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-limit-order-decoder/src/instructions/mod.rs b/decoders/kamino-limit-order-decoder/src/instructions/mod.rs index f3f7f8412..54dbc7388 100644 --- a/decoders/kamino-limit-order-decoder/src/instructions/mod.rs +++ b/decoders/kamino-limit-order-decoder/src/instructions/mod.rs @@ -45,6 +45,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for KaminoLimitOrderDecode fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-vault-decoder/src/accounts/mod.rs b/decoders/kamino-vault-decoder/src/accounts/mod.rs index 57b02b4ac..8e732cfde 100644 --- a/decoders/kamino-vault-decoder/src/accounts/mod.rs +++ b/decoders/kamino-vault-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for KaminoVaultDecoder { type AccountType = KaminoVaultAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/kamino-vault-decoder/src/instructions/mod.rs b/decoders/kamino-vault-decoder/src/instructions/mod.rs index f1fcadb4f..ef38fe362 100644 --- a/decoders/kamino-vault-decoder/src/instructions/mod.rs +++ b/decoders/kamino-vault-decoder/src/instructions/mod.rs @@ -45,6 +45,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for KaminoVaultDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/lifinity-amm-v2-decoder/src/accounts/mod.rs b/decoders/lifinity-amm-v2-decoder/src/accounts/mod.rs index cbdc787c8..a2de931c4 100644 --- a/decoders/lifinity-amm-v2-decoder/src/accounts/mod.rs +++ b/decoders/lifinity-amm-v2-decoder/src/accounts/mod.rs @@ -14,7 +14,8 @@ impl AccountDecoder<'_> for LifinityAmmV2Decoder { type AccountType = LifinityAmmV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -145,7 +146,9 @@ mod tests { let decoder = LifinityAmmV2Decoder; let account = carbon_test_utils::read_account("tests/fixtures/amm_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); match decoded_account.data { LifinityAmmV2Account::Amm(amm_account) => { diff --git a/decoders/lifinity-amm-v2-decoder/src/instructions/mod.rs b/decoders/lifinity-amm-v2-decoder/src/instructions/mod.rs index f2ccd8652..af9f9fb8b 100644 --- a/decoders/lifinity-amm-v2-decoder/src/instructions/mod.rs +++ b/decoders/lifinity-amm-v2-decoder/src/instructions/mod.rs @@ -27,6 +27,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for LifinityAmmV2Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -179,7 +180,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = swap::Swap::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -300,7 +301,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/deposit_all_token_types_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = deposit_all_token_types::DepositAllTokenTypes::arrange_accounts(&instruction.accounts) @@ -416,13 +417,14 @@ mod tests { "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", ), }; + use carbon_test_utils; let decoder = LifinityAmmV2Decoder; let instruction = carbon_test_utils::read_instruction("tests/fixtures/withdraw_all_token_types_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = withdraw_all_token_types::WithdrawAllTokenTypes::arrange_accounts( diff --git a/decoders/marginfi-v2-decoder/src/accounts/mod.rs b/decoders/marginfi-v2-decoder/src/accounts/mod.rs index 35b2e544a..df009a1cc 100644 --- a/decoders/marginfi-v2-decoder/src/accounts/mod.rs +++ b/decoders/marginfi-v2-decoder/src/accounts/mod.rs @@ -17,7 +17,8 @@ impl AccountDecoder<'_> for MarginfiV2Decoder { type AccountType = MarginfiV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/marginfi-v2-decoder/src/instructions/mod.rs b/decoders/marginfi-v2-decoder/src/instructions/mod.rs index e479e9d8d..f51409240 100644 --- a/decoders/marginfi-v2-decoder/src/instructions/mod.rs +++ b/decoders/marginfi-v2-decoder/src/instructions/mod.rs @@ -88,6 +88,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MarginfiV2Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/marinade-finance-decoder/src/accounts/mod.rs b/decoders/marinade-finance-decoder/src/accounts/mod.rs index a2d84a5fa..e1f8d0a86 100644 --- a/decoders/marinade-finance-decoder/src/accounts/mod.rs +++ b/decoders/marinade-finance-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for MarinadeFinanceDecoder { type AccountType = MarinadeFinanceAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/marinade-finance-decoder/src/instructions/mod.rs b/decoders/marinade-finance-decoder/src/instructions/mod.rs index 3b6772f9c..061b20870 100644 --- a/decoders/marinade-finance-decoder/src/instructions/mod.rs +++ b/decoders/marinade-finance-decoder/src/instructions/mod.rs @@ -125,6 +125,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MarinadeFinanceDecoder fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/memo-program-decoder/src/instructions/mod.rs b/decoders/memo-program-decoder/src/instructions/mod.rs index adaf663b7..92dbca4ad 100644 --- a/decoders/memo-program-decoder/src/instructions/mod.rs +++ b/decoders/memo-program-decoder/src/instructions/mod.rs @@ -20,6 +20,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MemoProgramDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&spl_memo_interface::v3::ID) { return None; diff --git a/decoders/meteora-damm-v2-decoder/src/accounts/mod.rs b/decoders/meteora-damm-v2-decoder/src/accounts/mod.rs index c5ed32312..6e9c8e143 100644 --- a/decoders/meteora-damm-v2-decoder/src/accounts/mod.rs +++ b/decoders/meteora-damm-v2-decoder/src/accounts/mod.rs @@ -24,7 +24,8 @@ impl AccountDecoder<'_> for MeteoraDammV2Decoder { type AccountType = MeteoraDammV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/meteora-damm-v2-decoder/src/instructions/mod.rs b/decoders/meteora-damm-v2-decoder/src/instructions/mod.rs index 38b6a880b..22aa19fcf 100644 --- a/decoders/meteora-damm-v2-decoder/src/instructions/mod.rs +++ b/decoders/meteora-damm-v2-decoder/src/instructions/mod.rs @@ -144,6 +144,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraDammV2Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/meteora-dbc-decoder/src/accounts/mod.rs b/decoders/meteora-dbc-decoder/src/accounts/mod.rs index 7ff10c3a6..0dae93c79 100644 --- a/decoders/meteora-dbc-decoder/src/accounts/mod.rs +++ b/decoders/meteora-dbc-decoder/src/accounts/mod.rs @@ -29,7 +29,8 @@ impl AccountDecoder<'_> for DynamicBondingCurveDecoder { type AccountType = DynamicBondingCurveAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = claim_fee_operator::ClaimFeeOperator::deserialize(account.data.as_slice()) diff --git a/decoders/meteora-dbc-decoder/src/instructions/mod.rs b/decoders/meteora-dbc-decoder/src/instructions/mod.rs index 116544dbd..5f2f675ce 100644 --- a/decoders/meteora-dbc-decoder/src/instructions/mod.rs +++ b/decoders/meteora-dbc-decoder/src/instructions/mod.rs @@ -141,6 +141,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for DynamicBondingCurveDec fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, DynamicBondingCurveInstruction::ClaimCreatorTradingFee => claim_creator_trading_fee::ClaimCreatorTradingFee, diff --git a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs index fad71e6e8..5c0094bac 100644 --- a/decoders/meteora-dlmm-decoder/src/accounts/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/accounts/mod.rs @@ -33,7 +33,8 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder { type AccountType = MeteoraDlmmAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -270,7 +271,9 @@ mod tests { let decoder = MeteoraDlmmDecoder; let account = carbon_test_utils::read_account("tests/fixtures/lb_pair_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -773,7 +776,9 @@ mod tests { let decoder = MeteoraDlmmDecoder; let account = carbon_test_utils::read_account("tests/fixtures/position_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -825,7 +830,9 @@ mod tests { let account = carbon_test_utils::read_account("tests/fixtures/preset_parameter_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -864,7 +871,9 @@ mod tests { let decoder = MeteoraDlmmDecoder; let account = carbon_test_utils::read_account("tests/fixtures/oracle_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { diff --git a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs index 6634e4217..93305fdb5 100644 --- a/decoders/meteora-dlmm-decoder/src/instructions/mod.rs +++ b/decoders/meteora-dlmm-decoder/src/instructions/mod.rs @@ -193,6 +193,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraDlmmDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -504,7 +505,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -625,7 +626,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_by_strategy_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidityByStrategy::arrange_accounts(&instruction.accounts) @@ -728,7 +729,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidityByStrategyOneSide::arrange_accounts(&instruction.accounts) @@ -938,7 +939,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_by_weight_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidityByWeight::arrange_accounts(&instruction.accounts) @@ -1059,7 +1060,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidityOneSidePrecise::arrange_accounts(&instruction.accounts) @@ -1200,7 +1201,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/add_liquidity_one_side_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = AddLiquidityOneSide::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1296,7 +1297,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/claim_fee_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClaimFee::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1378,7 +1379,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/claim_reward_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClaimReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1439,7 +1440,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/close_position_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClosePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1481,7 +1482,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/close_preset_parameter_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClosePresetParameter::arrange_accounts(&instruction.accounts) @@ -1538,7 +1539,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/go_to_a_bin_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = GoToABin::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1590,7 +1591,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeBinArrayBitmapExtension::arrange_accounts(&instruction.accounts) @@ -1636,7 +1637,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_bin_array_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeBinArray::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1746,7 +1747,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeCustomizablePermissionlessLbPair::arrange_accounts(&instruction.accounts) @@ -1872,7 +1873,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeCustomizablePermissionlessLbPair2::arrange_accounts(&instruction.accounts) @@ -1970,7 +1971,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_lb_pair_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeLbPair::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -2090,7 +2091,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializePermissionLbPair::arrange_accounts(&instruction.accounts) @@ -2177,7 +2178,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializePositionByOperator::arrange_accounts(&instruction.accounts) @@ -2245,7 +2246,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_position_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -2317,7 +2318,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_position_pda_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializePositionPda::arrange_accounts(&instruction.accounts) @@ -2392,7 +2393,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/migrate_position_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = MigratePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -2499,7 +2500,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/remove_all_liquidity_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = RemoveAllLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -2610,7 +2611,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity_by_range_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = RemoveLiquidityByRange::arrange_accounts(&instruction.accounts) @@ -2813,7 +2814,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = RemoveLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -2926,7 +2927,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/swap_exact_out_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SwapExactOut::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3042,7 +3043,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = Swap::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3094,7 +3095,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/update_fees_and_rewards_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = UpdateFeesAndRewards::arrange_accounts(&instruction.accounts) @@ -3147,7 +3148,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/close_position_if_empty_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClosePositionIfEmpty::arrange_accounts(&instruction.accounts) @@ -3200,7 +3201,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/close_position2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClosePosition2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3230,7 +3231,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/migrate_bin_array_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = MigrateBinArray::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3350,7 +3351,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = RemoveLiquidityByRange2::arrange_accounts(&instruction.accounts) @@ -3470,7 +3471,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/remove_liquidity2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = RemoveLiquidity2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3509,7 +3510,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/set_activation_point_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetActivationPoint::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3546,7 +3547,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/set_pair_status_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetPairStatus::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3587,7 +3588,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetPairStatusPermissionless::arrange_accounts(&instruction.accounts) @@ -3629,7 +3630,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetPreActivationDuration::arrange_accounts(&instruction.accounts) @@ -3673,7 +3674,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetPreActivationSwapAddress::arrange_accounts(&instruction.accounts) @@ -3785,7 +3786,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/swap_exact_out2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SwapExactOut2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -3897,7 +3898,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/swap_with_price_impact2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SwapWithPriceImpact2::arrange_accounts(&instruction.accounts) @@ -4008,7 +4009,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = Swap2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -4063,7 +4064,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = UpdateBaseFeeParameters::arrange_accounts(&instruction.accounts) @@ -4175,7 +4176,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/claim_fee2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClaimFee2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -4255,6 +4256,7 @@ mod tests { event_authority: pubkey!("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6"), program: pubkey!("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo"), }; + use carbon_test_utils; // Act let decoder = MeteoraDlmmDecoder; @@ -4262,7 +4264,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/claim_reward2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClaimReward2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -4371,7 +4373,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_lb_pair2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeLbPair2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); diff --git a/decoders/meteora-pools-decoder/src/accounts/mod.rs b/decoders/meteora-pools-decoder/src/accounts/mod.rs index a33a2cd21..e0fed52b1 100644 --- a/decoders/meteora-pools-decoder/src/accounts/mod.rs +++ b/decoders/meteora-pools-decoder/src/accounts/mod.rs @@ -18,7 +18,8 @@ impl AccountDecoder<'_> for MeteoraPoolsDecoder { type AccountType = MeteoraPoolsProgramAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/meteora-pools-decoder/src/instructions/mod.rs b/decoders/meteora-pools-decoder/src/instructions/mod.rs index cc4857f4e..51108e880 100644 --- a/decoders/meteora-pools-decoder/src/instructions/mod.rs +++ b/decoders/meteora-pools-decoder/src/instructions/mod.rs @@ -102,6 +102,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraPoolsDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/meteora-vault-decoder/src/accounts/mod.rs b/decoders/meteora-vault-decoder/src/accounts/mod.rs index da82cc73e..ffc86947d 100644 --- a/decoders/meteora-vault-decoder/src/accounts/mod.rs +++ b/decoders/meteora-vault-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for MeteoraVaultDecoder { type AccountType = MeteoraVaultAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/meteora-vault-decoder/src/instructions/mod.rs b/decoders/meteora-vault-decoder/src/instructions/mod.rs index 7001808c1..de91f553a 100644 --- a/decoders/meteora-vault-decoder/src/instructions/mod.rs +++ b/decoders/meteora-vault-decoder/src/instructions/mod.rs @@ -65,6 +65,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MeteoraVaultDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/moonshot-decoder/src/accounts/mod.rs b/decoders/moonshot-decoder/src/accounts/mod.rs index f6385742b..f62d08788 100644 --- a/decoders/moonshot-decoder/src/accounts/mod.rs +++ b/decoders/moonshot-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for MoonshotDecoder { type AccountType = MoonshotAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -91,7 +92,9 @@ mod tests { let decoder = MoonshotDecoder; let account = carbon_test_utils::read_account("tests/fixtures/config_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -175,7 +178,9 @@ mod tests { let decoder = MoonshotDecoder; let account = carbon_test_utils::read_account("tests/fixtures/curve_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { diff --git a/decoders/moonshot-decoder/src/instructions/mod.rs b/decoders/moonshot-decoder/src/instructions/mod.rs index 45412e0d7..2534805d5 100644 --- a/decoders/moonshot-decoder/src/instructions/mod.rs +++ b/decoders/moonshot-decoder/src/instructions/mod.rs @@ -30,6 +30,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MoonshotDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -60,6 +61,7 @@ mod tests { use crate::types::{TokenMintParams, TradeParams}; use super::*; + use carbon_test_utils; #[test] fn test_decode_token_mint() { @@ -187,7 +189,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/token_mint_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = token_mint::TokenMint::arrange_accounts(&instruction.accounts) @@ -318,7 +320,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/buy_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = buy::Buy::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -448,7 +450,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/sell_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = sell::Sell::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -581,7 +583,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/migrate_funds_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = migrate_funds::MigrateFunds::arrange_accounts(&instruction.accounts) diff --git a/decoders/mpl-core-decoder/src/accounts/mod.rs b/decoders/mpl-core-decoder/src/accounts/mod.rs index 15a222736..1f6f54ae5 100644 --- a/decoders/mpl-core-decoder/src/accounts/mod.rs +++ b/decoders/mpl-core-decoder/src/accounts/mod.rs @@ -21,7 +21,8 @@ impl AccountDecoder<'_> for MplCoreProgramDecoder { type AccountType = MplCoreProgramAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/mpl-core-decoder/src/instructions/mod.rs b/decoders/mpl-core-decoder/src/instructions/mod.rs index 55ba3ddb6..b2f061197 100644 --- a/decoders/mpl-core-decoder/src/instructions/mod.rs +++ b/decoders/mpl-core-decoder/src/instructions/mod.rs @@ -85,6 +85,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for MplCoreProgramDecoder fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/mpl-token-metadata-decoder/src/accounts/mod.rs b/decoders/mpl-token-metadata-decoder/src/accounts/mod.rs index e3c26d59d..f2f72f9f7 100644 --- a/decoders/mpl-token-metadata-decoder/src/accounts/mod.rs +++ b/decoders/mpl-token-metadata-decoder/src/accounts/mod.rs @@ -40,7 +40,8 @@ impl AccountDecoder<'_> for TokenMetadataDecoder { type AccountType = TokenMetadataAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { // Guard let mpl_token_metadata_id: Pubkey = pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"); diff --git a/decoders/mpl-token-metadata-decoder/src/instructions/mod.rs b/decoders/mpl-token-metadata-decoder/src/instructions/mod.rs index 66d9414f2..f6010fdc0 100644 --- a/decoders/mpl-token-metadata-decoder/src/instructions/mod.rs +++ b/decoders/mpl-token-metadata-decoder/src/instructions/mod.rs @@ -137,6 +137,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for TokenMetadataDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -289,7 +290,7 @@ mod tests { let instruction = read_instruction(FIXTURE_PATH).expect("read fixture"); let decoded_instruction = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = diff --git a/decoders/name-service-decoder/src/accounts/mod.rs b/decoders/name-service-decoder/src/accounts/mod.rs index e113b6dfb..b9e9714a2 100644 --- a/decoders/name-service-decoder/src/accounts/mod.rs +++ b/decoders/name-service-decoder/src/accounts/mod.rs @@ -13,7 +13,8 @@ impl AccountDecoder<'_> for NameDecoder { type AccountType = NameAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/name-service-decoder/src/instructions/mod.rs b/decoders/name-service-decoder/src/instructions/mod.rs index 60e00e0d5..df9b123f6 100644 --- a/decoders/name-service-decoder/src/instructions/mod.rs +++ b/decoders/name-service-decoder/src/instructions/mod.rs @@ -31,6 +31,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for NameDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/okx-dex-decoder/src/accounts/mod.rs b/decoders/okx-dex-decoder/src/accounts/mod.rs index c7b41d28a..d8754e873 100644 --- a/decoders/okx-dex-decoder/src/accounts/mod.rs +++ b/decoders/okx-dex-decoder/src/accounts/mod.rs @@ -1,14 +1,15 @@ -use carbon_core::account::AccountDecoder; +use carbon_core::account::{AccountDecoder, AccountMetadata}; use super::OkxDexDecoder; pub enum OkxDexAccount {} -impl AccountDecoder<'_> for OkxDexDecoder { +impl<'a> AccountDecoder<'a> for OkxDexDecoder { type AccountType = OkxDexAccount; fn decode_account( &self, - _account: &solana_account::Account, + _account: &'a solana_account::Account, + _metadata: Option<&'a AccountMetadata>, ) -> Option> { None } diff --git a/decoders/okx-dex-decoder/src/instructions/mod.rs b/decoders/okx-dex-decoder/src/instructions/mod.rs index f940887f5..22694055c 100644 --- a/decoders/okx-dex-decoder/src/instructions/mod.rs +++ b/decoders/okx-dex-decoder/src/instructions/mod.rs @@ -47,6 +47,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for OkxDexDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/openbook-v2-decoder/src/accounts/mod.rs b/decoders/openbook-v2-decoder/src/accounts/mod.rs index f4f57e2f1..0ebb287d8 100644 --- a/decoders/openbook-v2-decoder/src/accounts/mod.rs +++ b/decoders/openbook-v2-decoder/src/accounts/mod.rs @@ -23,7 +23,8 @@ impl AccountDecoder<'_> for OpenbookV2Decoder { type AccountType = OpenbookV2Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/openbook-v2-decoder/src/instructions/mod.rs b/decoders/openbook-v2-decoder/src/instructions/mod.rs index cc59fe228..6570b4300 100644 --- a/decoders/openbook-v2-decoder/src/instructions/mod.rs +++ b/decoders/openbook-v2-decoder/src/instructions/mod.rs @@ -88,6 +88,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for OpenbookV2Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/orca-whirlpool-decoder/src/accounts/mod.rs b/decoders/orca-whirlpool-decoder/src/accounts/mod.rs index e90611f2f..0a407a7c9 100644 --- a/decoders/orca-whirlpool-decoder/src/accounts/mod.rs +++ b/decoders/orca-whirlpool-decoder/src/accounts/mod.rs @@ -34,7 +34,8 @@ impl AccountDecoder<'_> for OrcaWhirlpoolDecoder { type AccountType = WhirlpoolAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = adaptive_fee_tier::AdaptiveFeeTier::deserialize(account.data.as_slice()) diff --git a/decoders/orca-whirlpool-decoder/src/instructions/mod.rs b/decoders/orca-whirlpool-decoder/src/instructions/mod.rs index 998b1365a..20561487e 100644 --- a/decoders/orca-whirlpool-decoder/src/instructions/mod.rs +++ b/decoders/orca-whirlpool-decoder/src/instructions/mod.rs @@ -157,6 +157,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for OrcaWhirlpoolDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, WhirlpoolInstruction::InitializeConfig => initialize_config::InitializeConfig, diff --git a/decoders/pancake-swap-decoder/src/accounts/mod.rs b/decoders/pancake-swap-decoder/src/accounts/mod.rs index 9e5cdf666..8993898e5 100644 --- a/decoders/pancake-swap-decoder/src/accounts/mod.rs +++ b/decoders/pancake-swap-decoder/src/accounts/mod.rs @@ -31,7 +31,8 @@ impl AccountDecoder<'_> for PancakeSwapDecoder { type AccountType = PancakeSwapAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = amm_config::AmmConfig::deserialize(account.data.as_slice()) { return Some(carbon_core::account::DecodedAccount { diff --git a/decoders/pancake-swap-decoder/src/instructions/mod.rs b/decoders/pancake-swap-decoder/src/instructions/mod.rs index cb5404e48..74afc02da 100644 --- a/decoders/pancake-swap-decoder/src/instructions/mod.rs +++ b/decoders/pancake-swap-decoder/src/instructions/mod.rs @@ -99,6 +99,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PancakeSwapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, AmmV3Instruction::ClosePosition => close_position::ClosePosition, diff --git a/decoders/phoenix-v1-decoder/src/accounts/mod.rs b/decoders/phoenix-v1-decoder/src/accounts/mod.rs index a35b474f6..60ce015c2 100644 --- a/decoders/phoenix-v1-decoder/src/accounts/mod.rs +++ b/decoders/phoenix-v1-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for PhoenixDecoder { type AccountType = PhoenixAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/phoenix-v1-decoder/src/instructions/mod.rs b/decoders/phoenix-v1-decoder/src/instructions/mod.rs index 9a8addac1..47e4655a2 100644 --- a/decoders/phoenix-v1-decoder/src/instructions/mod.rs +++ b/decoders/phoenix-v1-decoder/src/instructions/mod.rs @@ -81,6 +81,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PhoenixDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pump-fees-decoder/src/accounts/mod.rs b/decoders/pump-fees-decoder/src/accounts/mod.rs index 30d15a4ed..69ee50619 100644 --- a/decoders/pump-fees-decoder/src/accounts/mod.rs +++ b/decoders/pump-fees-decoder/src/accounts/mod.rs @@ -14,7 +14,8 @@ impl AccountDecoder<'_> for PumpFeesDecoder { type AccountType = PumpFeesAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pump-fees-decoder/src/instructions/mod.rs b/decoders/pump-fees-decoder/src/instructions/mod.rs index 4e380d7d1..3210bb2f0 100644 --- a/decoders/pump-fees-decoder/src/instructions/mod.rs +++ b/decoders/pump-fees-decoder/src/instructions/mod.rs @@ -40,6 +40,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PumpFeesDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pump-swap-decoder/src/accounts/mod.rs b/decoders/pump-swap-decoder/src/accounts/mod.rs index 15000b1a0..c067b2e62 100644 --- a/decoders/pump-swap-decoder/src/accounts/mod.rs +++ b/decoders/pump-swap-decoder/src/accounts/mod.rs @@ -24,7 +24,8 @@ impl AccountDecoder<'_> for PumpSwapDecoder { type AccountType = PumpSwapAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pump-swap-decoder/src/instructions/mod.rs b/decoders/pump-swap-decoder/src/instructions/mod.rs index 5bfce11a4..6cf7dc465 100644 --- a/decoders/pump-swap-decoder/src/instructions/mod.rs +++ b/decoders/pump-swap-decoder/src/instructions/mod.rs @@ -110,6 +110,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PumpSwapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pump-swap-decoder/src/lib.rs b/decoders/pump-swap-decoder/src/lib.rs index abfbfd96f..f7db45c87 100644 --- a/decoders/pump-swap-decoder/src/lib.rs +++ b/decoders/pump-swap-decoder/src/lib.rs @@ -23,7 +23,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/buy_with_track_volume_false.json") .expect("read fixture"); - let maybe_decoded = decoder.decode_instruction(&ix); + let maybe_decoded = decoder.decode_instruction(&ix, None); let decoded = maybe_decoded.expect("Invalid instruction"); match decoded.data { PumpSwapInstruction::Buy(buy) => { @@ -43,7 +43,7 @@ mod tests { .expect("read fixture"); let decoded = decoder - .decode_instruction(&ix) + .decode_instruction(&ix, None) .expect("Invalid instruction"); match decoded.data { PumpSwapInstruction::Buy(buy) => { diff --git a/decoders/pumpfun-decoder/src/accounts/mod.rs b/decoders/pumpfun-decoder/src/accounts/mod.rs index 71c77da40..f549a82e9 100644 --- a/decoders/pumpfun-decoder/src/accounts/mod.rs +++ b/decoders/pumpfun-decoder/src/accounts/mod.rs @@ -22,7 +22,8 @@ impl AccountDecoder<'_> for PumpfunDecoder { type AccountType = PumpfunAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/pumpfun-decoder/src/instructions/mod.rs b/decoders/pumpfun-decoder/src/instructions/mod.rs index d744a6a8a..6c597f5dd 100644 --- a/decoders/pumpfun-decoder/src/instructions/mod.rs +++ b/decoders/pumpfun-decoder/src/instructions/mod.rs @@ -106,6 +106,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for PumpfunDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -290,7 +291,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/buy_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = buy::Buy::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -404,7 +405,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/sell_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = sell::Sell::arrange_accounts(&instruction.accounts).expect("aranage accounts"); @@ -496,13 +497,14 @@ mod tests { event_authority: pubkey!("Ce6TQqeHC9p8KetsN6JsjHK7UTZk7nasjjnr7XxXp9F1"), program: pubkey!("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"), }; + use carbon_test_utils; // Act let decoder = PumpfunDecoder; let instruction = carbon_test_utils::read_instruction("tests/fixtures/create_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = create::Create::arrange_accounts(&instruction.accounts).expect("aranage accounts"); diff --git a/decoders/raydium-amm-v4-decoder/src/accounts/mod.rs b/decoders/raydium-amm-v4-decoder/src/accounts/mod.rs index 679ca93b4..90fe3666d 100644 --- a/decoders/raydium-amm-v4-decoder/src/accounts/mod.rs +++ b/decoders/raydium-amm-v4-decoder/src/accounts/mod.rs @@ -18,7 +18,8 @@ impl AccountDecoder<'_> for RaydiumAmmV4Decoder { type AccountType = RaydiumAmmV4Account; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-amm-v4-decoder/src/instructions/mod.rs b/decoders/raydium-amm-v4-decoder/src/instructions/mod.rs index 8319d6f81..07ce111fb 100644 --- a/decoders/raydium-amm-v4-decoder/src/instructions/mod.rs +++ b/decoders/raydium-amm-v4-decoder/src/instructions/mod.rs @@ -57,6 +57,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumAmmV4Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-clmm-decoder/src/accounts/mod.rs b/decoders/raydium-clmm-decoder/src/accounts/mod.rs index d498ae510..96451804d 100644 --- a/decoders/raydium-clmm-decoder/src/accounts/mod.rs +++ b/decoders/raydium-clmm-decoder/src/accounts/mod.rs @@ -29,7 +29,8 @@ impl AccountDecoder<'_> for RaydiumClmmDecoder { type AccountType = RaydiumClmmAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; @@ -163,7 +164,9 @@ mod tests { let decoder = RaydiumClmmDecoder; let account = carbon_test_utils::read_account("tests/fixtures/amm_config_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -704,7 +707,9 @@ mod tests { let account = carbon_test_utils::read_account("tests/fixtures/observation_state_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -811,7 +816,9 @@ mod tests { let decoder = RaydiumClmmDecoder; let account = carbon_test_utils::read_account("tests/fixtures/pool_state_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -920,7 +927,9 @@ mod tests { let account = carbon_test_utils::read_account("tests/fixtures/protocol_position_state_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { @@ -1509,7 +1518,9 @@ mod tests { let account = carbon_test_utils::read_account("tests/fixtures/tick_array_state_account.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); // Assert match decoded_account.data { diff --git a/decoders/raydium-clmm-decoder/src/instructions/mod.rs b/decoders/raydium-clmm-decoder/src/instructions/mod.rs index 096b62303..166b281d3 100644 --- a/decoders/raydium-clmm-decoder/src/instructions/mod.rs +++ b/decoders/raydium-clmm-decoder/src/instructions/mod.rs @@ -91,6 +91,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumClmmDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; @@ -175,6 +176,7 @@ mod tests { }; use super::*; + use carbon_test_utils; #[test] fn test_decode_create_amm_config_ix() { @@ -209,7 +211,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/create_amm_config_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = CreateAmmConfig::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -251,7 +253,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/update_amm_config_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = UpdateAmmConfig::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -342,7 +344,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/create_pool_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = CreatePool::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -379,7 +381,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/update_pool_status_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = UpdatePoolStatus::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -459,7 +461,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/initialize_reward_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = InitializeReward::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -529,7 +531,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/collect_remaining_rewards_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = CollectRemainingRewards::arrange_accounts(&instruction.accounts) @@ -560,7 +562,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/update_reward_infos_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = UpdateRewardInfos::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -631,7 +633,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/set_reward_params_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SetRewardParams::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -713,7 +715,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/collect_protocol_fee_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = CollectProtocolFee::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -798,7 +800,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/collect_fund_fee_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = CollectFundFee::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -925,7 +927,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/open_position_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = OpenPosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1073,7 +1075,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/open_position_v2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = OpenPositionV2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1209,7 +1211,7 @@ mod tests { ) .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = OpenPositionWithToken22Nft::arrange_accounts(&instruction.accounts) @@ -1261,7 +1263,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/close_position_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = ClosePosition::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1356,7 +1358,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/increase_liquidity_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = IncreaseLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1463,7 +1465,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/increase_liquidity_v2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = IncreaseLiquidityV2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1562,7 +1564,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/decrease_liquidity_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = DecreaseLiquidity::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1685,7 +1687,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/decrease_liquidity_v2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = DecreaseLiquidityV2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1774,7 +1776,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = Swap::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1896,7 +1898,7 @@ mod tests { let instruction = carbon_test_utils::read_instruction("tests/fixtures/swap_v2_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SwapV2::arrange_accounts(&instruction.accounts).expect("arrange accounts"); @@ -1957,7 +1959,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/swap_router_base_in_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = SwapRouterBaseIn::arrange_accounts(&instruction.accounts).expect("arrange accounts"); diff --git a/decoders/raydium-cpmm-decoder/src/accounts/mod.rs b/decoders/raydium-cpmm-decoder/src/accounts/mod.rs index 4612b68af..4261b7a5f 100644 --- a/decoders/raydium-cpmm-decoder/src/accounts/mod.rs +++ b/decoders/raydium-cpmm-decoder/src/accounts/mod.rs @@ -20,7 +20,8 @@ impl AccountDecoder<'_> for RaydiumCpmmDecoder { type AccountType = RaydiumCpmmAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-cpmm-decoder/src/instructions/mod.rs b/decoders/raydium-cpmm-decoder/src/instructions/mod.rs index d7027ebfc..f03c9af1a 100644 --- a/decoders/raydium-cpmm-decoder/src/instructions/mod.rs +++ b/decoders/raydium-cpmm-decoder/src/instructions/mod.rs @@ -53,6 +53,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumCpmmDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-launchpad-decoder/src/accounts/mod.rs b/decoders/raydium-launchpad-decoder/src/accounts/mod.rs index 570338ddf..a67683ee3 100644 --- a/decoders/raydium-launchpad-decoder/src/accounts/mod.rs +++ b/decoders/raydium-launchpad-decoder/src/accounts/mod.rs @@ -21,7 +21,8 @@ impl AccountDecoder<'_> for RaydiumLaunchpadDecoder { type AccountType = RaydiumLaunchpadAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-launchpad-decoder/src/instructions/mod.rs b/decoders/raydium-launchpad-decoder/src/instructions/mod.rs index 5569aaacf..c2992df38 100644 --- a/decoders/raydium-launchpad-decoder/src/instructions/mod.rs +++ b/decoders/raydium-launchpad-decoder/src/instructions/mod.rs @@ -73,6 +73,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumLaunchpadDecode fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-liquidity-locking-decoder/src/accounts/mod.rs b/decoders/raydium-liquidity-locking-decoder/src/accounts/mod.rs index 50e80ef27..bb02948f5 100644 --- a/decoders/raydium-liquidity-locking-decoder/src/accounts/mod.rs +++ b/decoders/raydium-liquidity-locking-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for RaydiumLiquidityLockingDecoder { type AccountType = RaydiumLiquidityLockingAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-liquidity-locking-decoder/src/instructions/mod.rs b/decoders/raydium-liquidity-locking-decoder/src/instructions/mod.rs index 39528f14c..775f279e2 100644 --- a/decoders/raydium-liquidity-locking-decoder/src/instructions/mod.rs +++ b/decoders/raydium-liquidity-locking-decoder/src/instructions/mod.rs @@ -31,6 +31,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumLiquidityLockin fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/raydium-stable-swap-decoder/src/accounts/mod.rs b/decoders/raydium-stable-swap-decoder/src/accounts/mod.rs index 395b2892c..fc4662e09 100644 --- a/decoders/raydium-stable-swap-decoder/src/accounts/mod.rs +++ b/decoders/raydium-stable-swap-decoder/src/accounts/mod.rs @@ -1,14 +1,15 @@ -use carbon_core::account::AccountDecoder; +use carbon_core::account::{AccountDecoder, AccountMetadata}; use super::RaydiumStableSwapAmmDecoder; pub enum RaydiumStableSwapAmmAccount {} -impl AccountDecoder<'_> for RaydiumStableSwapAmmDecoder { +impl<'a> AccountDecoder<'a> for RaydiumStableSwapAmmDecoder { type AccountType = RaydiumStableSwapAmmAccount; fn decode_account( &self, - _account: &solana_account::Account, + _account: &'a solana_account::Account, + _metadata: Option<&'a AccountMetadata>, ) -> Option> { None } diff --git a/decoders/raydium-stable-swap-decoder/src/instructions/mod.rs b/decoders/raydium-stable-swap-decoder/src/instructions/mod.rs index 8cee50e2d..2e8f83918 100644 --- a/decoders/raydium-stable-swap-decoder/src/instructions/mod.rs +++ b/decoders/raydium-stable-swap-decoder/src/instructions/mod.rs @@ -33,6 +33,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumStableSwapAmmDe fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/sharky-decoder/src/accounts/mod.rs b/decoders/sharky-decoder/src/accounts/mod.rs index 97c19aba0..945ec93b8 100644 --- a/decoders/sharky-decoder/src/accounts/mod.rs +++ b/decoders/sharky-decoder/src/accounts/mod.rs @@ -21,7 +21,8 @@ impl AccountDecoder<'_> for SharkyDecoder { type AccountType = SharkyAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/sharky-decoder/src/instructions/mod.rs b/decoders/sharky-decoder/src/instructions/mod.rs index 2b027e0ae..1a37e4e25 100644 --- a/decoders/sharky-decoder/src/instructions/mod.rs +++ b/decoders/sharky-decoder/src/instructions/mod.rs @@ -57,6 +57,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SharkyDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/solayer-restaking-program-decoder/src/accounts/mod.rs b/decoders/solayer-restaking-program-decoder/src/accounts/mod.rs index 7ca691d1c..6e0eb7af8 100644 --- a/decoders/solayer-restaking-program-decoder/src/accounts/mod.rs +++ b/decoders/solayer-restaking-program-decoder/src/accounts/mod.rs @@ -13,7 +13,8 @@ impl AccountDecoder<'_> for SolayerRestakingProgramDecoder { type AccountType = SolayerRestakingProgramAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/solayer-restaking-program-decoder/src/instructions/mod.rs b/decoders/solayer-restaking-program-decoder/src/instructions/mod.rs index 687068411..235bb63af 100644 --- a/decoders/solayer-restaking-program-decoder/src/instructions/mod.rs +++ b/decoders/solayer-restaking-program-decoder/src/instructions/mod.rs @@ -27,6 +27,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SolayerRestakingProgra fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/stabble-stable-swap-decoder/src/accounts/mod.rs b/decoders/stabble-stable-swap-decoder/src/accounts/mod.rs index 2c7d9c822..6d2e87453 100644 --- a/decoders/stabble-stable-swap-decoder/src/accounts/mod.rs +++ b/decoders/stabble-stable-swap-decoder/src/accounts/mod.rs @@ -18,7 +18,8 @@ impl AccountDecoder<'_> for StableSwapDecoder { type AccountType = StableSwapAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/stabble-stable-swap-decoder/src/instructions/mod.rs b/decoders/stabble-stable-swap-decoder/src/instructions/mod.rs index 0d0ed2b0a..69aca5b83 100644 --- a/decoders/stabble-stable-swap-decoder/src/instructions/mod.rs +++ b/decoders/stabble-stable-swap-decoder/src/instructions/mod.rs @@ -59,6 +59,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for StableSwapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/stabble-weighted-swap-decoder/src/accounts/mod.rs b/decoders/stabble-weighted-swap-decoder/src/accounts/mod.rs index e7fb647d9..318a32cc9 100644 --- a/decoders/stabble-weighted-swap-decoder/src/accounts/mod.rs +++ b/decoders/stabble-weighted-swap-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for WeightedSwapDecoder { type AccountType = WeightedSwapAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/stabble-weighted-swap-decoder/src/instructions/mod.rs b/decoders/stabble-weighted-swap-decoder/src/instructions/mod.rs index 48f52a582..4795a896f 100644 --- a/decoders/stabble-weighted-swap-decoder/src/instructions/mod.rs +++ b/decoders/stabble-weighted-swap-decoder/src/instructions/mod.rs @@ -51,6 +51,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for WeightedSwapDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/stake-program-decoder/src/accounts/mod.rs b/decoders/stake-program-decoder/src/accounts/mod.rs index 1c0bee3e7..4ad5849a0 100644 --- a/decoders/stake-program-decoder/src/accounts/mod.rs +++ b/decoders/stake-program-decoder/src/accounts/mod.rs @@ -1,14 +1,15 @@ -use carbon_core::account::AccountDecoder; +use carbon_core::account::{AccountDecoder, AccountMetadata}; use super::StakeProgramDecoder; pub enum StakeProgramAccount {} -impl AccountDecoder<'_> for StakeProgramDecoder { +impl<'a> AccountDecoder<'a> for StakeProgramDecoder { type AccountType = StakeProgramAccount; fn decode_account( &self, - _account: &solana_account::Account, + _account: &'a solana_account::Account, + _metadata: Option<&'a AccountMetadata>, ) -> Option> { None } diff --git a/decoders/stake-program-decoder/src/instructions/mod.rs b/decoders/stake-program-decoder/src/instructions/mod.rs index 939ac4278..0d7eb0389 100644 --- a/decoders/stake-program-decoder/src/instructions/mod.rs +++ b/decoders/stake-program-decoder/src/instructions/mod.rs @@ -51,6 +51,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for StakeProgramDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/swig-decoder/src/accounts/mod.rs b/decoders/swig-decoder/src/accounts/mod.rs index b23ffd3b9..c80bcc3d6 100644 --- a/decoders/swig-decoder/src/accounts/mod.rs +++ b/decoders/swig-decoder/src/accounts/mod.rs @@ -18,7 +18,8 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for SwigDecoder { fn decode_account( &self, - account: &'a solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/decoders/swig-decoder/src/instructions/mod.rs b/decoders/swig-decoder/src/instructions/mod.rs index 0be74f419..064176788 100644 --- a/decoders/swig-decoder/src/instructions/mod.rs +++ b/decoders/swig-decoder/src/instructions/mod.rs @@ -60,6 +60,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SwigDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/system-program-decoder/src/accounts/mod.rs b/decoders/system-program-decoder/src/accounts/mod.rs index 3b082ce26..c17ee8c5c 100644 --- a/decoders/system-program-decoder/src/accounts/mod.rs +++ b/decoders/system-program-decoder/src/accounts/mod.rs @@ -15,7 +15,8 @@ impl AccountDecoder<'_> for SystemProgramDecoder { type AccountType = SystemAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&solana_system_interface::program::id()) { return None; diff --git a/decoders/system-program-decoder/src/instructions/mod.rs b/decoders/system-program-decoder/src/instructions/mod.rs index f19ac6a21..398f754e1 100644 --- a/decoders/system-program-decoder/src/instructions/mod.rs +++ b/decoders/system-program-decoder/src/instructions/mod.rs @@ -45,6 +45,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for SystemProgramDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction .program_id @@ -131,7 +132,7 @@ mod tests { carbon_test_utils::read_instruction("tests/fixtures/create_with_seed_ix.json") .expect("read fixture"); let decoded = decoder - .decode_instruction(&instruction) + .decode_instruction(&instruction, None) .expect("decode instruction"); let decoded_arranged_accounts = create_account_with_seed::CreateAccountWithSeed::arrange_accounts( diff --git a/decoders/token-2022-decoder/src/accounts/mod.rs b/decoders/token-2022-decoder/src/accounts/mod.rs index c1e271dec..5aa7222eb 100644 --- a/decoders/token-2022-decoder/src/accounts/mod.rs +++ b/decoders/token-2022-decoder/src/accounts/mod.rs @@ -35,7 +35,8 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for Token2022Decoder { fn decode_account( &self, - account: &'a solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/decoders/token-2022-decoder/src/instructions/mod.rs b/decoders/token-2022-decoder/src/instructions/mod.rs index 69870c22f..966237511 100644 --- a/decoders/token-2022-decoder/src/instructions/mod.rs +++ b/decoders/token-2022-decoder/src/instructions/mod.rs @@ -293,6 +293,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for Token2022Decoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/token-program-decoder/src/accounts/mod.rs b/decoders/token-program-decoder/src/accounts/mod.rs index bd5f345e8..d3df4867e 100644 --- a/decoders/token-program-decoder/src/accounts/mod.rs +++ b/decoders/token-program-decoder/src/accounts/mod.rs @@ -16,7 +16,8 @@ impl AccountDecoder<'_> for TokenProgramDecoder { fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&spl_token_interface::id()) { return None; diff --git a/decoders/token-program-decoder/src/instructions/mod.rs b/decoders/token-program-decoder/src/instructions/mod.rs index 8d3ecf74f..71672dd40 100644 --- a/decoders/token-program-decoder/src/instructions/mod.rs +++ b/decoders/token-program-decoder/src/instructions/mod.rs @@ -70,6 +70,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for TokenProgramDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&spl_token_interface::id()) { return None; diff --git a/decoders/vertigo-decoder/src/accounts/mod.rs b/decoders/vertigo-decoder/src/accounts/mod.rs index 10f4fcb63..0fe4de430 100644 --- a/decoders/vertigo-decoder/src/accounts/mod.rs +++ b/decoders/vertigo-decoder/src/accounts/mod.rs @@ -12,7 +12,8 @@ impl AccountDecoder<'_> for VertigoDecoder { type AccountType = AmmAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if let Some(decoded_account) = pool::Pool::deserialize(account.data.as_slice()) { return Some(carbon_core::account::DecodedAccount { diff --git a/decoders/vertigo-decoder/src/instructions/mod.rs b/decoders/vertigo-decoder/src/instructions/mod.rs index ca5ee2285..3d535f1fb 100644 --- a/decoders/vertigo-decoder/src/instructions/mod.rs +++ b/decoders/vertigo-decoder/src/instructions/mod.rs @@ -30,6 +30,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for VertigoDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { carbon_core::try_decode_instructions!(instruction, VertigoInstruction::Buy => buy::Buy, diff --git a/decoders/virtuals-decoder/src/accounts/mod.rs b/decoders/virtuals-decoder/src/accounts/mod.rs index 3af0bb149..9037318b3 100644 --- a/decoders/virtuals-decoder/src/accounts/mod.rs +++ b/decoders/virtuals-decoder/src/accounts/mod.rs @@ -14,7 +14,8 @@ impl AccountDecoder<'_> for VirtualsDecoder { type AccountType = VirtualsAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/virtuals-decoder/src/instructions/mod.rs b/decoders/virtuals-decoder/src/instructions/mod.rs index d65137cd7..281ecf13a 100644 --- a/decoders/virtuals-decoder/src/instructions/mod.rs +++ b/decoders/virtuals-decoder/src/instructions/mod.rs @@ -45,6 +45,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for VirtualsDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/wavebreak-decoder/src/accounts/mod.rs b/decoders/wavebreak-decoder/src/accounts/mod.rs index fb16a6de5..00ec15f8e 100644 --- a/decoders/wavebreak-decoder/src/accounts/mod.rs +++ b/decoders/wavebreak-decoder/src/accounts/mod.rs @@ -22,7 +22,8 @@ impl AccountDecoder<'_> for WavebreakDecoder { type AccountType = WavebreakAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/wavebreak-decoder/src/instructions/mod.rs b/decoders/wavebreak-decoder/src/instructions/mod.rs index e2a347921..4daa686a2 100644 --- a/decoders/wavebreak-decoder/src/instructions/mod.rs +++ b/decoders/wavebreak-decoder/src/instructions/mod.rs @@ -133,6 +133,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for WavebreakDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; diff --git a/decoders/zeta-decoder/src/accounts/mod.rs b/decoders/zeta-decoder/src/accounts/mod.rs index e8c30c0b0..ca7436eaf 100644 --- a/decoders/zeta-decoder/src/accounts/mod.rs +++ b/decoders/zeta-decoder/src/accounts/mod.rs @@ -59,7 +59,8 @@ impl AccountDecoder<'_> for ZetaDecoder { type AccountType = ZetaAccount; fn decode_account( &self, - account: &solana_account::Account, + account: &'_ solana_account::Account, + _metadata: Option<&carbon_core::account::AccountMetadata>, ) -> Option> { if !account.owner.eq(&PROGRAM_ID) { return None; diff --git a/decoders/zeta-decoder/src/instructions/mod.rs b/decoders/zeta-decoder/src/instructions/mod.rs index 43ef1ffc1..e045dacd3 100644 --- a/decoders/zeta-decoder/src/instructions/mod.rs +++ b/decoders/zeta-decoder/src/instructions/mod.rs @@ -355,6 +355,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for ZetaDecoder { fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if !instruction.program_id.eq(&PROGRAM_ID) { return None; From 33c02b21cd3c5c946d6515b65b3df0e12c10c864 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 5 Dec 2025 19:55:55 +0530 Subject: [PATCH 3/5] feat: update cli parse cmd to generated versioned decoders --- packages/cli/src/cli.ts | 2 ++ packages/cli/src/lib/decoder.ts | 4 ++++ packages/renderer/src/cargoTomlGenerator.ts | 8 +++++++- packages/renderer/src/getRenderMapVisitor.ts | 3 +++ packages/renderer/src/renderVisitor.ts | 1 + packages/renderer/templates/accountsMod.njk | 1 + packages/renderer/templates/instructionsMod.njk | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 464fee172..44fecfd25 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -60,6 +60,7 @@ program .option('--with-postgres ', 'Include Postgres wiring and deps (default: true)') .option('--with-graphql ', 'Include GraphQL wiring and deps (default: true)') .option('--with-serde ', 'Include serde feature for decoder (default: false)') + .option('--version-name ', 'Name for this decoder version (e.g., "v1", "v2")') .option('--no-clean', 'Do not delete output directory before rendering', false) .action(async opts => { showBanner(); @@ -98,6 +99,7 @@ program withGraphql, withSerde, standalone: true, + versionName: opts.versionName, }); logger.succeedSpinner('Decoder generated'); diff --git a/packages/cli/src/lib/decoder.ts b/packages/cli/src/lib/decoder.ts index aacabcc32..489031b37 100644 --- a/packages/cli/src/lib/decoder.ts +++ b/packages/cli/src/lib/decoder.ts @@ -77,6 +77,7 @@ export type DecoderGenerationOptions = { withGraphql?: boolean; withSerde?: boolean; standalone?: boolean; + versionName?: string; }; export type IdlMetadata = { @@ -284,6 +285,7 @@ export async function generateDecoder(options: DecoderGenerationOptions): Promis withGraphql, withSerde, standalone, + versionName: options.versionName, }), ); return; @@ -347,6 +349,7 @@ export async function generateDecoder(options: DecoderGenerationOptions): Promis withGraphql, withSerde, standalone, + versionName: options.versionName, }), ); } else { @@ -360,6 +363,7 @@ export async function generateDecoder(options: DecoderGenerationOptions): Promis withGraphql, withSerde, standalone, + versionName: options.versionName, }), ); } diff --git a/packages/renderer/src/cargoTomlGenerator.ts b/packages/renderer/src/cargoTomlGenerator.ts index 2be274759..e1432a5b3 100644 --- a/packages/renderer/src/cargoTomlGenerator.ts +++ b/packages/renderer/src/cargoTomlGenerator.ts @@ -6,6 +6,7 @@ export type DecoderCargoTomlOptions = { packageName?: string; programName: string; originalProgramName?: string; // Original program name from IDL (for token-2022 checks) + versionName?: string; // Version suffix (e.g., "v1", "v2") to append to crate name withPostgres: boolean; withGraphQL: boolean; withSerde: boolean; @@ -17,19 +18,24 @@ export function generateDecoderCargoToml(options: DecoderCargoTomlOptions): stri packageName, programName, originalProgramName, + versionName, withPostgres, withGraphQL, withSerde, standalone = true, } = options; - const decoderPackageName = + let decoderPackageName = packageName && packageName.trim() ? `carbon-${kebabCase(packageName)}-decoder` : programName && programName.trim() ? `carbon-${kebabCase(programName)}-decoder` : 'carbon-decoder'; + if (versionName && versionName.trim()) { + decoderPackageName = `${decoderPackageName}-${kebabCase(versionName)}`; + } + const carbonCoreDep = getCrateDependencyString('carbon-core', VERSIONS['carbon-core'], ['macros']); const carbonTestUtilsDep = getCrateDependencyString('carbon-test-utils', VERSIONS['carbon-test-utils']); const borshDep = getCrateDependencyString('borsh', VERSIONS['borsh'], ['derive']); diff --git a/packages/renderer/src/getRenderMapVisitor.ts b/packages/renderer/src/getRenderMapVisitor.ts index 88ddc2e18..ec11e2173 100644 --- a/packages/renderer/src/getRenderMapVisitor.ts +++ b/packages/renderer/src/getRenderMapVisitor.ts @@ -40,6 +40,7 @@ export type GetRenderMapOptions = { withGraphql?: boolean; withSerde?: boolean; standalone?: boolean; + versionName?: string; }; type FlattenedField = { @@ -665,6 +666,7 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { withPostgres: options.withPostgres !== false, withGraphQL: options.withGraphql !== false, withSerde: options.withSerde ?? false, + versionName: options.versionName, }; const map = new RenderMap(); @@ -838,6 +840,7 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { packageName: options.packageName, programName: programName, originalProgramName: originalProgramName, // Pass original program name for token-2022 checks + versionName: options.versionName, withPostgres: options.withPostgres !== false, withGraphQL: options.withGraphql !== false, withSerde: options.withSerde ?? false, diff --git a/packages/renderer/src/renderVisitor.ts b/packages/renderer/src/renderVisitor.ts index bd7a6a696..29f81bcc9 100644 --- a/packages/renderer/src/renderVisitor.ts +++ b/packages/renderer/src/renderVisitor.ts @@ -10,6 +10,7 @@ export type RenderOptions = GetRenderMapOptions & { discriminator: number[]; }[]; postgresMode?: 'generic' | 'typed'; + versionName?: string; }; export function renderVisitor(path: string, options: RenderOptions = {}) { diff --git a/packages/renderer/templates/accountsMod.njk b/packages/renderer/templates/accountsMod.njk index ece496734..bca3b06e9 100644 --- a/packages/renderer/templates/accountsMod.njk +++ b/packages/renderer/templates/accountsMod.njk @@ -31,6 +31,7 @@ impl<'a> carbon_core::account::AccountDecoder<'a> for {{ program.name | pascalCa fn decode_account( &self, account: &'a solana_account::Account, + _metadata: Option<&'a carbon_core::account::AccountMetadata>, ) -> Option> { if account.owner != PROGRAM_ID { return None; diff --git a/packages/renderer/templates/instructionsMod.njk b/packages/renderer/templates/instructionsMod.njk index 45e15281b..0b63a89f9 100644 --- a/packages/renderer/templates/instructionsMod.njk +++ b/packages/renderer/templates/instructionsMod.njk @@ -44,6 +44,7 @@ impl carbon_core::instruction::InstructionDecoder<'_> for {{ program.name | pasc fn decode_instruction( &self, instruction: &solana_instruction::Instruction, + _metadata: Option<&carbon_core::instruction::InstructionMetadata>, ) -> Option> { if instruction.program_id != PROGRAM_ID { return None; From 0693485033af6a462c62753aca565080430dd5f2 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 5 Dec 2025 20:24:39 +0530 Subject: [PATCH 4/5] fix: ci checks --- crates/core/src/account.rs | 36 +++++----- crates/core/src/instruction.rs | 67 ++++++++++--------- .../src/accounts/dynamic_tick_array.rs | 2 +- packages/renderer/src/renderVisitor.ts | 7 -- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/crates/core/src/account.rs b/crates/core/src/account.rs index 78b808d24..b76a9abf4 100644 --- a/crates/core/src/account.rs +++ b/crates/core/src/account.rs @@ -216,15 +216,18 @@ impl AccountPipes for AccountPipe { } } +/// Type alias for a versioned account decoder entry. +type VersionedAccountDecoderEntry = ( + SlotRange, + Box AccountDecoder<'a, AccountType = T> + Send + Sync + 'static>, +); + /// Routes to different account decoders based on slot ranges. /// /// `T`: The unified account type that all decoders must return. /// For decoders with different types, use `VersionedAccountDecoderEnum` instead. pub struct VersionedAccountDecoder { - versions: Vec<( - SlotRange, - Box AccountDecoder<'a, AccountType = T> + Send + Sync + 'static>, - )>, + versions: Vec>, } impl VersionedAccountDecoder { @@ -272,21 +275,24 @@ impl<'a, T> AccountDecoder<'a> for VersionedAccountDecoder { } } +/// Type alias for a versioned account decoder enum entry. +type VersionedAccountDecoderEnumEntry = ( + SlotRange, + Box< + dyn for<'b> Fn( + &'b solana_account::Account, + Option<&'b AccountMetadata>, + ) -> Option> + + Send + + Sync, + >, +); + /// Routes to different account decoders based on slot ranges, wrapping results into a unified enum. /// /// `E`: The unified enum type that wraps all version-specific account types. pub struct VersionedAccountDecoderEnum { - versions: Vec<( - SlotRange, - Box< - dyn for<'b> Fn( - &'b solana_account::Account, - Option<&'b AccountMetadata>, - ) -> Option> - + Send - + Sync, - >, - )>, + versions: Vec>, } impl VersionedAccountDecoderEnum { diff --git a/crates/core/src/instruction.rs b/crates/core/src/instruction.rs index 2930f81cf..8bbb8b686 100644 --- a/crates/core/src/instruction.rs +++ b/crates/core/src/instruction.rs @@ -238,21 +238,24 @@ impl SlotRange { } } +/// Type alias for a versioned instruction decoder entry. +type VersionedInstructionDecoderEntry = ( + Option, + Box InstructionDecoder<'a, InstructionType = T> + Send + Sync + 'static>, +); + /// Routes to multiple decoder versions with two strategies: /// 1. Slot-based routing: routes based on slot when ranges are provided /// 2. Sequential fallback: tries decoders sequentially when ranges are `None` or metadata is missing /// /// `T`: The unified instruction type that all decoders must return. -/// For decoders with different types, use `VersionedDecoderEnum` instead. -pub struct VersionedDecoder { - versions: Vec<( - Option, - Box InstructionDecoder<'a, InstructionType = T> + Send + Sync + 'static>, - )>, +/// For decoders with different types, use `VersionedInstructionDecoderEnum` instead. +pub struct VersionedInstructionDecoder { + versions: Vec>, } -impl VersionedDecoder { - /// Creates a new VersionedDecoder. +impl VersionedInstructionDecoder { + /// Creates a new VersionedInstructionDecoder. pub fn new() -> Self { Self { versions: Vec::new(), @@ -270,13 +273,13 @@ impl VersionedDecoder { } } -impl Default for VersionedDecoder { +impl Default for VersionedInstructionDecoder { fn default() -> Self { Self::new() } } -impl<'a, T> InstructionDecoder<'a> for VersionedDecoder { +impl<'a, T> InstructionDecoder<'a> for VersionedInstructionDecoder { type InstructionType = T; fn decode_instruction( @@ -318,25 +321,28 @@ impl<'a, T> InstructionDecoder<'a> for VersionedDecoder { } } +/// Type alias for a versioned instruction decoder enum entry. +type VersionedInstructionDecoderEnumEntry = ( + Option, + Box< + dyn for<'b> Fn( + &'b solana_instruction::Instruction, + Option<&'b InstructionMetadata>, + ) -> Option> + + Send + + Sync, + >, +); + /// Routes to multiple decoder versions, wrapping results into a unified enum type. /// /// `E`: The unified enum type that wraps all version-specific instruction types. -pub struct VersionedDecoderEnum { - versions: Vec<( - Option, - Box< - dyn for<'b> Fn( - &'b solana_instruction::Instruction, - Option<&'b InstructionMetadata>, - ) -> Option> - + Send - + Sync, - >, - )>, +pub struct VersionedInstructionDecoderEnum { + versions: Vec>, } -impl VersionedDecoderEnum { - /// Creates a new VersionedDecoderEnum. +impl VersionedInstructionDecoderEnum { + /// Creates a new VersionedInstructionDecoderEnum. pub fn new() -> Self { Self { versions: Vec::new(), @@ -367,13 +373,13 @@ impl VersionedDecoderEnum { } } -impl Default for VersionedDecoderEnum { +impl Default for VersionedInstructionDecoderEnum { fn default() -> Self { Self::new() } } -impl<'a, E> InstructionDecoder<'a> for VersionedDecoderEnum { +impl<'a, E> InstructionDecoder<'a> for VersionedInstructionDecoderEnum { type InstructionType = E; fn decode_instruction( @@ -879,7 +885,7 @@ mod tests { #[test] fn test_versioned_decoder_filters_by_range() { let range = SlotRange::between(100, 200); - let decoder = VersionedDecoder::new().add_version(TestDecoder, Some(range)); + let decoder = VersionedInstructionDecoder::new().add_version(TestDecoder, Some(range)); let instruction = Instruction { program_id: Pubkey::new_unique(), accounts: vec![], @@ -950,7 +956,7 @@ mod tests { } } - let decoder = VersionedDecoder::new() + let decoder = VersionedInstructionDecoder::new() .add_version(V1Decoder, Some(SlotRange::to(1000))) .add_version(V2Decoder, Some(SlotRange::from(1001))); @@ -975,7 +981,8 @@ mod tests { #[test] fn test_versioned_decoder_handles_none_metadata() { - let decoder = VersionedDecoder::new().add_version(TestDecoder, Some(SlotRange::all())); + let decoder = + VersionedInstructionDecoder::new().add_version(TestDecoder, Some(SlotRange::all())); let instruction = Instruction { program_id: Pubkey::new_unique(), accounts: vec![], @@ -1026,7 +1033,7 @@ mod tests { } // Both ranges include slot 150 - let decoder = VersionedDecoder::new() + let decoder = VersionedInstructionDecoder::new() .add_version(FirstDecoder, Some(SlotRange::between(100, 200))) .add_version(SecondDecoder, Some(SlotRange::between(150, 250))); diff --git a/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs b/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs index 9fb044d03..9441035b8 100644 --- a/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs +++ b/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs @@ -27,7 +27,7 @@ mod tests { carbon_test_utils::read_account("tests/fixtures/dynamic_tick_array_account0.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account).expect("decode fixture"); + let decoded_account = decoder.decode_account(&account, None).expect("decode fixture"); match decoded_account.data { WhirlpoolAccount::DynamicTickArray(account) => { diff --git a/packages/renderer/src/renderVisitor.ts b/packages/renderer/src/renderVisitor.ts index 29f81bcc9..a7a99e197 100644 --- a/packages/renderer/src/renderVisitor.ts +++ b/packages/renderer/src/renderVisitor.ts @@ -4,13 +4,6 @@ import { getRenderMapVisitor, GetRenderMapOptions } from './getRenderMapVisitor' export type RenderOptions = GetRenderMapOptions & { deleteFolderBeforeRendering?: boolean; - packageName?: string; - anchorEvents?: { - name: string; - discriminator: number[]; - }[]; - postgresMode?: 'generic' | 'typed'; - versionName?: string; }; export function renderVisitor(path: string, options: RenderOptions = {}) { From 84e675e69240981a498b60540e962a8559f266d9 Mon Sep 17 00:00:00 2001 From: arrayappy Date: Fri, 5 Dec 2025 20:57:05 +0530 Subject: [PATCH 5/5] fix: ci checks --- .../orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs b/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs index 9441035b8..779a5ee76 100644 --- a/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs +++ b/decoders/orca-whirlpool-decoder/src/accounts/dynamic_tick_array.rs @@ -27,7 +27,9 @@ mod tests { carbon_test_utils::read_account("tests/fixtures/dynamic_tick_array_account0.json") .expect("read fixture"); - let decoded_account = decoder.decode_account(&account, None).expect("decode fixture"); + let decoded_account = decoder + .decode_account(&account, None) + .expect("decode fixture"); match decoded_account.data { WhirlpoolAccount::DynamicTickArray(account) => {