Jupiter DCA decoder
Decode Jupiter DCA instructions, accounts and events in Rust with carbon-jupiter-dca-decoder 2.0.0. Program ID DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M.
On this page
carbon-jupiter-dca-decoder decodes the instructions, accounts and events of the Jupiter DCA program (DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M): 12 instructions, 1 account type, 6 events. It is generated with Codama from the program's IDL; see decoders for how decoders plug into a pipeline.
| Crate | carbon-jupiter-dca-decoder 2.0.0 |
| Install | cargo add carbon-jupiter-dca-decoder@2. |
| Program ID | DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M (carbon_) |
| Category | Other |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Event enum | instructions:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-jupiter-dca-decoder/2.0.0 |
| Source | decoders/jupiter-dca-decoder |
More program decoders without a category: Kamino Farms, Pump Fees, Raydium Liquidity Locking, Swig. To decode several in one pipeline, see other program decoders.
The serde feature derives Serialize/Deserialize on every type, postgres adds tables and processors for Postgres, and graphql adds a schema for the GraphQL server.
Usage#
This program crawls recent Jupiter DCA transactions from the public RPC and prints every decoded Deposit instruction. Add the dependencies:
cargo add carbon-core@2.0.0 carbon-jupiter-dca-decoder@2.0.0 carbon-rpc-transaction-crawler-datasource@2.0.0 carbon-log-metrics@2.0.0 env_logger tokio --features tokio/fulluse {
carbon_core::{
error::CarbonResult, instruction::InstructionProcessorInputType, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_jupiter_dca_decoder::{
instructions::JupiterDcaInstruction, JupiterDcaDecoder, PROGRAM_ID,
},
carbon_rpc_transaction_crawler_datasource::{ConnectionConfig, Filters, RpcTransactionCrawler},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Fetches the program's recent transactions over JSON-RPC, newest first.
let datasource = RpcTransactionCrawler::new(
"https://api.mainnet-beta.solana.com".to_string(),
PROGRAM_ID,
ConnectionConfig::default(),
Filters::new(None, None, None),
None,
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.instruction(JupiterDcaDecoder, InstructionLogger)
.build()?
.run()
.await
}
struct InstructionLogger;
impl Processor<InstructionProcessorInputType<'_, JupiterDcaInstruction>> for InstructionLogger {
async fn process(
&mut self,
input: &InstructionProcessorInputType<'_, JupiterDcaInstruction>,
) -> CarbonResult<()> {
let signature = input.metadata.transaction_metadata.signature;
if let JupiterDcaInstruction::Deposit { data, accounts, .. } = input.decoded_instruction {
println!("deposit {signature}: {data:?} user={}", accounts.user);
}
Ok(())
}
}RUST_LOG=info cargo runEach Deposit instruction prints one line with the transaction signature and the decoded Deposit data. The public endpoint rate-limits requests, so the first lines can take a while; use your own RPC URL for anything beyond a test. See stream with RPC for the crawler options.
Events published with Anchor's emit_cpi! arrive as the CpiEvent instruction. Match them with JupiterDcaInstruction:: (import instructions::); see Events. If CpiEvent never arrives, the program logs its events with emit! instead: decode them with decode_.
Decode accounts#
The transaction crawler emits transactions only. To decode accounts, use a datasource that emits account updates. This program subscribes to the program's accounts with programSubscribe on the public WebSocket endpoint and prints every decoded Dca account as it changes. Add the datasource and the Solana RPC types it takes:
cargo add carbon-rpc-program-subscribe-datasource@2.0.0 solana-client@4.2.2use {
carbon_core::{
account::AccountProcessorInputType, error::CarbonResult, pipeline::Pipeline,
processor::Processor,
},
carbon_log_metrics::LogMetrics,
carbon_jupiter_dca_decoder::{accounts::JupiterDcaAccount, JupiterDcaDecoder, PROGRAM_ID},
carbon_rpc_program_subscribe_datasource::{Filters, RpcProgramSubscribe},
solana_client::rpc_config::{RpcAccountInfoConfig, RpcProgramAccountsConfig, UiAccountEncoding},
std::sync::Arc,
};
#[tokio::main]
async fn main() -> CarbonResult<()> {
env_logger::init();
// Streams every change to an account owned by the program (programSubscribe).
let config = RpcProgramAccountsConfig {
account_config: RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::Base64),
..Default::default()
},
..Default::default()
};
let datasource = RpcProgramSubscribe::new(
"wss://api.mainnet-beta.solana.com".to_string(),
Filters::new(PROGRAM_ID, Some(config)),
);
Pipeline::builder()
.datasource(datasource)
.metrics(Arc::new(LogMetrics::new()))
.account(JupiterDcaDecoder, AccountLogger)
.build()?
.run()
.await
}
struct AccountLogger;
impl Processor<AccountProcessorInputType<'_, JupiterDcaAccount>> for AccountLogger {
async fn process(
&mut self,
input: &AccountProcessorInputType<'_, JupiterDcaAccount>,
) -> CarbonResult<()> {
let JupiterDcaAccount::Dca(dca) = &input.decoded_account.data;
println!("dca {}: {dca:?}", input.metadata.pubkey);
Ok(())
}
}RUST_LOG=info cargo runEach update to a Dca account prints its address and decoded fields; the program runs until you stop it. Cargo resolves solana-client to 4.2.2, the exact version the datasource pins, so both use the same RpcProgramAccountsConfig type. To load every existing account once instead of streaming changes, see load account state.
Instructions#
Variants of JupiterDcaInstruction. Each is JupiterDcaInstruction::, where data and accounts are the types listed under the variant, exported from carbon_. Discriminators are the leading bytes of the instruction data, in hex.
How an instruction decodes. The decoder returns a variant only when all of these hold; otherwise the instruction is skipped and no processor is called:
- The instruction's program ID is
DCA265Vj8a9CEuX1eb1LWRnDT7uK6q1xMipnNyatn23M. - The data starts with the variant's discriminator, and the rest deserializes into its data type.
- The instruction has at least as many accounts as the variant requires (the "Required accounts" count under each variant).
Accounts. They are matched by position, in the order listed. An account marked optional is None only when the instruction ends before it; Anchor programs pass the program ID as a placeholder for an omitted optional account, so check for Some(PROGRAM_ too. Accounts after the listed ones are in accounts. as AccountMetas. The decoder doesn't record whether an account signed or was writable: read that from input. and ., which follow the same order. It doesn't check signer, writable, owner or PDA constraints either; the program enforced those when the transaction executed, so a decoded instruction from a successful transaction already satisfied them.
CloseDca#
Discriminator 16072162a8b722f3 · data CloseDca · accounts CloseDcaInstructionAccounts.
No data fields.
Required accounts: 13; extras go to remaining.
Fields of CloseDcaInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | user | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | in_ata | Pubkey |
| 5 | out_ata | Pubkey |
| 6 | user_in_ata | Pubkey |
| 7 | user_ | Pubkey |
| 8 | system_ | Pubkey |
| 9 | token_ | Pubkey |
| 10 | associated_ | Pubkey |
| 11 | event_ | Pubkey |
| 12 | program | Pubkey |
| 13… | remaining | Vec< |
Deposit#
Discriminator f223c68952e1f2b6 · data Deposit · accounts DepositInstructionAccounts.
| Field | Type |
|---|---|
deposit_in | u64 |
Required accounts: 7; extras go to remaining.
Fields of DepositInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | user | Pubkey |
| 1 | dca | Pubkey |
| 2 | in_ata | Pubkey |
| 3 | user_in_ata | Pubkey |
| 4 | token_ | Pubkey |
| 5 | event_ | Pubkey |
| 6 | program | Pubkey |
| 7… | remaining | Vec< |
EndAndClose#
Discriminator 537da645f7fc6785 · data EndAndClose · accounts EndAndCloseInstructionAccounts.
No data fields.
Required accounts: 15; extras go to remaining.
Fields of EndAndCloseInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | in_ata | Pubkey |
| 5 | out_ata | Pubkey |
| 6 | user | Pubkey |
| 7 | user_ | Option< |
| 8 | init_ | Option< |
| 9 | intermediate_ | Option< |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | associated_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
FulfillDlmmFill#
Discriminator 01e676fb2db165bb · data FulfillDlmmFill · accounts FulfillDlmmFillInstructionAccounts.
| Field | Type |
|---|---|
repay_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of FulfillDlmmFillInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | keeper_ | Pubkey |
| 5 | in_ata | Pubkey |
| 6 | out_ata | Pubkey |
| 7 | fee_ | Pubkey |
| 8 | fee_ata | Pubkey |
| 9 | instructions_ | Pubkey |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | associated_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
FulfillFlashFill#
Discriminator 7340e24e21d369a2 · data FulfillFlashFill · accounts FulfillFlashFillInstructionAccounts.
| Field | Type |
|---|---|
repay_ | u64 |
Required accounts: 15; extras go to remaining.
Fields of FulfillFlashFillInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | keeper_ | Pubkey |
| 5 | in_ata | Pubkey |
| 6 | out_ata | Pubkey |
| 7 | fee_ | Pubkey |
| 8 | fee_ata | Pubkey |
| 9 | instructions_ | Pubkey |
| 10 | system_ | Pubkey |
| 11 | token_ | Pubkey |
| 12 | associated_ | Pubkey |
| 13 | event_ | Pubkey |
| 14 | program | Pubkey |
| 15… | remaining | Vec< |
InitiateDlmmFill#
Discriminator 9bc150795b93febb · data InitiateDlmmFill · accounts InitiateDlmmFillInstructionAccounts.
No data fields.
Required accounts: 10; extras go to remaining.
Fields of InitiateDlmmFillInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | keeper_ | Pubkey |
| 4 | in_ata | Pubkey |
| 5 | out_ata | Pubkey |
| 6 | instructions_ | Pubkey |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10… | remaining | Vec< |
InitiateFlashFill#
Discriminator 8fcd03bfa2d7f531 · data InitiateFlashFill · accounts InitiateFlashFillInstructionAccounts.
No data fields.
Required accounts: 10; extras go to remaining.
Fields of InitiateFlashFillInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | keeper_ | Pubkey |
| 4 | in_ata | Pubkey |
| 5 | out_ata | Pubkey |
| 6 | instructions_ | Pubkey |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10… | remaining | Vec< |
OpenDca#
Discriminator 2441b93601d264a3 · data OpenDca · accounts OpenDcaInstructionAccounts.
| Field | Type |
|---|---|
application_ | u64 |
in_amount | u64 |
in_ | u64 |
cycle_ | i64 |
min_ | Option<u64> |
max_ | Option<u64> |
start_at | Option<i64> |
close_ | Option< |
Required accounts: 12; extras go to remaining.
Fields of OpenDcaInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | dca | Pubkey |
| 1 | user | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | user_ata | Pubkey |
| 5 | in_ata | Pubkey |
| 6 | out_ata | Pubkey |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10 | event_ | Pubkey |
| 11 | program | Pubkey |
| 12… | remaining | Vec< |
OpenDcaV2#
Discriminator 8e772b6da2340bb1 · data OpenDcaV2 · accounts OpenDcaV2InstructionAccounts.
| Field | Type |
|---|---|
application_ | u64 |
in_amount | u64 |
in_ | u64 |
cycle_ | i64 |
min_ | Option<u64> |
max_ | Option<u64> |
start_at | Option<i64> |
Required accounts: 13; extras go to remaining.
Fields of OpenDcaV2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | dca | Pubkey |
| 1 | user | Pubkey |
| 2 | payer | Pubkey |
| 3 | input_mint | Pubkey |
| 4 | output_mint | Pubkey |
| 5 | user_ata | Pubkey |
| 6 | in_ata | Pubkey |
| 7 | out_ata | Pubkey |
| 8 | system_ | Pubkey |
| 9 | token_ | Pubkey |
| 10 | associated_ | Pubkey |
| 11 | event_ | Pubkey |
| 12 | program | Pubkey |
| 13… | remaining | Vec< |
Transfer#
Discriminator a334c8e78c0345ba · data Transfer · accounts TransferInstructionAccounts.
No data fields.
Required accounts: 12; extras go to remaining.
Fields of TransferInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | keeper | Pubkey |
| 1 | dca | Pubkey |
| 2 | user | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | dca_out_ata | Pubkey |
| 5 | user_ | Option< |
| 6 | intermediate_ | Option< |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10 | event_ | Pubkey |
| 11 | program | Pubkey |
| 12… | remaining | Vec< |
Withdraw#
Discriminator b712469c946da122 · data Withdraw · accounts WithdrawInstructionAccounts.
| Field | Type |
|---|---|
withdraw_ | WithdrawParams |
Required accounts: 12; extras go to remaining.
Fields of WithdrawInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | user | Pubkey |
| 1 | dca | Pubkey |
| 2 | input_mint | Pubkey |
| 3 | output_mint | Pubkey |
| 4 | dca_ata | Pubkey |
| 5 | user_in_ata | Option< |
| 6 | user_ | Option< |
| 7 | system_ | Pubkey |
| 8 | token_ | Pubkey |
| 9 | associated_ | Pubkey |
| 10 | event_ | Pubkey |
| 11 | program | Pubkey |
| 12… | remaining | Vec< |
WithdrawFees#
Discriminator c6d4ab6d90d7ae59 · data WithdrawFees · accounts WithdrawFeesInstructionAccounts.
| Field | Type |
|---|---|
amount | u64 |
Required accounts: 8; extras go to remaining.
Fields of WithdrawFeesInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | admin | Pubkey |
| 1 | mint | Pubkey |
| 2 | fee_ | Pubkey |
| 3 | program_ | Pubkey |
| 4 | admin_ | Pubkey |
| 5 | system_ | Pubkey |
| 6 | token_ | Pubkey |
| 7 | associated_ | Pubkey |
| 8… | remaining | Vec< |
CpiEvent#
Anchor self-CPI that carries one of the program's events. data is the CpiEvent enum.
Discriminator e445a52e51cb9a1d · data CpiEvent · accounts CpiEventInstructionAccounts.
Required accounts: 2; extras go to remaining.
Fields of CpiEventInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | program | Pubkey |
| 1 | event_ | Pubkey |
| 2… | remaining | Vec< |
Accounts#
Variants of JupiterDcaAccount. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
Dca#
Discriminator 525d5a7f2865919a · accounts::.
| Field | Type |
|---|---|
user | Pubkey |
input_mint | Pubkey |
output_mint | Pubkey |
idx | u64 |
next_ | i64 |
in_ | u64 |
in_ | u64 |
out_ | u64 |
in_used | u64 |
out_ | u64 |
in_ | u64 |
cycle_ | i64 |
next_ | u64 |
in_account | Pubkey |
out_account | Pubkey |
min_ | u64 |
max_ | u64 |
keeper_ | u64 |
dca_ | u64 |
created_at | i64 |
bump | u8 |
Events#
Variants of instructions::, decoded from the CpiEvent instruction. Each wraps a struct from carbon_. The discriminator is the 8-byte event discriminator that follows the e445a52e51cb9a1d CPI-event tag.
CollectedFee#
Discriminator 2a88d874b5d16db5 · events::.
| Field | Type |
|---|---|
user_key | Pubkey |
dca_key | Pubkey |
mint | Pubkey |
amount | u64 |
Filled#
Discriminator 8604113fdd2db1ad · events::.
| Field | Type |
|---|---|
user_key | Pubkey |
dca_key | Pubkey |
input_mint | Pubkey |
output_mint | Pubkey |
in_amount | u64 |
out_amount | u64 |
fee_mint | Pubkey |
fee | u64 |
Opened#
Discriminator a6ac61094d4cbd6d · events::.
| Field | Type |
|---|---|
user_key | Pubkey |
dca_key | Pubkey |
in_ | u64 |
input_mint | Pubkey |
output_mint | Pubkey |
cycle_ | i64 |
in_ | u64 |
created_at | i64 |
Closed#
Discriminator 321f579b87dcc3ef · events::.
| Field | Type |
|---|---|
user_key | Pubkey |
dca_key | Pubkey |
in_ | u64 |
input_mint | Pubkey |
output_mint | Pubkey |
cycle_ | i64 |
in_ | u64 |
created_at | i64 |
total_ | u64 |
total_ | u64 |
unfilled_ | u64 |
user_closed | bool |
Withdraw#
Discriminator c0f1c9d946965af7 · events::.
| Field | Type |
|---|---|
dca_key | Pubkey |
in_amount | u64 |
out_amount | u64 |
user_ | bool |
Deposit#
Discriminator 3ecdf2aff4a98834 · events::.
| Field | Type |
|---|---|
dca_key | Pubkey |
amount | u64 |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
Closed#
Struct types::. Same fields as the Closed event.
CollectedFee#
Struct types::. Same fields as the CollectedFee event.
Deposit#
Struct types::. Same fields as the Deposit event.
Filled#
Struct types::. Same fields as the Filled event.
Opened#
Struct types::. Same fields as the Opened event.
Withdraw#
Struct types::. Same fields as the Withdraw event.
Withdrawal#
Enum types::.
| Variant |
|---|
In |
Out |
WithdrawParams#
Struct types::.
| Field | Type |
|---|---|
withdraw_ | u64 |
withdrawal | Withdrawal |