OnChain Labs DEX v2 decoder
Decode OnChain Labs DEX v2 instructions, accounts and events in Rust with the carbon-onchain-labs-dex-v2-decoder crate.
On this page
carbon-onchain-labs-dex-v2-decoder decodes the instructions, accounts and events of the OnChain Labs DEX v2 program (proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u): 19 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-onchain-labs-dex-v2-decoder 2.0.0 |
| Install | cargo add carbon-onchain-labs-dex-v2-decoder@2. |
| Program ID | proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u (carbon_) |
| Category | Aggregators & routing |
| Decoder | carbon_ |
| Instruction enum | instructions:: |
| Account enum | accounts:: |
| Event enum | instructions:: |
| Features | serde, postgres, graphql (none enabled by default) |
| API docs | docs.rs/carbon-onchain-labs-dex-v2-decoder/2.0.0 |
| Source | decoders/onchain-labs-dex-v2-decoder |
Other aggregator and routing decoders: DFlow Aggregator v4, Jupiter Swap, OKX DEX. To decode several in one pipeline, see aggregator and routing 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 OnChain Labs DEX v2 transactions from the public RPC and prints every decoded Swap instruction. Add the dependencies:
cargo add carbon-core@2.0.0 carbon-onchain-labs-dex-v2-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_onchain_labs_dex_v2_decoder::{
instructions::OnchainLabsDexV2Instruction, OnchainLabsDexV2Decoder, 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(OnchainLabsDexV2Decoder, InstructionLogger)
.build()?
.run()
.await
}
struct InstructionLogger;
impl Processor<InstructionProcessorInputType<'_, OnchainLabsDexV2Instruction>> for InstructionLogger {
async fn process(
&mut self,
input: &InstructionProcessorInputType<'_, OnchainLabsDexV2Instruction>,
) -> CarbonResult<()> {
let signature = input.metadata.transaction_metadata.signature;
if let OnchainLabsDexV2Instruction::Swap { data, accounts, .. } = input.decoded_instruction {
println!("swap {signature}: {data:?} payer={}", accounts.payer);
}
Ok(())
}
}RUST_LOG=info cargo runEach Swap instruction prints one line with the transaction signature and the decoded Swap 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 OnchainLabsDexV2Instruction:: (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 TokenLedger 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_onchain_labs_dex_v2_decoder::{
accounts::OnchainLabsDexV2Account, OnchainLabsDexV2Decoder, 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(OnchainLabsDexV2Decoder, AccountLogger)
.build()?
.run()
.await
}
struct AccountLogger;
impl Processor<AccountProcessorInputType<'_, OnchainLabsDexV2Account>> for AccountLogger {
async fn process(
&mut self,
input: &AccountProcessorInputType<'_, OnchainLabsDexV2Account>,
) -> CarbonResult<()> {
let OnchainLabsDexV2Account::TokenLedger(token_ledger) = &input.decoded_account.data;
println!("token_ledger {}: {token_ledger:?}", input.metadata.pubkey);
Ok(())
}
}RUST_LOG=info cargo runEach update to a TokenLedger 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 OnchainLabsDexV2Instruction. Each is OnchainLabsDexV2Instruction::, 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
proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u. - 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.
Claim#
Discriminator 3ec6d6c1d59f6cd2 · data Claim · accounts ClaimInstructionAccounts.
No data fields.
Required accounts: 8 (9 listed); extras go to remaining.
Fields of ClaimInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | signer | Pubkey |
| 1 | receiver | Pubkey |
| 2 | source_ | Option< |
| 3 | destination_ | Option< |
| 4 | sa_ | Pubkey |
| 5 | token_mint | Option< |
| 6 | token_ | Option< |
| 7 | system_ | Pubkey |
| 8 | associated_ | Option< |
| 9… | remaining | Vec< |
ClaimCashbackPumpfun#
Discriminator 5301f57dc9cfd1f9 · data ClaimCashbackPumpfun · accounts ClaimCashbackPumpfunInstructionAccounts.
No data fields.
Required accounts: 7; extras go to remaining.
Fields of ClaimCashbackPumpfunInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | signer | Pubkey |
| 1 | sa_ | Pubkey |
| 2 | user_ | Pubkey |
| 3 | receiver | Pubkey |
| 4 | event_ | Pubkey |
| 5 | system_ | Pubkey |
| 6 | pumpfun_ | Pubkey |
| 7… | remaining | Vec< |
ClaimCashbackPumpswap#
Discriminator fdf2b0add94e6419 · data ClaimCashbackPumpswap · accounts ClaimCashbackPumpswapInstructionAccounts.
No data fields.
Required accounts: 11; extras go to remaining.
Fields of ClaimCashbackPumpswapInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | signer | Pubkey |
| 1 | sa_ | Pubkey |
| 2 | user_ | Pubkey |
| 3 | wsol_mint | Pubkey |
| 4 | spl_ | Pubkey |
| 5 | uva_ | Pubkey |
| 6 | sa_wsol_ata | Pubkey |
| 7 | receiver_ | Pubkey |
| 8 | system_ | Pubkey |
| 9 | event_ | Pubkey |
| 10 | pumpswap_ | Pubkey |
| 11… | remaining | Vec< |
CreateTokenAccount#
Discriminator 93f17b64f484ae76 · data CreateTokenAccount · accounts CreateTokenAccountInstructionAccounts.
| Field | Type |
|---|---|
bump | u8 |
Required accounts: 6; extras go to remaining.
Fields of CreateTokenAccountInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | owner | Pubkey |
| 2 | token_ | Pubkey |
| 3 | token_mint | Pubkey |
| 4 | token_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
CreateTokenAccountWithSeed#
Discriminator 7dbfef8c420809e4 · data CreateTokenAccountWithSeed · accounts CreateTokenAccountWithSeedInstructionAccounts.
| Field | Type |
|---|---|
bump | u8 |
seed | u32 |
Required accounts: 6; extras go to remaining.
Fields of CreateTokenAccountWithSeedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | owner | Pubkey |
| 2 | token_ | Pubkey |
| 3 | token_mint | Pubkey |
| 4 | token_ | Pubkey |
| 5 | system_ | Pubkey |
| 6… | remaining | Vec< |
InitTokenLedger#
Discriminator 9d74423b89b4319d · data InitTokenLedger · accounts InitTokenLedgerInstructionAccounts.
| Field | Type |
|---|---|
index | u8 |
Required accounts: 3; extras go to remaining.
Fields of InitTokenLedgerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | token_ | Pubkey |
| 2 | system_ | Pubkey |
| 3… | remaining | Vec< |
ProxySwap#
Discriminator 132c829448382cee · data ProxySwap · accounts ProxySwapInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
Required accounts: 14; extras go to remaining.
Fields of ProxySwapInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | sa_ | Option< |
| 6 | source_ | Option< |
| 7 | destination_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | associated_ | Option< |
| 11 | system_ | Option< |
| 12 | event_ | Pubkey |
| 13 | program | Pubkey |
| 14… | remaining | Vec< |
SetTokenLedger#
Discriminator e455b9704e4f4d02 · data SetTokenLedger · accounts SetTokenLedgerInstructionAccounts.
No data fields.
Required accounts: 2; extras go to remaining.
Fields of SetTokenLedgerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | token_ | Pubkey |
| 1 | token_ | Pubkey |
| 2… | remaining | Vec< |
Swap#
Discriminator f8c69e91e17587c8 · data Swap · accounts SwapInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
Required accounts: 7; extras go to remaining.
Fields of SwapInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | event_ | Pubkey |
| 6 | program | Pubkey |
| 7… | remaining | Vec< |
SwapTob#
Discriminator aa2955b184501f35 · data SwapTob · accounts SwapTobInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
commission_ | u32 |
platform_ | u16 |
trim_rate | u8 |
Required accounts: 16; extras go to remaining.
Fields of SwapTobInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | event_ | Pubkey |
| 15 | program | Pubkey |
| 16… | remaining | Vec< |
SwapTobEnhanced#
Discriminator be9ca9b0959aa16c · data SwapTobEnhanced · accounts SwapTobEnhancedInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
commission_ | u32 |
platform_ | u16 |
trim_rate | u8 |
charge_rate | u16 |
Required accounts: 16; extras go to remaining.
Fields of SwapTobEnhancedInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | event_ | Pubkey |
| 15 | program | Pubkey |
| 16… | remaining | Vec< |
SwapTobV2#
From the program's IDL:
Used to support commission distribution between parent and child nodes in
TOB business
Discriminator 4801d7f2084b36d8 · data SwapTobV2 · accounts SwapTobV2InstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
total_ | u32 |
parent_ | u32 |
platform_ | u16 |
trim_rate | u8 |
Required accounts: 17; extras go to remaining.
Fields of SwapTobV2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | parent_ | Pubkey |
| 6 | child_ | Pubkey |
| 7 | platform_ | Option< |
| 8 | sa_ | Option< |
| 9 | source_ | Option< |
| 10 | destination_ | Option< |
| 11 | source_ | Option< |
| 12 | destination_ | Option< |
| 13 | associated_ | Option< |
| 14 | system_ | Option< |
| 15 | event_ | Pubkey |
| 16 | program | Pubkey |
| 17… | remaining | Vec< |
SwapTobWithReceiver#
Discriminator dfaad8eacc06f119 · data SwapTobWithReceiver · accounts SwapTobWithReceiverInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
commission_ | u32 |
platform_ | u16 |
trim_rate | u8 |
Required accounts: 17; extras go to remaining.
Fields of SwapTobWithReceiverInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | sol_ | Option< |
| 15 | event_ | Pubkey |
| 16 | program | Pubkey |
| 17… | remaining | Vec< |
SwapTobWithReceiverTokenLedger#
Discriminator ef5d0acaa1867f82 · data SwapTobWithReceiverTokenLedger · accounts SwapTobWithReceiverTokenLedgerInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgsTokenLedger |
commission_ | u32 |
platform_ | u16 |
trim_rate | u8 |
Required accounts: 18; extras go to remaining.
Fields of SwapTobWithReceiverTokenLedgerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | sol_ | Option< |
| 15 | token_ | Pubkey |
| 16 | event_ | Pubkey |
| 17 | program | Pubkey |
| 18… | remaining | Vec< |
SwapTobWithTokenLedger#
Discriminator 245c93db1ab09f5a · data SwapTobWithTokenLedger · accounts SwapTobWithTokenLedgerInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgsTokenLedger |
commission_ | u32 |
platform_ | u16 |
trim_rate | u8 |
Required accounts: 17; extras go to remaining.
Fields of SwapTobWithTokenLedgerInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | token_ | Pubkey |
| 15 | event_ | Pubkey |
| 16 | program | Pubkey |
| 17… | remaining | Vec< |
SwapToc#
Discriminator bbc9d433109bec3c · data SwapToc · accounts SwapTocInstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
commission_ | u32 |
platform_ | u16 |
Required accounts: 16; extras go to remaining.
Fields of SwapTocInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | commission_ | Option< |
| 6 | platform_ | Option< |
| 7 | sa_ | Option< |
| 8 | source_ | Option< |
| 9 | destination_ | Option< |
| 10 | source_ | Option< |
| 11 | destination_ | Option< |
| 12 | associated_ | Option< |
| 13 | system_ | Option< |
| 14 | event_ | Pubkey |
| 15 | program | Pubkey |
| 16… | remaining | Vec< |
SwapTocV2#
From the program's IDL:
Used to support commission distribution between parent and child nodes in
TOC business
Discriminator 7fd66bbd175a2f68 · data SwapTocV2 · accounts SwapTocV2InstructionAccounts.
| Field | Type |
|---|---|
args | SwapArgs |
total_ | u32 |
parent_ | u32 |
platform_ | u16 |
Required accounts: 17; extras go to remaining.
Fields of SwapTocV2InstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | source_ | Pubkey |
| 2 | destination_ | Pubkey |
| 3 | source_mint | Pubkey |
| 4 | destination_ | Pubkey |
| 5 | parent_ | Pubkey |
| 6 | child_ | Pubkey |
| 7 | platform_ | Option< |
| 8 | sa_ | Option< |
| 9 | source_ | Option< |
| 10 | destination_ | Option< |
| 11 | source_ | Option< |
| 12 | destination_ | Option< |
| 13 | associated_ | Option< |
| 14 | system_ | Option< |
| 15 | event_ | Pubkey |
| 16 | program | Pubkey |
| 17… | remaining | Vec< |
WrapUnwrap#
Discriminator dc658bf929be76c7 · data WrapUnwrap · accounts WrapUnwrapInstructionAccounts.
| Field | Type |
|---|---|
args | PlatformFeeWrapUnwrapArgs |
Required accounts: 12; extras go to remaining.
Fields of WrapUnwrapInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | payer_ | Pubkey |
| 2 | wsol_mint | Pubkey |
| 3 | temp_ | Option< |
| 4 | commission_ | Option< |
| 5 | platform_ | Option< |
| 6 | authority_ | Option< |
| 7 | wsol_sa | Option< |
| 8 | token_ | Pubkey |
| 9 | system_ | Pubkey |
| 10 | event_ | Pubkey |
| 11 | program | Pubkey |
| 12… | remaining | Vec< |
WrapUnwrapWithReceiver#
From the program's IDL:
Wrap/Unwrap with optional specified receiver
- Wrap (SOL -> WSOL): receiver is WSOL token account (ATA)
- Unwrap (WSOL -> SOL): receiver is system account (EOA)
Transfer amount:
- From fee: amount_in
- To fee: amount_in - fees
Discriminator 7b192f86e9a7abaa · data WrapUnwrapWithReceiver · accounts WrapUnwrapWithReceiverInstructionAccounts.
| Field | Type |
|---|---|
args | PlatformFeeWrapUnwrapArgs |
Required accounts: 13; extras go to remaining.
Fields of WrapUnwrapWithReceiverInstructionAccounts, in account order:
| # | Field | Type |
|---|---|---|
| 0 | payer | Pubkey |
| 1 | payer_ | Pubkey |
| 2 | wsol_mint | Pubkey |
| 3 | temp_ | Option< |
| 4 | commission_ | Option< |
| 5 | platform_ | Option< |
| 6 | authority_ | Option< |
| 7 | wsol_sa | Option< |
| 8 | token_ | Pubkey |
| 9 | system_ | Pubkey |
| 10 | receiver | Pubkey |
| 11 | event_ | Pubkey |
| 12 | program | Pubkey |
| 13… | 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 OnchainLabsDexV2Account. Each wraps a boxed struct from carbon_. decode_ only considers accounts owned by PROGRAM_ID and returns the first variant that matches.
TokenLedger#
Discriminator 9cf709bc366c554d · accounts::.
| Field | Type |
|---|---|
token_ | Pubkey |
amount | u64 |
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.
SwapCpiEvent2#
Discriminator 155ee035dce8c15e · events::.
| Field | Type |
|---|---|
order_id | u64 |
source_mint | Pubkey |
destination_ | Pubkey |
source_ | Pubkey |
destination_ | Pubkey |
amount_in | u64 |
source_ | u64 |
destination_ | u64 |
SwapEvent#
Discriminator 40c6cde8260871e2 · events::.
| Field | Type |
|---|---|
dex | Dex |
amount_in | u64 |
amount_out | u64 |
SwapTobV2CpiEvent2#
Discriminator f469b85a3ca52421 · events::.
| Field | Type |
|---|---|
order_id | u64 |
source_mint | Pubkey |
destination_ | Pubkey |
source_ | Pubkey |
destination_ | Pubkey |
amount_in | u64 |
source_ | u64 |
destination_ | u64 |
commission_ | bool |
total_ | u32 |
parent_ | u32 |
parent_ | u64 |
parent_ | Pubkey |
child_ | u32 |
child_ | u64 |
child_ | Pubkey |
platform_ | u16 |
platform_ | u64 |
platform_ | Pubkey |
trim_rate | u8 |
trim_amount | u64 |
trim_ | Pubkey |
SwapTocV2CpiEvent2#
Discriminator 6610b53ec947d429 · events::.
| Field | Type |
|---|---|
order_id | u64 |
source_mint | Pubkey |
destination_ | Pubkey |
source_ | Pubkey |
destination_ | Pubkey |
amount_in | u64 |
source_ | u64 |
destination_ | u64 |
commission_ | bool |
total_ | u32 |
parent_ | u32 |
parent_ | u64 |
parent_ | Pubkey |
child_ | u32 |
child_ | u64 |
child_ | Pubkey |
platform_ | u16 |
platform_ | u64 |
platform_ | Pubkey |
SwapWithFeesCpiEvent2#
Discriminator 0c86265da7972a45 · events::.
| Field | Type |
|---|---|
order_id | u64 |
source_mint | Pubkey |
destination_ | Pubkey |
source_ | Pubkey |
destination_ | Pubkey |
amount_in | u64 |
source_ | u64 |
destination_ | u64 |
commission_ | bool |
commission_ | u32 |
commission_ | u64 |
commission_ | Pubkey |
platform_ | u16 |
platform_ | u64 |
platform_ | Pubkey |
trim_rate | u8 |
trim_amount | u64 |
trim_ | Pubkey |
SwapWithFeesCpiEventEnhanced2#
Discriminator 544fdbf7da9cdbb1 · events::.
| Field | Type |
|---|---|
order_id | u64 |
source_mint | Pubkey |
destination_ | Pubkey |
source_ | Pubkey |
destination_ | Pubkey |
amount_in | u64 |
source_ | u64 |
destination_ | u64 |
commission_ | bool |
commission_ | u32 |
commission_ | u64 |
commission_ | Pubkey |
platform_ | u16 |
platform_ | u64 |
platform_ | Pubkey |
trim_rate | u8 |
trim_amount | u64 |
trim_ | Pubkey |
charge_rate | u16 |
charge_ | u64 |
charge_ | Pubkey |
Types#
Types used by the instructions, accounts and events above, exported from carbon_.
Dex#
Enum types::Dex.
| Variant | Fields |
|---|---|
SplTokenSwap | |
StableSwap | |
Whirlpool | |
MeteoraDynamicpool | |
RaydiumSwap | |
RaydiumStableSwap | |
RaydiumClmmSwap | |
AldrinExchangeV1 | |
AldrinExchangeV2 | |
LifinityV1 | |
LifinityV2 | |
RaydiumClmmSwapV2 | |
FluxBeam | |
MeteoraDlmm | |
RaydiumCpmmSwap | |
OpenBookV2 | |
WhirlpoolV2 | |
Phoenix | |
ObricV2 | |
SanctumAddLiq | |
SanctumRemoveLiq | |
SanctumNonWsolSwap | |
SanctumWsolSwap | |
PumpfunBuy | |
PumpfunSell | |
StabbleSwap | |
SanctumRouter | |
MeteoraVaultDeposit | |
MeteoraVaultWithdraw | |
Saros | |
MeteoraLst | |
Solfi | |
QualiaSwap | |
Zerofi | |
PumpfunammBuy | |
PumpfunammSell | |
Virtuals | |
VertigoBuy | |
VertigoSell | |
PerpetualsAddLiq | |
PerpetualsRemoveLiq | |
PerpetualsSwap | |
RaydiumLaunchpad | |
LetsBonkFun | |
Woofi | |
MeteoraDbc | |
MeteoraDlmmSwap2 | |
MeteoraDAMMV2 | |
Gavel | |
BoopfunBuy | |
BoopfunSell | |
MeteoraDbc2 | |
GooseFX | |
Dooar | |
Numeraire | |
SaberDecimalWrapperDeposit | |
SaberDecimalWrapperWithdraw | |
SarosDlmm | |
OneDexSwap | |
Manifest | |
ByrealClmm | |
PancakeSwapV3Swap | |
PancakeSwapV3SwapV2 | |
Tessera | |
SolRfq | rfq_id: u64, expected_: u64, expected_: u64, maker_: u64, taker_: u64, expiry: u64, maker_: bool, taker_: bool |
Humidifi | |
HeavenBuy | |
HeavenSell | |
SolfiV2 | |
Goonfi | |
MoonitBuy | |
MoonitSell | |
RaydiumSwapV2 | |
Whalestreet | |
SugarMoneyBuy | bonding_: u8, bonding_: u8 |
SugarMoneySell | bonding_: u8, bonding_: u8 |
MeteoraDAMMV2Swap2 | |
AlphaQ | |
FutarchyAmm | |
PumpfunBuy2 | |
PumpfunSell2 | |
HumidifiSwap2 | swap_id: u64 |
Scorch | id: u128 |
JupiterLendDeposit | |
JupiterLendRedeem | |
TaurusFi | |
BisonFi | |
GoonfiV2 | |
Quantum | |
BoopfunBuy2 | |
BoopfunSell2 | |
ByrealClmm2 | |
Dooar2 | |
HeavenBuy2 | |
HeavenSell2 | |
MoonitBuy2 | |
MoonitSell2 | |
SaberDecimalWrapperDeposit2 | |
SaberDecimalWrapperWithdraw2 | |
ByrealPropAmm | |
SanctumPrefundSwapViaStake | swap_id: u64 |
AbyssAmm | |
Aquifer | |
WhalestreetV2 | auth_: u64, auth: u64 |
SolfiV2WithSig | unix_: u64, msg_: u64, expect_: u64, slippage: u16, user_: u64, signature: [u8; 64], recovery_id: u8 |
FusionAmm | |
ScaleAmmBuy | |
ScaleAmmSell | |
ScaleVmmBuy | |
ScaleVmmSell | |
PumpfunBuy3 | |
PumpfunSell3 | |
PumpfunammBuy2 | |
PumpfunammSell2 | |
Riptide | |
ZerofiSwapV2 | |
TaurusFiV2 |
PlatformFeeWrapUnwrapArgs#
Struct types::.
| Field | Type |
|---|---|
order_id | u64 |
amount_in | u64 |
commission_ | u32 |
platform_ | u16 |
tob | bool |
Route#
Struct types::.
| Field | Type |
|---|---|
dex | Dex |
weight | u16 |
index | u8 |
SwapArgs#
Struct types::.
| Field | Type |
|---|---|
order_id | u64 |
amount_in | u64 |
expect_ | u64 |
slippage | u16 |
routes | Vec<Route> |
SwapArgsTokenLedger#
From the program's IDL:
Swap args for token-ledger swaps: no
amount_inparameter.
amount_inis derived on-chain fromtoken_delta.ledger
Struct types::.
| Field | Type |
|---|---|
order_id | u64 |
expect_ | u64 |
slippage | u16 |
routes | Vec<Route> |
SwapCpiEvent2#
Struct types::. Same fields as the SwapCpiEvent2 event.
SwapEvent#
Struct types::. Same fields as the SwapEvent event.
SwapTobV2CpiEvent2#
Struct types::. Same fields as the SwapTobV2CpiEvent2 event.
SwapTocV2CpiEvent2#
Struct types::. Same fields as the SwapTocV2CpiEvent2 event.
SwapWithFeesCpiEvent2#
Struct types::. Same fields as the SwapWithFeesCpiEvent2 event.
SwapWithFeesCpiEventEnhanced2#
Struct types::. Same fields as the SwapWithFeesCpiEventEnhanced2 event.