This commit is contained in:
2026-05-20 23:57:15 +02:00
parent fad7ec5107
commit 62831a0abe
56 changed files with 6603 additions and 114 deletions

View File

@@ -1109,6 +1109,20 @@ pub(crate) struct DemoPipeline2BackfillPoolRequest {
pub pool_signature_limit: u32,
}
/// Request payload for single-signature backfill.
#[derive(Clone, Debug, serde::Deserialize, TS)]
#[ts(
export,
export_to = "../frontend/ts/bindings/DemoPipeline2BackfillSignatureRequest.ts"
)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DemoPipeline2BackfillSignatureRequest {
/// Transaction signature to resolve and replay.
pub signature: std::string::String,
/// Optional HTTP role.
pub http_role: std::option::Option<std::string::String>,
}
/// Shared backfill response payload.
#[derive(Clone, Debug, serde::Serialize, TS)]
#[ts(export, export_to = "../frontend/ts/bindings/DemoPipeline2BackfillPayload.ts")]
@@ -1116,7 +1130,7 @@ pub(crate) struct DemoPipeline2BackfillPoolRequest {
pub(crate) struct DemoPipeline2BackfillPayload {
/// Object key used by the backfill.
pub object_key: std::string::String,
/// Mode: `tokenMint` or `poolAddress`.
/// Mode: `tokenMint`, `poolAddress` or `signature`.
pub mode: std::string::String,
/// HTTP role used.
pub http_role: std::string::String,
@@ -1265,7 +1279,7 @@ pub(crate) async fn demo_pipeline2_validate_local_pipeline(
let service = kb_lib::LocalPipelineValidationService::new(database.clone());
let profile_code = match request {
Some(request) => request.profile_code,
None => "0.7.39_dex_first_effective_swap_surfaces".to_string(),
None => "0.7.40_raydium_effective_surfaces".to_string(),
};
let run_result = match profile_code.as_str() {
"0.7.27" | "0.7.27_dexes_non_regression" => {
@@ -1304,7 +1318,12 @@ pub(crate) async fn demo_pipeline2_validate_local_pipeline(
"0.7.38" | "0.7.38_token_metadata_gap_prioritization" => {
service.validate_v0_7_38_current_database().await
},
"0.7.39" | "0.7.39_dex_first_effective_swap_surfaces" | "0.7.39_launch_surface_origin_baseline" => {
"0.7.39"
| "0.7.39_dex_first_effective_swap_surfaces"
| "0.7.39_launch_surface_origin_baseline" => {
service.validate_v0_7_39_current_database().await
},
"0.7.40" | "0.7.40_raydium_effective_surfaces" => {
service.validate_v0_7_39_current_database().await
},
other => Err(kb_lib::Error::InvalidState(format!(
@@ -1495,6 +1514,54 @@ pub(crate) async fn demo_pipeline2_backfill_pool_address(
})
}
/// Runs a targeted single-signature backfill then returns the refreshed catalog.
#[tauri::command]
pub(crate) async fn demo_pipeline2_backfill_signature(
state: tauri::State<'_, crate::AppState>,
request: DemoPipeline2BackfillSignatureRequest,
) -> Result<DemoPipeline2BackfillPayload, std::string::String> {
let signature = request.signature.trim().to_string();
if signature.is_empty() {
return Err("signature must not be empty".to_string());
}
let http_role = demo_pipeline2_normalize_http_role(request.http_role);
let database = state.database.clone();
let http_pool = std::sync::Arc::new(state.http_pool.clone());
let service = kb_lib::TokenBackfillService::new(http_pool, database.clone(), http_role.clone());
let result = service.backfill_signature(signature.as_str()).await;
let backfill = match result {
Ok(backfill) => backfill,
Err(error) => {
return Err(format!(
"cannot backfill signature '{}' with role '{}': {}",
signature, http_role, error
));
},
};
let summary_json_result = serde_json::to_string_pretty(&backfill);
let summary_json = match summary_json_result {
Ok(summary_json) => summary_json,
Err(error) => {
return Err(format!(
"cannot serialize signature backfill result for '{}': {}",
signature, error
));
},
};
let catalog_result = demo_pipeline2_build_catalog(database).await;
let catalog = match catalog_result {
Ok(catalog) => catalog,
Err(error) => return Err(error),
};
Ok(DemoPipeline2BackfillPayload {
object_key: signature,
mode: "signature".to_string(),
http_role,
summary_json,
catalog,
})
}
/// Loads candles for one pair and one timeframe.
#[tauri::command]
pub(crate) async fn demo_pipeline2_get_pair_candles(