Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions crates/core/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ pub trait AccountDecoder<'a> {
/// The input type for the account processor.
///
/// - `T`: The account type, as determined by the decoder.
pub type AccountProcessorInputType<T> = (AccountMetadata, DecodedAccount<T>);
pub type AccountProcessorInputType<T> =
(AccountMetadata, DecodedAccount<T>, solana_account::Account);

/// A processing pipe that decodes and processes Solana account updates.
///
Expand Down Expand Up @@ -207,7 +208,14 @@ impl<T: Send> AccountPipes for AccountPipe<T> {

if let Some(decoded_account) = self.decoder.decode_account(&account_with_metadata.1) {
self.processor
.process((account_with_metadata.0, decoded_account), metrics)
.process(
(
account_with_metadata.0.clone(),
decoded_account,
account_with_metadata.1,
),
metrics.clone(),
)
.await?;
}
Ok(())
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pub type InstructionProcessorInputType<T> = (
InstructionMetadata,
DecodedInstruction<T>,
NestedInstructions,
solana_instruction::Instruction,
);

/// A processing pipeline for instructions, using a decoder and processor.
Expand Down Expand Up @@ -182,6 +183,7 @@ impl<T: Send + 'static> InstructionPipes<'_> for InstructionPipe<T> {
nested_instruction.metadata.clone(),
decoded_instruction,
nested_instruction.inner_instructions.clone(),
nested_instruction.instruction.clone(),
),
metrics.clone(),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/block-crawler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Processor for PumpfunInstructionProcessor {
data: Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let (metadata, pumpfun_instruction, _) = data;
let (metadata, pumpfun_instruction, _nested_instructions, _) = data;

match pumpfun_instruction.data {
PumpfunInstruction::CreateEvent(create_event) => {
Expand Down
1 change: 1 addition & 0 deletions examples/jupiter-swap-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
yellowstone-grpc-proto = { workspace = true }

Expand Down
3 changes: 2 additions & 1 deletion examples/jupiter-swap-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ impl Processor for JupiterSwapInstructionProcessor {
InstructionMetadata,
DecodedInstruction<JupiterSwapInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);
async fn process(
&mut self,
(metadata, instruction, nested_instructions): Self::InputType,
(metadata, instruction, nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down
2 changes: 2 additions & 0 deletions examples/kamino-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-account = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
yellowstone-grpc-proto = { workspace = true }
9 changes: 7 additions & 2 deletions examples/kamino-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ impl Processor for KaminoLendingInstructionProcessor {
InstructionMetadata,
DecodedInstruction<KaminoLendingInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand All @@ -111,7 +112,11 @@ impl Processor for KaminoLendingInstructionProcessor {
pub struct KaminoLendingAccountProcessor;
#[async_trait]
impl Processor for KaminoLendingAccountProcessor {
type InputType = (AccountMetadata, DecodedAccount<KaminoLendingAccount>);
type InputType = (
AccountMetadata,
DecodedAccount<KaminoLendingAccount>,
solana_account::Account,
);

async fn process(
&mut self,
Expand Down
1 change: 1 addition & 0 deletions examples/meteora-activities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ solana-commitment-config = { workspace = true }
async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
3 changes: 2 additions & 1 deletion examples/meteora-activities/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ impl Processor for MeteoraInstructionProcessor {
InstructionMetadata,
DecodedInstruction<MeteoraDlmmInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
data: Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let (_instruction_metadata, decoded_instruction, _nested_instructions) = data;
let (_instruction_metadata, decoded_instruction, _nested_instructions, _) = data;

// Process all Meteora Events and add each to DB
match decoded_instruction.data {
Expand Down
1 change: 1 addition & 0 deletions examples/moonshot-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
3 changes: 2 additions & 1 deletion examples/moonshot-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ impl Processor for MoonshotInstructionProcessor {
InstructionMetadata,
DecodedInstruction<MoonshotInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down
1 change: 1 addition & 0 deletions examples/openbook-v2-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
3 changes: 2 additions & 1 deletion examples/openbook-v2-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ impl Processor for OpenbookV2InstructionProcessor {
InstructionMetadata,
DecodedInstruction<OpenbookV2Instruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down
2 changes: 2 additions & 0 deletions examples/raydium-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-account = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
yellowstone-grpc-proto = { workspace = true }

Expand Down
9 changes: 7 additions & 2 deletions examples/raydium-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ impl Processor for RaydiumAmmV4InstructionProcessor {
InstructionMetadata,
DecodedInstruction<RaydiumAmmV4Instruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down Expand Up @@ -195,7 +196,11 @@ impl Processor for RaydiumAmmV4InstructionProcessor {
pub struct RaydiumAmmV4AccountProcessor;
#[async_trait]
impl Processor for RaydiumAmmV4AccountProcessor {
type InputType = (AccountMetadata, DecodedAccount<RaydiumAmmV4Account>);
type InputType = (
AccountMetadata,
DecodedAccount<RaydiumAmmV4Account>,
solana_account::Account,
);

async fn process(
&mut self,
Expand Down
1 change: 1 addition & 0 deletions examples/raydium-clmm-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ carbon-log-metrics = { workspace = true }
carbon-raydium-clmm-decoder = { workspace = true }
carbon-rpc-block-subscribe-datasource = { workspace = true }
solana-client = { workspace = true }
solana-instruction = { workspace = true }

async-trait = { workspace = true }
dotenv = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion examples/raydium-clmm-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ impl Processor for RaydiumClmmInstructionProcessor {
InstructionMetadata,
DecodedInstruction<RaydiumClmmInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down
1 change: 1 addition & 0 deletions examples/raydium-cpmm-alerts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ async-trait = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
log = { workspace = true }
solana-instruction = { workspace = true }
tokio = { workspace = true, features = ["full"] }
3 changes: 2 additions & 1 deletion examples/raydium-cpmm-alerts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ impl Processor for RaydiumCpmmInstructionProcessor {
InstructionMetadata,
DecodedInstruction<RaydiumCpmmInstruction>,
NestedInstructions,
solana_instruction::Instruction,
);

async fn process(
&mut self,
(metadata, instruction, _nested_instructions): Self::InputType,
(metadata, instruction, _nested_instructions, _): Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let signature = metadata.transaction_metadata.signature;
Expand Down
2 changes: 1 addition & 1 deletion examples/sharky-offers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Processor for SharkyAccountProcessor {
update: Self::InputType,
_metrics: Arc<MetricsCollection>,
) -> CarbonResult<()> {
let (_metadata, account) = update;
let (_metadata, account, _raw_account) = update;

match account.data {
SharkyAccount::OrderBook(order_book) => {
Expand Down
1 change: 1 addition & 0 deletions examples/token-indexing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spl-token = { workspace = true }
async-trait = { workspace = true }
dotenv = { workspace = true }
log = { workspace = true }
solana-account = { workspace = true }
tokio = { workspace = true, features = ["full"] }
yellowstone-grpc-proto = { workspace = true }

Expand Down
6 changes: 5 additions & 1 deletion examples/token-indexing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ pub struct TokenProgramAccountProcessor {

#[async_trait]
impl Processor for TokenProgramAccountProcessor {
type InputType = (AccountMetadata, DecodedAccount<TokenProgramAccount>);
type InputType = (
AccountMetadata,
DecodedAccount<TokenProgramAccount>,
solana_account::Account,
);

async fn process(
&mut self,
Expand Down
Loading