This commit is contained in:
2026-07-23 16:37:12 +02:00
parent 99c345f2f2
commit 0da75c1311
2159 changed files with 230833 additions and 0 deletions

34
kb-lib/src/decoder.rs Normal file
View File

@@ -0,0 +1,34 @@
// file: kb-lib/src/decoder.rs
// version: 1
//! Consolidated decoder modules.
pub mod adapter;
pub mod admin;
pub mod amm;
pub mod anchor;
pub mod api;
pub mod bridge;
pub mod clmm;
pub mod cpmm;
pub mod dlmm;
pub mod fees;
pub mod governance;
pub mod launchpad;
pub mod lending;
pub mod lock;
pub mod metadata;
pub mod nft;
pub mod orderbook;
pub mod perpetuals;
pub mod router;
pub mod rwa;
pub mod solana;
pub mod spl;
pub mod stable;
pub mod staking;
pub mod treasury;
pub mod vault;
pub mod vesting;
pub mod wallet;
pub mod weighted;

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/adapter.rs
// version: 1
//! `adapter` decoder family.
pub mod saber_decimal_wrapper;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_adapter_saber_decimal_wrapper`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_adapter_saber_decimal_wrapper";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,7 @@
// file: kb-lib/src/decoder/admin.rs
// version: 1
//! `admin` decoder family.
pub mod jupiter_lock;
pub mod pump_fees;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/admin/jupiter_lock.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_admin_jupiter_lock`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_admin_jupiter_lock";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/admin/pump_fees.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_admin_pump_fees`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_admin_pump_fees";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

31
kb-lib/src/decoder/amm.rs Normal file
View File

@@ -0,0 +1,31 @@
// file: kb-lib/src/decoder/amm.rs
// version: 1
//! `amm` decoder family.
pub mod aldrin_v1;
pub mod aldrin_v2;
pub mod alphaq;
pub mod believe;
pub mod bonk_swap;
pub mod fluxbeam;
pub mod goon_fi;
pub mod goosefx_gamma;
pub mod goosefx_v2;
pub mod guac_swap;
pub mod lifinity_swap_v2;
pub mod metadao_futarchy_amm;
pub mod metadao_v0_5;
pub mod meteora_damm_v1;
pub mod meteora_damm_v2;
pub mod obric_v2;
pub mod one_dex;
pub mod pump_swap;
pub mod raydium_lp_v4;
pub mod solfi;
pub mod solfi_v2;
pub mod vertigo;
pub mod virtuals;
pub mod woofi;
pub mod zero_fi;
pub mod zora;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/aldrin_v1.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_aldrin_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v1";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/aldrin_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_aldrin_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/alphaq.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_alphaq`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_alphaq";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/believe.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_believe`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_believe";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/bonk_swap.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_bonk_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_bonk_swap";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/fluxbeam.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_fluxbeam`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_fluxbeam";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/goon_fi.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_goon_fi`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_goon_fi";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/goosefx_gamma.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_goosefx_gamma`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_gamma";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/goosefx_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_goosefx_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/guac_swap.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_guac_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_guac_swap";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/lifinity_swap_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_lifinity_swap_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_lifinity_swap_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/metadao_futarchy_amm.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_metadao_futarchy_amm`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_futarchy_amm";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/metadao_v0_5.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_metadao_v0_5`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_v0_5";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/meteora_damm_v1.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_meteora_damm_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v1";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/meteora_damm_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_meteora_damm_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/obric_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_obric_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_obric_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/one_dex.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_one_dex`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_one_dex";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/pump_swap.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_pump_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_pump_swap";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/raydium_lp_v4.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_raydium_lp_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_raydium_lp_v4";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/solfi.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_solfi`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_solfi";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/solfi_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_solfi_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_solfi_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/vertigo.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_vertigo`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_vertigo";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/virtuals.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_virtuals`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_virtuals";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/woofi.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_woofi`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_woofi";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/zero_fi.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_zero_fi`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_zero_fi";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/amm/zora.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_amm_zora`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_amm_zora";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/anchor.rs
// version: 1
//! `anchor` decoder family.
pub mod core;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/anchor/core.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_anchor`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_anchor";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

50
kb-lib/src/decoder/api.rs Normal file
View File

@@ -0,0 +1,50 @@
// file: kb-lib/src/decoder/api.rs
// version: 3
//! Decoder contracts consolidated from `kb_decoder_api`.
/// Decoder API constants.
pub mod constants;
pub mod contracts;
pub mod decoder;
/// Canonical tracing target for this crate.
/// Current contextual core instruction input contract version.
pub use crate::decoder::api::contracts::CORE_INSTRUCTION_INPUT_CONTRACT_VERSION;
/// Stable contextual decoded observation.
pub use crate::decoder::api::contracts::DecodedObservation;
/// Machine-readable decoder coverage declaration.
pub use crate::decoder::api::contracts::DecoderCoverageDeclaration;
/// Declared decoder coverage entry kind.
pub use crate::decoder::api::contracts::DecoderCoverageEntryKind;
/// Structured decoder diagnostic.
pub use crate::decoder::api::contracts::DecoderDiagnostic;
/// Complete decoder execution result.
pub use crate::decoder::api::contracts::DecoderExecutionResult;
/// Stable decoder identity.
pub use crate::decoder::api::contracts::DecoderIdentity;
/// Decoder terminal result status.
pub use crate::decoder::api::contracts::DecoderOutcomeStatus;
/// Explicit decoding proof.
pub use crate::decoder::api::contracts::DecoderProof;
/// Decoding proof category.
pub use crate::decoder::api::contracts::DecoderProofKind;
/// Deterministic decoder recognition result.
pub use crate::decoder::api::contracts::DecoderRecognition;
/// One statically declared decoder surface.
pub use crate::decoder::api::contracts::DecoderSurface;
/// Contextual instruction decoder contract.
pub use crate::decoder::api::contracts::InstructionDecoder;
/// Computes the deterministic contextual input hash.
pub use crate::decoder::api::contracts::contextual_input_hash;
/// Returns true when a decoder declares the exact program id.
pub use crate::decoder::api::contracts::decoder_handles_program_id;
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.
pub use crate::decoder::api::contracts::deterministic_json_hash;
/// Extracts the first eight payload bytes as hexadecimal when available.
pub use crate::decoder::api::contracts::discriminator_8_hex;
/// Exposes the decoder support level.
pub use crate::decoder::api::decoder::DecoderSupport;
/// Initial decoder implementation placeholder for API-level tests.
pub use crate::decoder::api::decoder::InitialDecoder;
/// Exposes the common protocol decoder trait.
pub use crate::decoder::api::decoder::ProtocolDecoder;

View File

@@ -0,0 +1,5 @@
// file: kb-lib/src/decoder/api/constants.rs
// version: 1
/// Canonical tracing target for this crate.
pub(crate) const TRACING_TARGET: &str = "kb_decoder_api";

View File

@@ -0,0 +1,576 @@
// file: kb-lib/src/decoder/api/contracts.rs
// version: 7
//! Backend-neutral contextual instruction decoder contracts.
use sha2::Digest; // rust-rules: trait-import
/// Current contextual core instruction input contract version.
pub const CORE_INSTRUCTION_INPUT_CONTRACT_VERSION: u32 = crate::CORE_REPLAY_INPUT_CONTRACT_VERSION;
/// Stable identity of one contextual instruction decoder.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderIdentity {
/// Stable lower snake case processor name.
pub name: std::string::String,
/// Semantic or deterministic implementation version.
pub version: std::string::String,
}
impl DecoderIdentity {
/// Builds a validated decoder identity.
pub fn new(
name: impl std::convert::Into<std::string::String>,
version: impl std::convert::Into<std::string::String>,
) -> kb_core::Result<Self> {
let value = Self {
name: name.into(),
version: version.into(),
};
if value.name.trim().is_empty() || value.version.trim().is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoder identity fields must not be empty",
));
}
return std::result::Result::Ok(value);
}
}
/// One statically declared Solana surface supported by a decoder.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct DecoderSurface {
/// Exact Solana program identifier.
pub program_id: &'static str,
/// Stable surface code.
pub surface_code: &'static str,
/// Explicit dispatch priority, where larger values win.
pub priority: u16,
}
/// Declared decoder coverage entry kind.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum DecoderCoverageEntryKind {
/// Program instruction entry.
Instruction,
/// Program event entry.
Event,
/// Raw discriminator entry.
Discriminator,
}
/// Machine-readable decoder coverage declaration.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderCoverageDeclaration {
/// Solana program identifier.
pub program_id: std::string::String,
/// Optional stable surface code.
pub surface_code: std::option::Option<std::string::String>,
/// Entry kind.
pub entry_kind: DecoderCoverageEntryKind,
/// Stable instruction, event or discriminator code.
pub entry_code: std::string::String,
/// Optional normalized lowercase hexadecimal discriminator.
pub discriminator_hex: std::option::Option<std::string::String>,
/// Whether the entry is historical or deprecated but still supported.
pub historical: bool,
}
impl DecoderCoverageDeclaration {
/// Builds a validated coverage declaration.
pub fn new(
program_id: impl std::convert::Into<std::string::String>,
surface_code: std::option::Option<std::string::String>,
entry_kind: DecoderCoverageEntryKind,
entry_code: impl std::convert::Into<std::string::String>,
discriminator_hex: std::option::Option<std::string::String>,
historical: bool,
) -> kb_core::Result<Self> {
let value = Self {
program_id: program_id.into(),
surface_code,
entry_kind,
entry_code: entry_code.into(),
discriminator_hex,
historical,
};
if value.program_id.trim().is_empty() || value.entry_code.trim().is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoder coverage program id and entry code must not be empty",
));
}
if value
.surface_code
.as_deref()
.is_some_and(|surface| return surface.trim().is_empty())
{
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoder coverage surface code must not be empty when present",
));
}
if value
.discriminator_hex
.as_deref()
.is_some_and(|discriminator| return discriminator.trim().is_empty())
{
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoder coverage discriminator must not be empty when present",
));
}
return std::result::Result::Ok(value);
}
}
/// Deterministic recognition result used by dispatch.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderRecognition {
/// Whether the decoder is compatible with the input.
pub compatible: bool,
/// Whether recognition is exact rather than program-only.
pub exact: bool,
/// Explicit priority used after program and surface matching.
pub priority: u16,
/// Optional recognized surface code.
pub surface_code: std::option::Option<std::string::String>,
/// Optional recognized instruction or discriminator code.
pub entry_code: std::option::Option<std::string::String>,
/// Optional normalized lowercase hexadecimal discriminator.
pub discriminator_hex: std::option::Option<std::string::String>,
}
impl DecoderRecognition {
/// Builds a non-compatible recognition result.
pub fn incompatible() -> Self {
return Self {
compatible: false,
exact: false,
priority: 0,
surface_code: std::option::Option::None,
entry_code: std::option::Option::None,
discriminator_hex: std::option::Option::None,
};
}
/// Builds a compatible recognition result.
pub fn compatible(
exact: bool,
priority: u16,
surface_code: std::option::Option<std::string::String>,
entry_code: std::option::Option<std::string::String>,
discriminator_hex: std::option::Option<std::string::String>,
) -> Self {
return Self {
compatible: true,
exact,
priority,
surface_code,
entry_code,
discriminator_hex,
};
}
}
/// Decoder terminal result status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum DecoderOutcomeStatus {
/// At least one stable decoded observation was produced.
Decoded,
/// The decoder intentionally ignored a recognized input.
Ignored,
/// The input belongs to the program but its entry is unsupported.
Unsupported,
/// Decoding failed and diagnostics were produced.
Failed,
}
/// Proof category attached to one decoded observation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum DecoderProofKind {
/// Exact instruction discriminator match.
ExactDiscriminator,
/// Exact binary layout decode.
ExactLayout,
/// Exact IDL-based decode.
Idl,
/// Manually verified exact decode.
Manual,
/// Correlation with runtime logs.
LogCorrelation,
/// Balance delta evidence.
BalanceDelta,
/// Heuristic evidence that must not be treated as exact.
Heuristic,
/// Audit-only classification.
Audit,
/// Unknown or unclassified evidence.
Unknown,
}
/// Explicit proof attached to one decoded observation.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderProof {
/// Proof category.
pub kind: DecoderProofKind,
/// Decoder confidence.
pub confidence: crate::DecoderConfidence,
/// Stable evidence strings, hashes or classifier codes.
pub evidence: std::vec::Vec<std::string::String>,
}
/// Structured decoder diagnostic without third-party error wrappers.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderDiagnostic {
/// Stable machine-readable diagnostic code.
pub code: std::string::String,
/// Human-readable diagnostic message.
pub message: std::string::String,
/// Whether retrying the same version and input may succeed.
pub retriable: bool,
}
impl DecoderDiagnostic {
/// Builds a validated decoder diagnostic.
pub fn new(
code: impl std::convert::Into<std::string::String>,
message: impl std::convert::Into<std::string::String>,
retriable: bool,
) -> kb_core::Result<Self> {
let value = Self {
code: code.into(),
message: message.into(),
retriable,
};
if value.code.trim().is_empty() || value.message.trim().is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoder diagnostic code and message must not be empty",
));
}
return std::result::Result::Ok(value);
}
}
/// Stable contextual decoded observation persisted by the decode pipeline.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecodedObservation {
/// Stable processor-owned event key within one input.
pub event_key: std::string::String,
/// Shared typed protocol event identity.
pub event: crate::DecodedProtocolEvent,
/// Typed event payload serialized as deterministic JSON.
pub payload_json: serde_json::Value,
/// Whether the source transaction failed on-chain.
pub transaction_failed: bool,
/// Optional transaction error JSON.
pub transaction_error: std::option::Option<serde_json::Value>,
/// Whether the observed state mutation was committed on-chain.
pub observation_committed: bool,
/// Explicit decoding proof.
pub proof: DecoderProof,
}
impl DecodedObservation {
/// Validates failed transaction commit semantics and stable identity fields.
pub fn validate(&self) -> kb_core::Result<()> {
if self.event_key.trim().is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoded observation event key must not be empty",
));
}
if self.transaction_failed && self.observation_committed {
return std::result::Result::Err(kb_core::Error::invalid_state(
"failed transaction observations must not be marked committed",
));
}
if self.event.signature.0.trim().is_empty()
|| self.event.instruction_path.0.trim().is_empty()
|| self.event.program_id.0.trim().is_empty()
|| self.event.event_code.0.trim().is_empty()
{
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoded observation event identity fields must not be empty",
));
}
return std::result::Result::Ok(());
}
}
/// Complete explicit result produced by one decoder invocation.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct DecoderExecutionResult {
/// Terminal decoder status.
pub status: DecoderOutcomeStatus,
/// Optional recognized instruction or discriminator code.
pub recognized_entry_code: std::option::Option<std::string::String>,
/// Decoded observations.
pub observations: std::vec::Vec<DecodedObservation>,
/// Structured diagnostics.
pub diagnostics: std::vec::Vec<DecoderDiagnostic>,
}
impl DecoderExecutionResult {
/// Builds an unsupported result with no false decoded observation.
pub fn unsupported(entry_code: std::option::Option<std::string::String>) -> Self {
return Self {
status: DecoderOutcomeStatus::Unsupported,
recognized_entry_code: entry_code,
observations: std::vec::Vec::new(),
diagnostics: std::vec::Vec::new(),
};
}
/// Builds an ignored result.
pub fn ignored(entry_code: std::option::Option<std::string::String>) -> Self {
return Self {
status: DecoderOutcomeStatus::Ignored,
recognized_entry_code: entry_code,
observations: std::vec::Vec::new(),
diagnostics: std::vec::Vec::new(),
};
}
/// Validates status and observation consistency.
pub fn validate(&self) -> kb_core::Result<()> {
if self.status == DecoderOutcomeStatus::Decoded && self.observations.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoded status requires at least one observation",
));
}
if self.status != DecoderOutcomeStatus::Decoded && !self.observations.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"non-decoded status must not contain observations",
));
}
if self.status == DecoderOutcomeStatus::Failed && self.diagnostics.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"failed decoder status requires at least one diagnostic",
));
}
for observation in &self.observations {
let validation_result = observation.validate();
if let std::result::Result::Err(error) = validation_result {
return std::result::Result::Err(error);
}
}
return std::result::Result::Ok(());
}
}
/// Contextual instruction decoder contract used by the common pipeline.
pub trait InstructionDecoder: std::marker::Send + std::marker::Sync {
/// Returns the stable decoder identity.
fn identity(&self) -> DecoderIdentity;
/// Returns every exact Solana surface supported by the decoder.
fn surfaces(&self) -> &'static [DecoderSurface];
/// Returns the machine-readable declared coverage matrix.
fn coverage(&self) -> std::vec::Vec<DecoderCoverageDeclaration>;
/// Recognizes one contextual core instruction for deterministic dispatch.
fn recognize(&self, input: &crate::CoreInstructionReplayInput) -> DecoderRecognition;
/// Decodes one recognized contextual core instruction.
fn decode(&self, input: &crate::CoreInstructionReplayInput) -> DecoderExecutionResult;
}
/// Returns true when a decoder declares the exact program id.
pub fn decoder_handles_program_id(decoder: &dyn InstructionDecoder, program_id: &str) -> bool {
for surface in decoder.surfaces() {
if surface.program_id == program_id {
return true;
}
}
return false;
}
/// Computes a deterministic lowercase SHA-256 hash for one contextual input.
pub fn contextual_input_hash(
input: &crate::CoreInstructionReplayInput,
) -> kb_core::Result<std::string::String> {
let serialization_result = serde_json::to_value(input);
let mut value = match serialization_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
return std::result::Result::Err(kb_core::Error::json(format!(
"cannot serialize contextual decoder input: {error}"
)));
},
};
return crate::deterministic_json_hash(&mut value);
}
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.
pub fn deterministic_json_hash(
value: &mut serde_json::Value,
) -> kb_core::Result<std::string::String> {
sort_json_value(value);
let bytes_result = serde_json::to_vec(value);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
return std::result::Result::Err(kb_core::Error::json(format!(
"cannot serialize deterministic JSON bytes: {error}"
)));
},
};
let digest = sha2::Sha256::digest(bytes);
let mut output = std::string::String::with_capacity(64);
for byte in digest {
output.push_str(format!("{byte:02x}").as_str());
}
return std::result::Result::Ok(output);
}
/// Extracts the first eight payload bytes as normalized lowercase hexadecimal when available.
pub fn discriminator_8_hex(
input: &crate::CoreInstructionReplayInput,
) -> std::option::Option<std::string::String> {
let payload = match &input.instruction_payload_json {
std::option::Option::Some(value) => value,
std::option::Option::None => return std::option::Option::None,
};
let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) {
std::option::Option::Some(value) => value,
std::option::Option::None => return std::option::Option::None,
};
let decoded_result =
base64::Engine::decode(&base64::engine::general_purpose::STANDARD, encoded.as_bytes());
let decoded = match decoded_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => return std::option::Option::None,
};
if decoded.len() < 8 {
return std::option::Option::None;
}
let mut output = std::string::String::with_capacity(16);
for byte in &decoded[..8] {
output.push_str(format!("{byte:02x}").as_str());
}
return std::option::Option::Some(output);
}
fn sort_json_value(value: &mut serde_json::Value) {
match value {
serde_json::Value::Object(map) => {
let mut entries = std::mem::take(map).into_iter().collect::<std::vec::Vec<_>>();
entries.sort_by(|left, right| return left.0.cmp(&right.0));
for (key, mut child) in entries {
sort_json_value(&mut child);
map.insert(key, child);
}
},
serde_json::Value::Array(values) => {
for child in values {
sort_json_value(child);
}
},
_ => (),
}
}
#[cfg(test)]
mod tests {
fn replay_input() -> crate::CoreInstructionReplayInput {
let result = crate::CoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
"0",
"program",
false,
std::option::Option::None,
serde_json::json!([{"accountIndex": 0, "accountKey": "account"}]),
serde_json::json!([{"accountIndex": 0, "accountKey": "account"}]),
std::option::Option::Some(serde_json::json!({"dataBase64": "AQIDBAUGBwg="})),
std::option::Option::Some("payload-hash".to_string()),
serde_json::json!([{
"instructionIndex": 0,
"instructionPath": "0",
"programId": "program",
"payloadJson": {"dataBase64": "AQIDBAUGBwg="},
"payloadHash": "payload-hash"
}]),
serde_json::json!([]),
serde_json::json!([]),
serde_json::json!([]),
);
return match result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("unexpected replay input error: {error}"),
};
}
#[test]
fn contextual_input_hash_is_stable() {
let first = crate::contextual_input_hash(&replay_input());
let second = crate::contextual_input_hash(&replay_input());
assert!(first.is_ok());
assert_eq!(first, second);
}
#[test]
fn contextual_input_hash_changes_when_outer_context_changes() {
let first = replay_input();
let mut second = replay_input();
second.outer_instructions_json = serde_json::json!([{
"instructionIndex": 0,
"instructionPath": "0",
"programId": "program",
"payloadJson": {"dataBase64": "CAcGBQQDAgE="},
"payloadHash": "different-payload-hash"
}]);
let first_hash = crate::contextual_input_hash(&first);
let second_hash = crate::contextual_input_hash(&second);
assert!(first_hash.is_ok());
assert!(second_hash.is_ok());
assert_ne!(first_hash, second_hash);
}
#[test]
fn contextual_input_serialization_is_deterministic_with_outer_context() {
let first_result = serde_json::to_string(&replay_input());
let first = match first_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("unexpected serialization error: {error}"),
};
let second_result = serde_json::to_string(&replay_input());
let second = match second_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("unexpected serialization error: {error}"),
};
assert_eq!(first, second);
}
#[test]
fn discriminator_uses_first_eight_bytes() {
let value = crate::discriminator_8_hex(&replay_input());
assert_eq!(value.as_deref(), std::option::Option::Some("0102030405060708"));
}
#[test]
fn failed_observation_cannot_be_committed() {
let observation = crate::DecodedObservation {
event_key: "event".to_string(),
event: crate::DecodedProtocolEvent {
signature: crate::Signature("signature".to_string()),
slot: crate::Slot(42),
instruction_path: crate::InstructionPath("0".to_string()),
program_id: crate::ProgramId("program".to_string()),
protocol_code: crate::ProtocolCode("solana".to_string()),
surface_code: crate::SurfaceCode("system_program".to_string()),
event_code: crate::EventCode("system_program.attempt".to_string()),
event_name: crate::EventName("attempt".to_string()),
event_family: crate::EventFamily::Audit,
source_kind: crate::EventSourceKind::Instruction,
confidence: crate::DecoderConfidence::Exact,
},
payload_json: serde_json::json!({}),
transaction_failed: true,
transaction_error: std::option::Option::Some(
serde_json::json!({"InstructionError": [0, "Custom"]}),
),
observation_committed: true,
proof: crate::DecoderProof {
kind: crate::DecoderProofKind::ExactLayout,
confidence: crate::DecoderConfidence::Exact,
evidence: std::vec!["layout".to_string()],
},
};
assert!(observation.validate().is_err());
}
}

View File

@@ -0,0 +1,74 @@
// file: kb-lib/src/decoder/api/decoder.rs
// version: 4
//! Shared decoder contracts for protocol decoder crates.
/// Decoder support level for a program observation.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DecoderSupport {
/// The decoder does not support the observation.
No,
/// The decoder may support the observation after deeper inspection.
Maybe,
/// The decoder explicitly supports the observation.
Yes,
}
/// Common trait implemented by every protocol decoder crate.
pub trait ProtocolDecoder {
/// Returns the stable decoder name.
fn decoder_name(&self) -> &'static str;
/// Returns the decoder implementation version.
fn decoder_version(&self) -> &'static str;
/// Returns the Solana program ids handled by this decoder.
fn program_ids(&self) -> &'static [&'static str];
/// Checks whether the decoder handles a program id.
fn handles_program_id(&self, program_id: &crate::ProgramId) -> bool {
for candidate in self.program_ids() {
if program_id.0.as_str() == *candidate {
return true;
}
}
return false;
}
/// Checks whether the decoder supports a generic program observation.
fn supports_observation(&self, observation: &crate::ProgramObservation) -> DecoderSupport;
/// Decodes a generic program observation into protocol events.
fn decode_observation(
&self,
observation: &crate::ProgramObservation,
) -> kb_core::Result<std::vec::Vec<crate::DecodedProtocolEvent>>;
}
/// Initial decoder implementation placeholder for API-level tests.
#[derive(Clone, Debug, Default)]
pub struct InitialDecoder;
impl ProtocolDecoder for InitialDecoder {
fn decoder_name(&self) -> &'static str {
return "kb_decoder_api";
}
fn decoder_version(&self) -> &'static str {
return env!("CARGO_PKG_VERSION");
}
fn program_ids(&self) -> &'static [&'static str] {
return &[];
}
fn supports_observation(&self, observation: &crate::ProgramObservation) -> DecoderSupport {
if ProtocolDecoder::handles_program_id(self, &observation.program_id) {
return DecoderSupport::Maybe;
}
return DecoderSupport::No;
}
fn decode_observation(
&self,
_observation: &crate::ProgramObservation,
) -> kb_core::Result<std::vec::Vec<crate::DecodedProtocolEvent>> {
let _target = crate::TRACING_TARGET;
return std::result::Result::Ok(std::vec::Vec::new());
}
}

View File

@@ -0,0 +1,9 @@
// file: kb-lib/src/decoder/bridge.rs
// version: 1
//! `bridge` decoder family.
pub mod circle_cctp_token_messenger_minter;
pub mod circle_cctp_token_messenger_minter_v2;
pub mod layer_zero_endpoint;
pub mod layer_zero_executor;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_bridge_circle_cctp_token_messenger_minter`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_bridge_circle_cctp_token_messenger_minter_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/bridge/layer_zero_endpoint.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_bridge_layer_zero_endpoint`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_endpoint";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/bridge/layer_zero_executor.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_bridge_layer_zero_executor`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_executor";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,11 @@
// file: kb-lib/src/decoder/clmm.rs
// version: 1
//! `clmm` decoder family.
pub mod byreal;
pub mod fusion;
pub mod orca_whirlpool;
pub mod pancake_swap;
pub mod raydium;
pub mod stabble;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/byreal.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_byreal`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_byreal";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/fusion.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_fusion`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_fusion";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/orca_whirlpool.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_orca_whirlpool`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_orca_whirlpool";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/pancake_swap.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_pancake_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_pancake_swap";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/raydium.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_raydium`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_raydium";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/clmm/stabble.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_clmm_stabble`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_clmm_stabble";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/cpmm.rs
// version: 1
//! `cpmm` decoder family.
pub mod raydium;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/cpmm/raydium.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_cpmm_raydium`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_cpmm_raydium";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/dlmm.rs
// version: 1
//! `dlmm` decoder family.
pub mod meteora;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/dlmm/meteora.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_dlmm_meteora`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_dlmm_meteora";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,7 @@
// file: kb-lib/src/decoder/fees.rs
// version: 1
//! `fees` decoder family.
pub mod bags_fee_share_v1;
pub mod bags_fee_share_v2;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/fees/bags_fee_share_v1.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_fees_bags_fee_share_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v1";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/fees/bags_fee_share_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_fees_bags_fee_share_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/governance.rs
// version: 1
//! `governance` decoder family.
pub mod metadao_bid_wall;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/governance/metadao_bid_wall.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_governance_metadao_bid_wall`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_governance_metadao_bid_wall";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,14 @@
// file: kb-lib/src/decoder/launchpad.rs
// version: 1
//! `launchpad` decoder family.
pub mod boop_fun;
pub mod metadao_ico;
pub mod meteora_dbc;
pub mod moonit;
pub mod orca_wavebreak;
pub mod printr;
pub mod pump_fun;
pub mod pump_pumpup_ai;
pub mod raydium_launchlab;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/boop_fun.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_boop_fun`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_boop_fun";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/metadao_ico.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_metadao_ico`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_metadao_ico";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/meteora_dbc.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_meteora_dbc`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_meteora_dbc";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/moonit.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_moonit`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_moonit";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/orca_wavebreak.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_orca_wavebreak`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_orca_wavebreak";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/printr.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_printr`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_printr";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/pump_fun.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_pump_fun`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_fun";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_pump_pumpup_ai`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_pumpup_ai";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/launchpad/raydium_launchlab.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_launchpad_raydium_launchlab`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_raydium_launchlab";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,12 @@
// file: kb-lib/src/decoder/lending.rs
// version: 1
//! `lending` decoder family.
pub mod clone;
pub mod jupiter_lend_borrow;
pub mod jupiter_lend_earn;
pub mod jupiter_lend_flash_loan;
pub mod jupiter_lend_liquidity;
pub mod kamino;
pub mod marginfi_v2;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/clone.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_clone`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_clone";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/jupiter_lend_borrow.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_borrow`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_borrow";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/jupiter_lend_earn.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_earn`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_earn";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_flash_loan`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_flash_loan";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_liquidity`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_liquidity";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/kamino.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_kamino`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_kamino";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lending/marginfi_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lending_marginfi_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lending_marginfi_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/lock.rs
// version: 1
//! `lock` decoder family.
pub mod raydium_lp;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/lock/raydium_lp.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_lock_raydium_lp`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_lock_raydium_lp";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,7 @@
// file: kb-lib/src/decoder/metadata.rs
// version: 1
//! `metadata` decoder family.
pub mod metaplex_token_metadata;
pub mod spl_name_service;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/metadata/metaplex_token_metadata.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_metadata_metaplex_token_metadata`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_metadata_metaplex_token_metadata";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/metadata/spl_name_service.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_metadata_spl_name_service`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_metadata_spl_name_service";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,6 @@
// file: kb-lib/src/decoder/nft.rs
// version: 1
//! `nft` decoder family.
pub mod metaplex_bubblegum;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/nft/metaplex_bubblegum.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_nft_metaplex_bubblegum`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_nft_metaplex_bubblegum";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,8 @@
// file: kb-lib/src/decoder/orderbook.rs
// version: 1
//! `orderbook` decoder family.
pub mod jupiter_limit_order;
pub mod jupiter_limit_order_v2;
pub mod openbook_v2;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/orderbook/jupiter_limit_order.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_orderbook_jupiter_limit_order`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_orderbook_jupiter_limit_order_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/orderbook/openbook_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_orderbook_openbook_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_openbook_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,8 @@
// file: kb-lib/src/decoder/perpetuals.rs
// version: 1
//! `perpetuals` decoder family.
pub mod drift_v2;
pub mod jupiter;
pub mod zeta;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/perpetuals/drift_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_perpetuals_drift_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_drift_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/perpetuals/jupiter.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_perpetuals_jupiter`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_jupiter";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/perpetuals/zeta.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_perpetuals_zeta`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_zeta";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,11 @@
// file: kb-lib/src/decoder/router.rs
// version: 1
//! `router` decoder family.
pub mod dflow_aggregator_v4;
pub mod jupiter_aggregator_v4;
pub mod jupiter_aggregator_v6;
pub mod jupiter_dca;
pub mod okx_labs_v1;
pub mod okx_labs_v2;

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/dflow_aggregator_v4.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_dflow_aggregator_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_dflow_aggregator_v4";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/jupiter_aggregator_v4.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_aggregator_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v4";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/jupiter_aggregator_v6.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_aggregator_v6`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v6";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/jupiter_dca.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_dca`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_dca";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/okx_labs_v1.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_okx_labs_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v1";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

View File

@@ -0,0 +1,10 @@
// file: kb-lib/src/decoder/router/okx_labs_v2.rs
// version: 1
//! Migration boundary for legacy crate `kb_decoder_router_okx_labs_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
pub const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v2";
/// Current porting status.
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";

Some files were not shown because too many files have changed in this diff Show More