v0.1.0-pre.061
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
// file: kb-app-demo-desktop/src/demo_core_extraction.rs
|
||||
// version: 10
|
||||
// version: 11
|
||||
|
||||
//! Tauri commands and UI payloads for canonical transaction to core extraction.
|
||||
|
||||
use tauri::Emitter; // rust-rules: trait-import
|
||||
use ts_rs::TS; // rust-rules: derive-import
|
||||
|
||||
/// One registered program offered as a non-blocking core extraction suggestion.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(
|
||||
export,
|
||||
export_to = "../frontend/ts/bindings/kb_app_demo_desktop/demo_core_extraction/DemoCoreExtractionProgramOption.ts"
|
||||
)]
|
||||
pub(crate) struct DemoCoreExtractionProgramOption {
|
||||
/// Stable registry code.
|
||||
pub(crate) code: std::string::String,
|
||||
/// Canonical Solana program id.
|
||||
pub(crate) program_id: std::string::String,
|
||||
}
|
||||
|
||||
/// Initial options shown by the core extraction demo.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -22,6 +36,8 @@ pub(crate) struct DemoCoreExtractionOptionsPayload {
|
||||
pub(crate) default_max_concurrent_extractions: u32,
|
||||
/// Whether one extraction campaign is currently running.
|
||||
pub(crate) running: bool,
|
||||
/// Registered program ids offered without restricting free text entry.
|
||||
pub(crate) programs: std::vec::Vec<crate::DemoCoreExtractionProgramOption>,
|
||||
}
|
||||
|
||||
/// UI request for one bounded core extraction campaign.
|
||||
@@ -166,6 +182,15 @@ pub(crate) fn demo_core_extraction_options_payload(
|
||||
default_limit: 100,
|
||||
default_max_concurrent_extractions: 4,
|
||||
running: state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire),
|
||||
programs: kb_program_ids::registered_program_ids()
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
return crate::DemoCoreExtractionProgramOption {
|
||||
code: entry.code().to_string(),
|
||||
program_id: entry.program_id().to_string(),
|
||||
};
|
||||
})
|
||||
.collect(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user