0.7.43-E5C
This commit is contained in:
@@ -431,6 +431,16 @@ pub(crate) struct Demo3OnchainDexDiscoveryRequest {
|
||||
pub dex_code: std::option::Option<std::string::String>,
|
||||
/// Optional Solana program id. When absent, dex_code must resolve to a verified program id.
|
||||
pub program_id: std::option::Option<std::string::String>,
|
||||
/// Optional signature source: `program_id` or `address`.
|
||||
pub signature_source: std::option::Option<std::string::String>,
|
||||
/// Optional source address used when signature_source is `address`.
|
||||
pub source_address: std::option::Option<std::string::String>,
|
||||
/// Optional target event family used to find non-swap signatures.
|
||||
pub target_event: std::option::Option<std::string::String>,
|
||||
/// Whether transactions containing swap-like logs should be skipped.
|
||||
pub exclude_swaps: bool,
|
||||
/// Whether failed transactions should be returned as candidates.
|
||||
pub include_failed: bool,
|
||||
/// HTTP role used to query Solana RPC.
|
||||
pub http_role: std::string::String,
|
||||
/// Maximum number of signatures to inspect.
|
||||
@@ -463,8 +473,19 @@ pub(crate) struct Demo3OnchainDexDiscoveryResult {
|
||||
pub request: Demo3OnchainDexDiscoveryRequest,
|
||||
/// DEX code resolved from the support matrix when available.
|
||||
pub resolved_dex_code: std::option::Option<std::string::String>,
|
||||
/// Program id scanned with getSignaturesForAddress.
|
||||
/// Program id used to filter matched instructions.
|
||||
pub resolved_program_id: std::string::String,
|
||||
/// Signature source actually used by getSignaturesForAddress.
|
||||
pub resolved_signature_source: std::string::String,
|
||||
/// Address scanned with getSignaturesForAddress.
|
||||
pub resolved_signature_address: std::string::String,
|
||||
/// Number of unique candidate signatures.
|
||||
#[ts(type = "number")]
|
||||
pub unique_signature_count: usize,
|
||||
/// Unique signatures ready for signature backfill.
|
||||
pub unique_backfill_signatures: std::vec::Vec<std::string::String>,
|
||||
/// Rejected candidate summary.
|
||||
pub rejected_candidate_summary: std::vec::Vec<Demo3OnchainDexRejectedCandidateSummary>,
|
||||
/// Number of signatures returned by Solana RPC.
|
||||
#[ts(type = "number")]
|
||||
pub fetched_signature_count: usize,
|
||||
@@ -477,6 +498,18 @@ pub(crate) struct Demo3OnchainDexDiscoveryResult {
|
||||
/// Number of failed transactions encountered.
|
||||
#[ts(type = "number")]
|
||||
pub failed_transaction_count: usize,
|
||||
/// Number of failed transactions skipped because include_failed is false.
|
||||
#[ts(type = "number")]
|
||||
pub skipped_failed_transaction_count: usize,
|
||||
/// Number of swap-log transactions skipped by the transaction-level swap guard.
|
||||
#[ts(type = "number")]
|
||||
pub skipped_swap_log_transaction_count: usize,
|
||||
/// Number of candidate rows extracted before target-event filtering.
|
||||
#[ts(type = "number")]
|
||||
pub extracted_candidate_count: usize,
|
||||
/// Number of candidate rows rejected by target-event filtering.
|
||||
#[ts(type = "number")]
|
||||
pub target_rejected_candidate_count: usize,
|
||||
/// Number of candidate rows returned.
|
||||
#[ts(type = "number")]
|
||||
pub candidate_count: usize,
|
||||
@@ -484,6 +517,27 @@ pub(crate) struct Demo3OnchainDexDiscoveryResult {
|
||||
pub candidates: std::vec::Vec<Demo3OnchainDexPairCandidate>,
|
||||
}
|
||||
|
||||
/// Rejected on-chain discovery candidate summary.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/Demo3OnchainDexRejectedCandidateSummary.ts"
|
||||
)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub(crate) struct Demo3OnchainDexRejectedCandidateSummary {
|
||||
/// Candidate kind rejected by target filtering.
|
||||
pub candidate_kind: std::string::String,
|
||||
/// Optional instruction data prefix.
|
||||
pub instruction_data_prefix: std::option::Option<std::string::String>,
|
||||
/// Optional instruction name.
|
||||
pub instruction_name: std::option::Option<std::string::String>,
|
||||
/// Rejection reason.
|
||||
pub rejection_reason: std::string::String,
|
||||
/// Count of matching rejected candidates.
|
||||
#[ts(type = "number")]
|
||||
pub count: usize,
|
||||
}
|
||||
|
||||
/// Candidate on-chain transaction/instruction for a DEX program id.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[ts(export, export_to = "../frontend/ts/bindings/Demo3OnchainDexPairCandidate.ts")]
|
||||
@@ -515,6 +569,8 @@ pub(crate) struct Demo3OnchainDexPairCandidate {
|
||||
pub inner_instruction_index: std::option::Option<i64>,
|
||||
/// Instruction name inferred from data/logs.
|
||||
pub instruction_name: std::option::Option<std::string::String>,
|
||||
/// Prefix of the raw base58 instruction data, useful for audit grouping.
|
||||
pub instruction_data_prefix: std::option::Option<std::string::String>,
|
||||
/// Candidate pool address.
|
||||
pub pool_address: std::option::Option<std::string::String>,
|
||||
/// Candidate token A mint.
|
||||
@@ -627,6 +683,11 @@ fn to_lib_onchain_request(
|
||||
return kb_lib::OnchainDexPairDiscoveryRequestDto {
|
||||
dex_code: normalize_optional_text(request.dex_code.clone()),
|
||||
program_id: normalize_optional_text(request.program_id.clone()),
|
||||
signature_source: normalize_optional_text(request.signature_source.clone()),
|
||||
source_address: normalize_optional_text(request.source_address.clone()),
|
||||
target_event: normalize_optional_text(request.target_event.clone()),
|
||||
exclude_swaps: request.exclude_swaps,
|
||||
include_failed: request.include_failed,
|
||||
http_role: request.http_role.trim().to_string(),
|
||||
signature_limit: request.signature_limit,
|
||||
transaction_limit: request.transaction_limit,
|
||||
@@ -645,6 +706,11 @@ fn from_lib_onchain_result(
|
||||
request: Demo3OnchainDexDiscoveryRequest {
|
||||
dex_code: result.request.dex_code,
|
||||
program_id: result.request.program_id,
|
||||
signature_source: result.request.signature_source,
|
||||
source_address: result.request.source_address,
|
||||
target_event: result.request.target_event,
|
||||
exclude_swaps: result.request.exclude_swaps,
|
||||
include_failed: result.request.include_failed,
|
||||
http_role: result.request.http_role,
|
||||
signature_limit: result.request.signature_limit,
|
||||
transaction_limit: result.request.transaction_limit,
|
||||
@@ -652,15 +718,42 @@ fn from_lib_onchain_result(
|
||||
},
|
||||
resolved_dex_code: result.resolved_dex_code,
|
||||
resolved_program_id: result.resolved_program_id,
|
||||
resolved_signature_source: result.resolved_signature_source,
|
||||
resolved_signature_address: result.resolved_signature_address,
|
||||
unique_signature_count: result.unique_signature_count,
|
||||
unique_backfill_signatures: result.unique_backfill_signatures,
|
||||
rejected_candidate_summary: from_lib_rejected_candidate_summary(
|
||||
result.rejected_candidate_summary,
|
||||
),
|
||||
fetched_signature_count: result.fetched_signature_count,
|
||||
fetched_transaction_count: result.fetched_transaction_count,
|
||||
missing_transaction_count: result.missing_transaction_count,
|
||||
failed_transaction_count: result.failed_transaction_count,
|
||||
skipped_failed_transaction_count: result.skipped_failed_transaction_count,
|
||||
skipped_swap_log_transaction_count: result.skipped_swap_log_transaction_count,
|
||||
extracted_candidate_count: result.extracted_candidate_count,
|
||||
target_rejected_candidate_count: result.target_rejected_candidate_count,
|
||||
candidate_count: result.candidate_count,
|
||||
candidates,
|
||||
};
|
||||
}
|
||||
|
||||
fn from_lib_rejected_candidate_summary(
|
||||
values: std::vec::Vec<kb_lib::OnchainDexRejectedCandidateSummaryDto>,
|
||||
) -> std::vec::Vec<Demo3OnchainDexRejectedCandidateSummary> {
|
||||
let mut mapped = std::vec::Vec::new();
|
||||
for value in values {
|
||||
mapped.push(Demo3OnchainDexRejectedCandidateSummary {
|
||||
candidate_kind: value.candidate_kind,
|
||||
instruction_data_prefix: value.instruction_data_prefix,
|
||||
instruction_name: value.instruction_name,
|
||||
rejection_reason: value.rejection_reason,
|
||||
count: value.count,
|
||||
});
|
||||
}
|
||||
return mapped;
|
||||
}
|
||||
|
||||
fn from_lib_onchain_candidate(
|
||||
candidate: kb_lib::OnchainDexPairCandidateDto,
|
||||
) -> Demo3OnchainDexPairCandidate {
|
||||
@@ -676,6 +769,7 @@ fn from_lib_onchain_candidate(
|
||||
instruction_index: candidate.instruction_index,
|
||||
inner_instruction_index: candidate.inner_instruction_index,
|
||||
instruction_name: candidate.instruction_name,
|
||||
instruction_data_prefix: candidate.instruction_data_prefix,
|
||||
pool_address: candidate.pool_address,
|
||||
token_a_mint: candidate.token_a_mint,
|
||||
token_b_mint: candidate.token_b_mint,
|
||||
|
||||
Reference in New Issue
Block a user