0.5.1-pre.002
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
// file: kb-app-demo-desktop/src/app_state.rs
|
||||
// version: 10
|
||||
// version: 11
|
||||
|
||||
//! Shared Tauri application state and startup initialization.
|
||||
|
||||
/// Shared state managed by Tauri for the desktop demo application.
|
||||
pub(crate) struct AppState {
|
||||
config_path: std::string::String,
|
||||
app_config: kb_config::AppConfig,
|
||||
active_profile: kb_config::ProfileConfig,
|
||||
logging_guard: std::sync::Mutex<kb_logging::LoggingGuard>,
|
||||
http_pool: kb_onchain_transport::HttpEndpointPool,
|
||||
app_config: ks_config::AppConfig,
|
||||
active_profile: ks_config::ProfileConfig,
|
||||
logging_guard: std::sync::Mutex<ks_logging::LoggingGuard>,
|
||||
http_pool: ks_onchain_transport::HttpEndpointPool,
|
||||
ws_pool:
|
||||
std::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsEndpointPool>>>,
|
||||
std::sync::Mutex<std::option::Option<std::sync::Arc<ks_onchain_transport::WsEndpointPool>>>,
|
||||
demo_ws_session:
|
||||
tokio::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>>,
|
||||
tokio::sync::Mutex<std::option::Option<std::sync::Arc<ks_onchain_transport::WsSession>>>,
|
||||
demo_backfill_running: std::sync::atomic::AtomicBool,
|
||||
demo_backfill_cancel_requested: std::sync::atomic::AtomicBool,
|
||||
demo_core_extraction_running: std::sync::atomic::AtomicBool,
|
||||
@@ -28,26 +28,26 @@ pub(crate) struct AppState {
|
||||
|
||||
impl crate::AppState {
|
||||
/// Initializes configuration, logging and shared runtime state.
|
||||
pub(crate) fn initialize() -> kb_core::Result<crate::AppState> {
|
||||
pub(crate) fn initialize() -> ks_core::Result<crate::AppState> {
|
||||
let config_path = resolve_config_path();
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let app_config = match kb_config::read_config_json_file_with_environment(
|
||||
let app_config = match ks_config::read_config_json_file_with_environment(
|
||||
&config_path,
|
||||
&workspace_root,
|
||||
) {
|
||||
std::result::Result::Ok(config) => config,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let active_profile = match kb_config::active_profile(&app_config) {
|
||||
let active_profile = match ks_config::active_profile(&app_config) {
|
||||
std::result::Result::Ok(profile) => profile.clone(),
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let logging_config = convert_logging_config(&active_profile.logging);
|
||||
let logging_guard = match kb_logging::init_logging(&logging_config) {
|
||||
let logging_guard = match ks_logging::init_logging(&logging_config) {
|
||||
std::result::Result::Ok(guard) => guard,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&active_profile)
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&active_profile)
|
||||
{
|
||||
std::result::Result::Ok(pool) => pool,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
@@ -79,29 +79,29 @@ impl crate::AppState {
|
||||
}
|
||||
|
||||
/// Returns the complete parsed application configuration.
|
||||
pub(crate) fn app_config(&self) -> &kb_config::AppConfig {
|
||||
pub(crate) fn app_config(&self) -> &ks_config::AppConfig {
|
||||
return &self.app_config;
|
||||
}
|
||||
|
||||
/// Returns the active profile selected from the configuration.
|
||||
pub(crate) fn active_profile(&self) -> &kb_config::ProfileConfig {
|
||||
pub(crate) fn active_profile(&self) -> &ks_config::ProfileConfig {
|
||||
return &self.active_profile;
|
||||
}
|
||||
|
||||
/// Returns the configured HTTP endpoint pool.
|
||||
pub(crate) fn http_pool(&self) -> &kb_onchain_transport::HttpEndpointPool {
|
||||
pub(crate) fn http_pool(&self) -> &ks_onchain_transport::HttpEndpointPool {
|
||||
return &self.http_pool;
|
||||
}
|
||||
|
||||
/// Returns the lazily initialized WebSocket endpoint pool.
|
||||
pub(crate) fn demo_ws_pool(
|
||||
&self,
|
||||
) -> kb_core::Result<std::sync::Arc<kb_onchain_transport::WsEndpointPool>> {
|
||||
) -> ks_core::Result<std::sync::Arc<ks_onchain_transport::WsEndpointPool>> {
|
||||
let lock_result = self.ws_pool.lock();
|
||||
let mut guard = match lock_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(_) => {
|
||||
return std::result::Result::Err(kb_core::Error::invalid_state(
|
||||
return std::result::Result::Err(ks_core::Error::invalid_state(
|
||||
"demo WebSocket pool lock is poisoned",
|
||||
));
|
||||
},
|
||||
@@ -109,7 +109,7 @@ impl crate::AppState {
|
||||
if let std::option::Option::Some(pool) = guard.as_ref() {
|
||||
return std::result::Result::Ok(std::sync::Arc::clone(pool));
|
||||
}
|
||||
let pool = match kb_onchain_transport::WsEndpointPool::from_profile(&self.active_profile) {
|
||||
let pool = match ks_onchain_transport::WsEndpointPool::from_profile(&self.active_profile) {
|
||||
std::result::Result::Ok(value) => std::sync::Arc::new(value),
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
@@ -120,7 +120,7 @@ impl crate::AppState {
|
||||
/// Returns the persistent WebSocket demo session slot.
|
||||
pub(crate) fn demo_ws_session(
|
||||
&self,
|
||||
) -> &tokio::sync::Mutex<std::option::Option<std::sync::Arc<kb_onchain_transport::WsSession>>>
|
||||
) -> &tokio::sync::Mutex<std::option::Option<std::sync::Arc<ks_onchain_transport::WsSession>>>
|
||||
{
|
||||
return &self.demo_ws_session;
|
||||
}
|
||||
@@ -198,10 +198,10 @@ impl crate::AppState {
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::LoggingConfig {
|
||||
let mut targets = std::vec::Vec::<kb_logging::LogTargetConfig>::new();
|
||||
fn convert_logging_config(config: &ks_config::LoggingConfig) -> ks_logging::LoggingConfig {
|
||||
let mut targets = std::vec::Vec::<ks_logging::LogTargetConfig>::new();
|
||||
for target in &config.targets {
|
||||
targets.push(kb_logging::LogTargetConfig {
|
||||
targets.push(ks_logging::LogTargetConfig {
|
||||
name: target.name.clone(),
|
||||
enabled: target.enabled,
|
||||
sink: target.sink.clone(),
|
||||
@@ -213,14 +213,14 @@ fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::Logg
|
||||
targets: target.targets.clone(),
|
||||
});
|
||||
}
|
||||
let mut target_filters = std::vec::Vec::<kb_logging::LogTargetFilterConfig>::new();
|
||||
let mut target_filters = std::vec::Vec::<ks_logging::LogTargetFilterConfig>::new();
|
||||
for filter in &config.target_filters {
|
||||
target_filters.push(kb_logging::LogTargetFilterConfig {
|
||||
target_filters.push(ks_logging::LogTargetFilterConfig {
|
||||
target: filter.target.clone(),
|
||||
level: filter.level.clone(),
|
||||
});
|
||||
}
|
||||
return kb_logging::LoggingConfig {
|
||||
return ks_logging::LoggingConfig {
|
||||
default_level: config.default_level.clone(),
|
||||
targets,
|
||||
target_filters,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_backfill.rs
|
||||
// version: 15
|
||||
// version: 16
|
||||
|
||||
//! Tauri commands and UI payloads for bounded HTTP transaction backfills.
|
||||
|
||||
@@ -193,8 +193,8 @@ pub(crate) struct DemoBackfillObserver<'a> {
|
||||
pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
impl kb_pipeline::BackfillObserver for crate::DemoBackfillObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) {
|
||||
impl ks_pipeline::BackfillObserver for crate::DemoBackfillObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) {
|
||||
let payload = crate::DemoBackfillProgressPayload {
|
||||
timestamp: event.timestamp.clone(),
|
||||
level: event.level.code().to_string(),
|
||||
@@ -244,7 +244,7 @@ pub(crate) fn demo_backfill_options(
|
||||
} else {
|
||||
roles.first().map(|item| return item.role.clone())
|
||||
};
|
||||
let programs = kb_program_ids::registered_program_ids()
|
||||
let programs = ks_program_ids::registered_program_ids()
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
return crate::DemoBackfillProgramOption {
|
||||
@@ -289,7 +289,7 @@ pub(crate) async fn demo_backfill_execute(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let profile = state.active_profile();
|
||||
let store_options = match kb_store::PostgresStoreOptions::new(
|
||||
let store_options = match ks_store::PostgresStoreOptions::new(
|
||||
profile.database.postgres.url.clone(),
|
||||
profile.database.postgres.max_connections,
|
||||
profile.database.postgres.connect_timeout_ms,
|
||||
@@ -298,7 +298,7 @@ pub(crate) async fn demo_backfill_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let store = match kb_store::PostgresStore::connect(store_options).await {
|
||||
let store = match ks_store::PostgresStore::connect(store_options).await {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -309,7 +309,7 @@ pub(crate) async fn demo_backfill_execute(
|
||||
app_handle,
|
||||
cancel_requested: state.demo_backfill_cancel_requested(),
|
||||
};
|
||||
let summary = match kb_pipeline::execute_http_backfill(
|
||||
let summary = match ks_pipeline::execute_http_backfill(
|
||||
state.http_pool(),
|
||||
&store,
|
||||
&pipeline_request,
|
||||
@@ -324,7 +324,7 @@ pub(crate) async fn demo_backfill_execute(
|
||||
}
|
||||
|
||||
fn build_role_options(
|
||||
snapshots: std::vec::Vec<kb_onchain_transport::HttpPoolClientSnapshot>,
|
||||
snapshots: std::vec::Vec<ks_onchain_transport::HttpPoolClientSnapshot>,
|
||||
) -> std::vec::Vec<crate::DemoBackfillRoleOption> {
|
||||
let mut role_methods = std::collections::BTreeMap::<
|
||||
std::string::String,
|
||||
@@ -364,25 +364,25 @@ fn build_role_options(
|
||||
|
||||
fn build_pipeline_request(
|
||||
request: DemoBackfillRequest,
|
||||
) -> std::result::Result<kb_pipeline::BackfillRequest, std::string::String> {
|
||||
) -> std::result::Result<ks_pipeline::BackfillRequest, std::string::String> {
|
||||
let source_result = match request.mode.trim() {
|
||||
"explicit_signatures" => explicit_source(request.signatures_text.as_deref()),
|
||||
"program" => address_source(
|
||||
kb_pipeline::BackfillAddressKind::Program,
|
||||
ks_pipeline::BackfillAddressKind::Program,
|
||||
request.address.as_deref(),
|
||||
request.anchor_signature.as_deref(),
|
||||
request.direction.as_deref(),
|
||||
request.limit,
|
||||
),
|
||||
"token" => address_source(
|
||||
kb_pipeline::BackfillAddressKind::Token,
|
||||
ks_pipeline::BackfillAddressKind::Token,
|
||||
request.address.as_deref(),
|
||||
request.anchor_signature.as_deref(),
|
||||
request.direction.as_deref(),
|
||||
request.limit,
|
||||
),
|
||||
"pool" => address_source(
|
||||
kb_pipeline::BackfillAddressKind::Pool,
|
||||
ks_pipeline::BackfillAddressKind::Pool,
|
||||
request.address.as_deref(),
|
||||
request.anchor_signature.as_deref(),
|
||||
request.direction.as_deref(),
|
||||
@@ -394,7 +394,7 @@ fn build_pipeline_request(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let pipeline_request = kb_pipeline::BackfillRequest {
|
||||
let pipeline_request = ks_pipeline::BackfillRequest {
|
||||
role: request.role,
|
||||
commitment: request.commitment,
|
||||
source,
|
||||
@@ -412,7 +412,7 @@ fn build_pipeline_request(
|
||||
|
||||
fn explicit_source(
|
||||
signatures_text: std::option::Option<&str>,
|
||||
) -> std::result::Result<kb_pipeline::BackfillSource, std::string::String> {
|
||||
) -> std::result::Result<ks_pipeline::BackfillSource, std::string::String> {
|
||||
let text = match signatures_text {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => "",
|
||||
@@ -428,16 +428,16 @@ fn explicit_source(
|
||||
"the signatures textarea must contain at least one signature".to_string(),
|
||||
);
|
||||
}
|
||||
return std::result::Result::Ok(kb_pipeline::BackfillSource::ExplicitSignatures(signatures));
|
||||
return std::result::Result::Ok(ks_pipeline::BackfillSource::ExplicitSignatures(signatures));
|
||||
}
|
||||
|
||||
fn address_source(
|
||||
kind: kb_pipeline::BackfillAddressKind,
|
||||
kind: ks_pipeline::BackfillAddressKind,
|
||||
address: std::option::Option<&str>,
|
||||
anchor_signature: std::option::Option<&str>,
|
||||
direction: std::option::Option<&str>,
|
||||
limit: u32,
|
||||
) -> std::result::Result<kb_pipeline::BackfillSource, std::string::String> {
|
||||
) -> std::result::Result<ks_pipeline::BackfillSource, std::string::String> {
|
||||
let address_text = match address {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => "",
|
||||
@@ -451,8 +451,8 @@ fn address_source(
|
||||
std::option::Option::None => "",
|
||||
};
|
||||
let direction_value = match direction_text.trim() {
|
||||
"before" => kb_pipeline::BackfillDirection::Before,
|
||||
"after" => kb_pipeline::BackfillDirection::After,
|
||||
"before" => ks_pipeline::BackfillDirection::Before,
|
||||
"after" => ks_pipeline::BackfillDirection::After,
|
||||
_ => {
|
||||
return std::result::Result::Err("direction must be before or after".to_string());
|
||||
},
|
||||
@@ -461,7 +461,7 @@ fn address_source(
|
||||
.map(str::trim)
|
||||
.filter(|value| return !value.is_empty())
|
||||
.map(str::to_string);
|
||||
if direction_value == kb_pipeline::BackfillDirection::After && anchor_value.is_none() {
|
||||
if direction_value == ks_pipeline::BackfillDirection::After && anchor_value.is_none() {
|
||||
return std::result::Result::Err(
|
||||
"anchor signature is required for newer-history backfill".to_string(),
|
||||
);
|
||||
@@ -472,7 +472,7 @@ fn address_source(
|
||||
return std::result::Result::Err(format!("signature limit conversion failed: {error}"));
|
||||
},
|
||||
};
|
||||
return std::result::Result::Ok(kb_pipeline::BackfillSource::AddressHistory {
|
||||
return std::result::Result::Ok(ks_pipeline::BackfillSource::AddressHistory {
|
||||
kind,
|
||||
address: address_value.to_string(),
|
||||
anchor_signature: anchor_value,
|
||||
@@ -481,7 +481,7 @@ fn address_source(
|
||||
});
|
||||
}
|
||||
|
||||
fn summary_payload(summary: kb_pipeline::BackfillSummary) -> DemoBackfillSummaryPayload {
|
||||
fn summary_payload(summary: ks_pipeline::BackfillSummary) -> DemoBackfillSummaryPayload {
|
||||
return crate::DemoBackfillSummaryPayload {
|
||||
capture_session_id: summary.capture_session_id,
|
||||
filter_code: summary.filter_code,
|
||||
@@ -520,7 +520,7 @@ mod tests {
|
||||
};
|
||||
assert_eq!(
|
||||
source,
|
||||
kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![
|
||||
ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![
|
||||
"first".to_string(),
|
||||
"second".to_string(),
|
||||
])
|
||||
@@ -530,7 +530,7 @@ mod tests {
|
||||
#[test]
|
||||
fn older_history_accepts_missing_anchor_and_uses_latest_filter() {
|
||||
let source_result = super::address_source(
|
||||
kb_pipeline::BackfillAddressKind::Program,
|
||||
ks_pipeline::BackfillAddressKind::Program,
|
||||
std::option::Option::Some("11111111111111111111111111111111"),
|
||||
std::option::Option::Some(" "),
|
||||
std::option::Option::Some("before"),
|
||||
@@ -540,7 +540,7 @@ mod tests {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => panic!("source failed: {error}"),
|
||||
};
|
||||
let request = kb_pipeline::BackfillRequest {
|
||||
let request = ks_pipeline::BackfillRequest {
|
||||
role: "history_backfill".to_string(),
|
||||
commitment: "confirmed".to_string(),
|
||||
source,
|
||||
@@ -556,7 +556,7 @@ mod tests {
|
||||
#[test]
|
||||
fn newer_history_rejects_missing_anchor() {
|
||||
let source_result = super::address_source(
|
||||
kb_pipeline::BackfillAddressKind::Program,
|
||||
ks_pipeline::BackfillAddressKind::Program,
|
||||
std::option::Option::Some("11111111111111111111111111111111"),
|
||||
std::option::Option::None,
|
||||
std::option::Option::Some("after"),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_config.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Configuration demo payload and state projection.
|
||||
|
||||
@@ -19,9 +19,9 @@ pub(crate) struct DemoConfigPayload {
|
||||
/// Active profile environment.
|
||||
pub(crate) environment: std::string::String,
|
||||
/// Entire parsed configuration.
|
||||
pub(crate) app_config: kb_config::AppConfig,
|
||||
pub(crate) app_config: ks_config::AppConfig,
|
||||
/// Active profile configuration.
|
||||
pub(crate) active_profile: kb_config::ProfileConfig,
|
||||
pub(crate) active_profile: ks_config::ProfileConfig,
|
||||
/// Embedded JSON Schema text used during loading.
|
||||
pub(crate) schema_json: std::string::String,
|
||||
}
|
||||
@@ -34,7 +34,7 @@ pub(crate) fn demo_config_payload(state: &crate::AppState) -> crate::DemoConfigP
|
||||
environment: state.active_profile().app.environment.clone(),
|
||||
app_config: state.app_config().clone(),
|
||||
active_profile: state.active_profile().clone(),
|
||||
schema_json: kb_config::config_json_schema_text().to_owned(),
|
||||
schema_json: ks_config::config_json_schema_text().to_owned(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_core_extraction.rs
|
||||
// version: 13
|
||||
// version: 14
|
||||
|
||||
//! Tauri commands and UI payloads for canonical transaction to core extraction.
|
||||
|
||||
@@ -137,8 +137,8 @@ pub(crate) struct DemoCoreExtractionObserver<'a> {
|
||||
pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
impl kb_pipeline::CoreExtractionObserver for crate::DemoCoreExtractionObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) {
|
||||
impl ks_pipeline::CoreExtractionObserver for crate::DemoCoreExtractionObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) {
|
||||
let payload = crate::DemoCoreExtractionProgressPayload {
|
||||
timestamp: event.timestamp.clone(),
|
||||
level: event.level.code().to_string(),
|
||||
@@ -178,11 +178,11 @@ pub(crate) fn demo_core_extraction_options_payload(
|
||||
state: &crate::AppState,
|
||||
) -> crate::DemoCoreExtractionOptionsPayload {
|
||||
return crate::DemoCoreExtractionOptionsPayload {
|
||||
processor_version: kb_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(),
|
||||
processor_version: ks_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(),
|
||||
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()
|
||||
programs: ks_program_ids::registered_program_ids()
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
return crate::DemoCoreExtractionProgramOption {
|
||||
@@ -231,7 +231,7 @@ pub(crate) async fn demo_core_extraction_execute(
|
||||
cancel_requested: state.demo_core_extraction_cancel_requested(),
|
||||
};
|
||||
let summary_result =
|
||||
kb_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await;
|
||||
ks_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await;
|
||||
let summary = match summary_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -249,13 +249,13 @@ pub(crate) fn demo_core_extraction_cancel(state: &crate::AppState) -> bool {
|
||||
|
||||
fn build_pipeline_request(
|
||||
request: crate::DemoCoreExtractionRequest,
|
||||
) -> std::result::Result<kb_pipeline::CoreExtractionRequest, std::string::String> {
|
||||
) -> std::result::Result<ks_pipeline::CoreExtractionRequest, std::string::String> {
|
||||
let source_result = match request.mode.trim() {
|
||||
"signatures" => {
|
||||
let signatures = split_signatures(request.signatures_text.as_deref());
|
||||
std::result::Result::Ok(kb_pipeline::CoreExtractionSource::Signatures(signatures))
|
||||
std::result::Result::Ok(ks_pipeline::CoreExtractionSource::Signatures(signatures))
|
||||
},
|
||||
"pending" => std::result::Result::Ok(kb_pipeline::CoreExtractionSource::Pending),
|
||||
"pending" => std::result::Result::Ok(ks_pipeline::CoreExtractionSource::Pending),
|
||||
"program_id" => {
|
||||
let program_id = match request.program_id {
|
||||
std::option::Option::Some(value) if !value.trim().is_empty() => value,
|
||||
@@ -265,7 +265,7 @@ fn build_pipeline_request(
|
||||
);
|
||||
},
|
||||
};
|
||||
std::result::Result::Ok(kb_pipeline::CoreExtractionSource::ProgramId { program_id })
|
||||
std::result::Result::Ok(ks_pipeline::CoreExtractionSource::ProgramId { program_id })
|
||||
},
|
||||
"slot_range" => {
|
||||
let min_slot = match request.min_slot {
|
||||
@@ -284,7 +284,7 @@ fn build_pipeline_request(
|
||||
);
|
||||
},
|
||||
};
|
||||
std::result::Result::Ok(kb_pipeline::CoreExtractionSource::SlotRange {
|
||||
std::result::Result::Ok(ks_pipeline::CoreExtractionSource::SlotRange {
|
||||
min_slot,
|
||||
max_slot,
|
||||
})
|
||||
@@ -295,7 +295,7 @@ fn build_pipeline_request(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let pipeline_request = kb_pipeline::CoreExtractionRequest {
|
||||
let pipeline_request = ks_pipeline::CoreExtractionRequest {
|
||||
source,
|
||||
limit: request.limit,
|
||||
max_concurrent_extractions: request.max_concurrent_extractions,
|
||||
@@ -309,7 +309,7 @@ fn build_pipeline_request(
|
||||
}
|
||||
|
||||
fn summary_payload(
|
||||
summary: kb_pipeline::CoreExtractionSummary,
|
||||
summary: ks_pipeline::CoreExtractionSummary,
|
||||
) -> crate::DemoCoreExtractionSummaryPayload {
|
||||
return crate::DemoCoreExtractionSummaryPayload {
|
||||
processor_version: summary.processor_version,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_decode_replay.rs
|
||||
// version: 39
|
||||
// version: 40
|
||||
|
||||
//! Tauri commands and UI payloads for contextual instruction decode replay.
|
||||
|
||||
@@ -319,8 +319,8 @@ pub(crate) struct DemoDecodeReplayObserver<'a> {
|
||||
pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool,
|
||||
}
|
||||
|
||||
impl kb_pipeline::DecodeReplayObserver for crate::DemoDecodeReplayObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) {
|
||||
impl ks_pipeline::DecodeReplayObserver for crate::DemoDecodeReplayObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) {
|
||||
let payload = crate::DemoDecodeReplayProgressPayload {
|
||||
campaign_id: self.campaign_id.clone(),
|
||||
timestamp: event.timestamp.clone(),
|
||||
@@ -385,7 +385,7 @@ pub(crate) fn demo_decode_replay_options(
|
||||
return format!("{}@{}", identity.name, identity.version);
|
||||
})
|
||||
.collect::<std::vec::Vec<_>>();
|
||||
let programs = kb_program_ids::registered_program_ids()
|
||||
let programs = ks_program_ids::registered_program_ids()
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
return crate::DemoDecodeReplayProgramOption {
|
||||
@@ -398,7 +398,7 @@ pub(crate) fn demo_decode_replay_options(
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "load_options",
|
||||
pipeline_version = kb_pipeline::DECODE_PIPELINE_VERSION,
|
||||
pipeline_version = ks_pipeline::DECODE_PIPELINE_VERSION,
|
||||
decoder_count = decoder_options.len(),
|
||||
materializer_names = ?materializer_names,
|
||||
default_limit = 100_u32,
|
||||
@@ -407,7 +407,7 @@ pub(crate) fn demo_decode_replay_options(
|
||||
"return contextual decode replay options"
|
||||
);
|
||||
return crate::DemoDecodeReplayOptionsPayload {
|
||||
pipeline_version: kb_pipeline::DECODE_PIPELINE_VERSION.to_string(),
|
||||
pipeline_version: ks_pipeline::DECODE_PIPELINE_VERSION.to_string(),
|
||||
decoders: decoder_options,
|
||||
materializer_names,
|
||||
programs,
|
||||
@@ -423,7 +423,7 @@ pub(crate) async fn demo_decode_replay_execute(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoDecodeReplayRequest,
|
||||
) -> std::result::Result<crate::DemoDecodeReplaySummaryPayload, std::string::String> {
|
||||
let campaign_id = kb_pipeline::new_decode_campaign_id();
|
||||
let campaign_id = ks_pipeline::new_decode_campaign_id();
|
||||
tracing::debug!(
|
||||
target: crate::TRACING_TARGET,
|
||||
action = "execute",
|
||||
@@ -510,7 +510,7 @@ pub(crate) async fn demo_decode_replay_execute(
|
||||
campaign_id: pipeline_request.campaign_id.clone(),
|
||||
cancel_requested: state.demo_decode_replay_cancel_requested(),
|
||||
};
|
||||
let summary_result = kb_pipeline::execute_decode_replay(
|
||||
let summary_result = ks_pipeline::execute_decode_replay(
|
||||
&store,
|
||||
&pipeline_request,
|
||||
decoders.as_slice(),
|
||||
@@ -582,7 +582,7 @@ pub(crate) async fn demo_decode_replay_diagnostics(
|
||||
})
|
||||
.map(crate::table_snapshot_from_pg)
|
||||
.collect();
|
||||
let coverage_result = kb_store::DecodePipelineStore::list_decode_coverage_summary(
|
||||
let coverage_result = ks_store::DecodePipelineStore::list_decode_coverage_summary(
|
||||
&store,
|
||||
std::option::Option::None,
|
||||
std::option::Option::None,
|
||||
@@ -605,7 +605,7 @@ pub(crate) async fn demo_decode_replay_annotations(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoTransactionAnnotationRequest,
|
||||
) -> std::result::Result<std::vec::Vec<crate::DemoTransactionAnnotationRow>, std::string::String> {
|
||||
let filter_result = kb_store::MaterializedEventFilter::new(
|
||||
let filter_result = ks_store::MaterializedEventFilter::new(
|
||||
std::option::Option::Some("materializer.transaction.annotations".to_string()),
|
||||
std::option::Option::Some("transaction_annotation".to_string()),
|
||||
request.signature_contains,
|
||||
@@ -622,7 +622,7 @@ pub(crate) async fn demo_decode_replay_annotations(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let rows_result =
|
||||
kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await;
|
||||
ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await;
|
||||
let rows = match rows_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -656,39 +656,39 @@ fn register_active_campaign(
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
|
||||
fn available_materializers() -> std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> {
|
||||
fn available_materializers() -> std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> {
|
||||
return std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtFeesMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtMetadataSolanaProgramMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtMetadataToken2022Materializer),
|
||||
std::sync::Arc::new(kb_lib::MtStakingMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtRiskMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtFeesMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtMetadataSolanaProgramMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtMetadataToken2022Materializer),
|
||||
std::sync::Arc::new(ks_lib::MtStakingMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtRiskMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer),
|
||||
];
|
||||
}
|
||||
|
||||
fn available_decoders() -> std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> {
|
||||
fn available_decoders() -> std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> {
|
||||
return std::vec![
|
||||
std::sync::Arc::new(kb_lib::DcSolanaCoreDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcMetadataSolanaProgramMetadataDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplElgamalRegistryDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplMemoDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplTokenDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplToken2022Decoder),
|
||||
std::sync::Arc::new(ks_lib::DcSolanaCoreDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcMetadataSolanaProgramMetadataDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplElgamalRegistryDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplMemoDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplTokenDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplToken2022Decoder),
|
||||
];
|
||||
}
|
||||
|
||||
fn build_pipeline_request(
|
||||
request: crate::DemoDecodeReplayRequest,
|
||||
campaign_id: std::string::String,
|
||||
) -> std::result::Result<kb_pipeline::DecodeReplayRequest, std::string::String> {
|
||||
) -> std::result::Result<ks_pipeline::DecodeReplayRequest, std::string::String> {
|
||||
let states_result = processing_states(request.instruction_state.as_str());
|
||||
let states = match states_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -703,7 +703,7 @@ fn build_pipeline_request(
|
||||
},
|
||||
_ => std::vec::Vec::new(),
|
||||
};
|
||||
let selection_result = kb_store::DecodeSelectionFilter::new(
|
||||
let selection_result = ks_store::DecodeSelectionFilter::new(
|
||||
signatures,
|
||||
states,
|
||||
std::option::Option::None,
|
||||
@@ -718,11 +718,11 @@ fn build_pipeline_request(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let dispatch_policy = if request.all_compatible {
|
||||
kb_pipeline::DecodeDispatchPolicy::AllCompatible
|
||||
ks_pipeline::DecodeDispatchPolicy::AllCompatible
|
||||
} else {
|
||||
kb_pipeline::DecodeDispatchPolicy::HighestPriority
|
||||
ks_pipeline::DecodeDispatchPolicy::HighestPriority
|
||||
};
|
||||
let pipeline_request = kb_pipeline::DecodeReplayRequest {
|
||||
let pipeline_request = ks_pipeline::DecodeReplayRequest {
|
||||
campaign_id,
|
||||
selection,
|
||||
decoder_names: request.decoder_names,
|
||||
@@ -773,31 +773,31 @@ fn text_sample(values: &[std::string::String], limit: usize) -> std::vec::Vec<&s
|
||||
|
||||
fn processing_states(
|
||||
value: &str,
|
||||
) -> std::result::Result<std::vec::Vec<kb_store::CoreInstructionProcessingState>, std::string::String>
|
||||
) -> std::result::Result<std::vec::Vec<ks_store::CoreInstructionProcessingState>, std::string::String>
|
||||
{
|
||||
return match value.trim() {
|
||||
"incomplete_signatures" | "actionable" => std::result::Result::Ok(std::vec![
|
||||
kb_store::CoreInstructionProcessingState::Pending,
|
||||
kb_store::CoreInstructionProcessingState::Failed,
|
||||
kb_store::CoreInstructionProcessingState::ReplayRequested,
|
||||
ks_store::CoreInstructionProcessingState::Pending,
|
||||
ks_store::CoreInstructionProcessingState::Failed,
|
||||
ks_store::CoreInstructionProcessingState::ReplayRequested,
|
||||
]),
|
||||
"pending" => {
|
||||
std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Pending])
|
||||
std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Pending])
|
||||
},
|
||||
"failed" => {
|
||||
std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Failed])
|
||||
std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Failed])
|
||||
},
|
||||
"replay_requested" => std::result::Result::Ok(std::vec![
|
||||
kb_store::CoreInstructionProcessingState::ReplayRequested
|
||||
ks_store::CoreInstructionProcessingState::ReplayRequested
|
||||
]),
|
||||
"decoded" => {
|
||||
std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Decoded])
|
||||
std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Decoded])
|
||||
},
|
||||
"ignored" => {
|
||||
std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Ignored])
|
||||
std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Ignored])
|
||||
},
|
||||
"materialized" => std::result::Result::Ok(std::vec![
|
||||
kb_store::CoreInstructionProcessingState::Materialized
|
||||
ks_store::CoreInstructionProcessingState::Materialized
|
||||
]),
|
||||
_ => std::result::Result::Err("unsupported instruction processing state".to_string()),
|
||||
};
|
||||
@@ -823,7 +823,7 @@ fn split_lines(text: std::option::Option<&str>) -> std::vec::Vec<std::string::St
|
||||
}
|
||||
|
||||
fn summary_payload(
|
||||
summary: kb_pipeline::DecodeReplaySummary,
|
||||
summary: ks_pipeline::DecodeReplaySummary,
|
||||
) -> crate::DemoDecodeReplaySummaryPayload {
|
||||
return crate::DemoDecodeReplaySummaryPayload {
|
||||
campaign_id: summary.campaign_id,
|
||||
@@ -861,7 +861,7 @@ fn summary_payload(
|
||||
}
|
||||
|
||||
fn coverage_payload(
|
||||
value: kb_store::DecodeCoverageSummaryRow,
|
||||
value: ks_store::DecodeCoverageSummaryRow,
|
||||
) -> crate::DemoDecodeCoverageSummaryPayload {
|
||||
return crate::DemoDecodeCoverageSummaryPayload {
|
||||
processor_name: value.processor_name,
|
||||
@@ -882,7 +882,7 @@ fn coverage_payload(
|
||||
}
|
||||
|
||||
fn annotation_payload(
|
||||
row: kb_store::MaterializedEventQueryRow,
|
||||
row: ks_store::MaterializedEventQueryRow,
|
||||
) -> std::result::Result<crate::DemoTransactionAnnotationRow, std::string::String> {
|
||||
if row.processor_name != "materializer.transaction.annotations"
|
||||
|| row.materialized_family != "transaction_annotation"
|
||||
@@ -994,31 +994,31 @@ fn required_annotation_text(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
fn ata_observation(entry: &str) -> kb_lib::DcApiDecodedObservation {
|
||||
return kb_lib::DcApiDecodedObservation {
|
||||
fn ata_observation(entry: &str) -> ks_lib::DcApiDecodedObservation {
|
||||
return ks_lib::DcApiDecodedObservation {
|
||||
event_key: format!("ata:{entry}:0"),
|
||||
event: kb_lib::MdDecodedProtocolEvent {
|
||||
signature: kb_lib::MdSignature("signature".to_string()),
|
||||
slot: kb_lib::MdSlot(1),
|
||||
instruction_path: kb_lib::MdInstructionPath("0".to_string()),
|
||||
program_id: kb_lib::MdProgramId(
|
||||
kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(),
|
||||
event: ks_lib::MdDecodedProtocolEvent {
|
||||
signature: ks_lib::MdSignature("signature".to_string()),
|
||||
slot: ks_lib::MdSlot(1),
|
||||
instruction_path: ks_lib::MdInstructionPath("0".to_string()),
|
||||
program_id: ks_lib::MdProgramId(
|
||||
ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(),
|
||||
),
|
||||
protocol_code: kb_lib::MdProtocolCode("spl.associated_token_account".to_string()),
|
||||
surface_code: kb_lib::MdSurfaceCode("spl.associated_token_account".to_string()),
|
||||
event_code: kb_lib::MdEventCode(format!("spl.associated_token_account.{entry}")),
|
||||
event_name: kb_lib::MdEventName(entry.to_string()),
|
||||
event_family: kb_lib::MdEventFamily::Lifecycle,
|
||||
source_kind: kb_lib::MdEventSourceKind::Instruction,
|
||||
confidence: kb_lib::MdDecoderConfidence::ManualExact,
|
||||
protocol_code: ks_lib::MdProtocolCode("spl.associated_token_account".to_string()),
|
||||
surface_code: ks_lib::MdSurfaceCode("spl.associated_token_account".to_string()),
|
||||
event_code: ks_lib::MdEventCode(format!("spl.associated_token_account.{entry}")),
|
||||
event_name: ks_lib::MdEventName(entry.to_string()),
|
||||
event_family: ks_lib::MdEventFamily::Lifecycle,
|
||||
source_kind: ks_lib::MdEventSourceKind::Instruction,
|
||||
confidence: ks_lib::MdDecoderConfidence::ManualExact,
|
||||
},
|
||||
payload_json: serde_json::json!({}),
|
||||
transaction_failed: false,
|
||||
transaction_error: std::option::Option::None,
|
||||
observation_committed: true,
|
||||
proof: kb_lib::DcApiDecoderProof {
|
||||
kind: kb_lib::DcApiDecoderProofKind::Manual,
|
||||
confidence: kb_lib::MdDecoderConfidence::ManualExact,
|
||||
proof: ks_lib::DcApiDecoderProof {
|
||||
kind: ks_lib::DcApiDecoderProofKind::Manual,
|
||||
confidence: ks_lib::MdDecoderConfidence::ManualExact,
|
||||
evidence: std::vec!["fixture".to_string()],
|
||||
},
|
||||
};
|
||||
@@ -1028,21 +1028,21 @@ mod tests {
|
||||
program_id: &str,
|
||||
surface: &str,
|
||||
entry: &str,
|
||||
) -> kb_lib::DcApiDecodedObservation {
|
||||
return kb_lib::DcApiDecodedObservation {
|
||||
) -> ks_lib::DcApiDecodedObservation {
|
||||
return ks_lib::DcApiDecodedObservation {
|
||||
event_key: format!("{surface}:{entry}:0"),
|
||||
event: kb_lib::MdDecodedProtocolEvent {
|
||||
signature: kb_lib::MdSignature("signature".to_string()),
|
||||
slot: kb_lib::MdSlot(1),
|
||||
instruction_path: kb_lib::MdInstructionPath("0".to_string()),
|
||||
program_id: kb_lib::MdProgramId(program_id.to_string()),
|
||||
protocol_code: kb_lib::MdProtocolCode(surface.to_string()),
|
||||
surface_code: kb_lib::MdSurfaceCode(surface.to_string()),
|
||||
event_code: kb_lib::MdEventCode(format!("{surface}.{entry}")),
|
||||
event_name: kb_lib::MdEventName(entry.to_string()),
|
||||
event_family: kb_lib::MdEventFamily::Metadata,
|
||||
source_kind: kb_lib::MdEventSourceKind::Instruction,
|
||||
confidence: kb_lib::MdDecoderConfidence::ManualExact,
|
||||
event: ks_lib::MdDecodedProtocolEvent {
|
||||
signature: ks_lib::MdSignature("signature".to_string()),
|
||||
slot: ks_lib::MdSlot(1),
|
||||
instruction_path: ks_lib::MdInstructionPath("0".to_string()),
|
||||
program_id: ks_lib::MdProgramId(program_id.to_string()),
|
||||
protocol_code: ks_lib::MdProtocolCode(surface.to_string()),
|
||||
surface_code: ks_lib::MdSurfaceCode(surface.to_string()),
|
||||
event_code: ks_lib::MdEventCode(format!("{surface}.{entry}")),
|
||||
event_name: ks_lib::MdEventName(entry.to_string()),
|
||||
event_family: ks_lib::MdEventFamily::Metadata,
|
||||
source_kind: ks_lib::MdEventSourceKind::Instruction,
|
||||
confidence: ks_lib::MdDecoderConfidence::ManualExact,
|
||||
},
|
||||
payload_json: serde_json::json!({
|
||||
"programId": program_id,
|
||||
@@ -1053,9 +1053,9 @@ mod tests {
|
||||
transaction_failed: false,
|
||||
transaction_error: std::option::Option::None,
|
||||
observation_committed: true,
|
||||
proof: kb_lib::DcApiDecoderProof {
|
||||
kind: kb_lib::DcApiDecoderProofKind::Manual,
|
||||
confidence: kb_lib::MdDecoderConfidence::ManualExact,
|
||||
proof: ks_lib::DcApiDecoderProof {
|
||||
kind: ks_lib::DcApiDecoderProofKind::Manual,
|
||||
confidence: ks_lib::MdDecoderConfidence::ManualExact,
|
||||
evidence: std::vec!["fixture".to_string()],
|
||||
},
|
||||
};
|
||||
@@ -1114,19 +1114,19 @@ mod tests {
|
||||
fn metadata_materializer_ownership_is_exact_in_the_runtime_registry() {
|
||||
for (program_id, surface, entry, expected) in [
|
||||
(
|
||||
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
|
||||
ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
|
||||
"metadata.metaplex_token_metadata",
|
||||
"create_metadata_account_v3",
|
||||
"materializer.metadata.metaplex_token_metadata",
|
||||
),
|
||||
(
|
||||
kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID,
|
||||
ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID,
|
||||
"metadata.solana_program_metadata",
|
||||
"initialize",
|
||||
"materializer.metadata.solana_program_metadata",
|
||||
),
|
||||
(
|
||||
kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID,
|
||||
ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID,
|
||||
"spl.token_2022",
|
||||
"initialize_token_metadata",
|
||||
"materializer.metadata.token_2022",
|
||||
@@ -1274,7 +1274,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn committed_annotation_row_is_mapped_to_ui_safe_contract() {
|
||||
let row = kb_store::MaterializedEventQueryRow {
|
||||
let row = ks_store::MaterializedEventQueryRow {
|
||||
processor_name: "materializer.transaction.annotations".to_string(),
|
||||
processor_version: "0.4.3".to_string(),
|
||||
input_key: "input".to_string(),
|
||||
@@ -1288,7 +1288,7 @@ mod tests {
|
||||
payload_json: serde_json::json!({
|
||||
"instructionPath": "1/0",
|
||||
"generation": "v4",
|
||||
"programId": kb_program_ids::SPL_MEMO_V4_PROGRAM_ID,
|
||||
"programId": ks_program_ids::SPL_MEMO_V4_PROGRAM_ID,
|
||||
"text": "annotation",
|
||||
"payloadLengthBytes": 10,
|
||||
"payloadSha256": "11",
|
||||
@@ -1310,7 +1310,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn malformed_annotation_payload_fails_closed() {
|
||||
let row = kb_store::MaterializedEventQueryRow {
|
||||
let row = ks_store::MaterializedEventQueryRow {
|
||||
processor_name: "materializer.transaction.annotations".to_string(),
|
||||
processor_version: "0.4.3".to_string(),
|
||||
input_key: "input".to_string(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_devnet_common.rs
|
||||
// version: 3
|
||||
// version: 4
|
||||
|
||||
//! Shared Devnet demo UI contracts.
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(crate) struct DemoExecutionDevnetStoreReadinessPayload {
|
||||
|
||||
/// Converts the reusable scenario readiness report to the desktop TS-RS payload.
|
||||
pub(crate) fn devnet_store_readiness_payload(
|
||||
readiness: kb_pipeline_demo_scenarios::DevnetProfileStoreReadiness,
|
||||
readiness: ks_pipeline_demo_scenarios::DevnetProfileStoreReadiness,
|
||||
) -> DemoExecutionDevnetStoreReadinessPayload {
|
||||
return DemoExecutionDevnetStoreReadinessPayload {
|
||||
profile_name: readiness.profile_name,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_metadata.rs
|
||||
// version: 15
|
||||
// version: 16
|
||||
|
||||
//! Shared desktop contracts for metadata execution demos.
|
||||
|
||||
@@ -69,8 +69,8 @@ impl crate::DemoExecutionMetadataObserver<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) {
|
||||
impl ks_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -85,8 +85,8 @@ impl kb_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_>
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) {
|
||||
impl ks_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -101,8 +101,8 @@ impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserve
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) {
|
||||
impl ks_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -117,12 +117,12 @@ impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver<
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline_demo_scenarios::SolanaExecutionObserver
|
||||
impl ks_pipeline_demo_scenarios::SolanaExecutionObserver
|
||||
for crate::DemoExecutionMetadataObserver<'_>
|
||||
{
|
||||
fn on_execution_progress(
|
||||
&self,
|
||||
event: &kb_pipeline_demo_scenarios::SolanaExecutionProgressEvent,
|
||||
event: &ks_pipeline_demo_scenarios::SolanaExecutionProgressEvent,
|
||||
) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs
|
||||
// version: 6
|
||||
// version: 7
|
||||
|
||||
//! Desktop adapters for generic and qualified Metaplex Token Metadata execution workflows.
|
||||
|
||||
@@ -186,7 +186,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -197,7 +197,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute(
|
||||
if let std::result::Result::Err(error) = store.initialize_store_schema().await {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let mut execution_request = match kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::from_operation_json(
|
||||
let mut execution_request = match ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::from_operation_json(
|
||||
request.intent_id,
|
||||
request.operation_json.as_str(),
|
||||
) {
|
||||
@@ -222,21 +222,21 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute(
|
||||
if let std::result::Result::Err(error) = execution_request.validate() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtRiskMaterializer),
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(ks_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtRiskMaterializer),
|
||||
];
|
||||
let observer = crate::DemoExecutionMetadataObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_token_metadata(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_token_metadata(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -290,7 +290,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute(
|
||||
);
|
||||
}
|
||||
|
||||
fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::Value {
|
||||
fn backfill_summary_json(summary: &ks_pipeline::BackfillSummary) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"captureSessionId": summary.capture_session_id,
|
||||
"filterCode": summary.filter_code,
|
||||
@@ -318,7 +318,7 @@ fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::
|
||||
});
|
||||
}
|
||||
|
||||
fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> serde_json::Value {
|
||||
fn core_extraction_summary_json(summary: &ks_pipeline::CoreExtractionSummary) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"processorVersion": summary.processor_version,
|
||||
"selected": summary.selected,
|
||||
@@ -335,7 +335,7 @@ fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) ->
|
||||
});
|
||||
}
|
||||
|
||||
fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
fn decode_replay_summary_json(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
let processors = summary
|
||||
.processors
|
||||
.iter()
|
||||
@@ -375,7 +375,7 @@ fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> ser
|
||||
fn parse_stateful_reads(
|
||||
value: &str,
|
||||
) -> std::result::Result<
|
||||
std::vec::Vec<kb_pipeline::MetaplexTokenMetadataStatefulReadRequest>,
|
||||
std::vec::Vec<ks_pipeline::MetaplexTokenMetadataStatefulReadRequest>,
|
||||
std::string::String,
|
||||
> {
|
||||
if value.trim().is_empty() {
|
||||
@@ -400,7 +400,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_crea
|
||||
return prepare_create_fixture_for_family(
|
||||
state,
|
||||
profile_name,
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_crea
|
||||
async fn prepare_create_fixture_for_family(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
profile_name: std::string::String,
|
||||
asset_family: kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily,
|
||||
asset_family: ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily,
|
||||
) -> std::result::Result<
|
||||
crate::DemoExecutionMetadataMetaplexTokenMetadataCreateFixturePayload,
|
||||
std::string::String,
|
||||
@@ -423,15 +423,15 @@ async fn prepare_create_fixture_for_family(
|
||||
} else {
|
||||
crate::workspace_root_dir().join(configured)
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let options =
|
||||
kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir)
|
||||
ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir)
|
||||
.with_asset_family(asset_family);
|
||||
let summary = match kb_pipeline_demo_scenarios::prepare_metaplex_create_fixture(
|
||||
let summary = match ks_pipeline_demo_scenarios::prepare_metaplex_create_fixture(
|
||||
&http_pool,
|
||||
&profile,
|
||||
workspace_root.as_path(),
|
||||
@@ -465,7 +465,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step
|
||||
crate::DemoExecutionMetadataMetaplexTokenMetadataPreparedStepPayload,
|
||||
std::string::String,
|
||||
> {
|
||||
let scenario = kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios()
|
||||
let scenario = ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios()
|
||||
.into_iter()
|
||||
.find(|candidate| return candidate.id == scenario_id);
|
||||
let scenario = match scenario {
|
||||
@@ -566,7 +566,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step
|
||||
std::option::Option::None => std::string::String::new(),
|
||||
};
|
||||
let immutable_transition = scenario.asset_family
|
||||
== kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
== ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
&& step_index == 2;
|
||||
let value = serde_json::json!({
|
||||
"operation": "update_as_update_authority_v2",
|
||||
@@ -633,9 +633,9 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step
|
||||
};
|
||||
let create_reads_edition = matches!(
|
||||
scenario.asset_family,
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
| kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection
|
||||
| kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
| ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection
|
||||
| ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft
|
||||
);
|
||||
let postcondition_reads = if operation == "create" && create_reads_edition {
|
||||
serde_json::json!([metadata_read, edition_read])
|
||||
@@ -648,7 +648,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step
|
||||
step_index,
|
||||
operation: operation.clone(),
|
||||
label: if scenario.asset_family
|
||||
== kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
== ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft
|
||||
&& step_index == 2
|
||||
{
|
||||
"Étape 3 — rendre les metadata immutables".to_string()
|
||||
@@ -668,7 +668,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step
|
||||
/// Returns current operation names accepted by automatic Devnet campaigns.
|
||||
pub(crate) fn demo_execution_metadata_metaplex_token_metadata_current_operations()
|
||||
-> std::vec::Vec<std::string::String> {
|
||||
return kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names()
|
||||
return ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names()
|
||||
.iter()
|
||||
.map(|value| return (*value).to_string())
|
||||
.collect();
|
||||
@@ -678,7 +678,7 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_current_operations
|
||||
pub(crate) fn demo_execution_metadata_metaplex_token_metadata_operation_template(
|
||||
operation: std::string::String,
|
||||
) -> std::result::Result<std::string::String, std::string::String> {
|
||||
return match kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template(
|
||||
return match ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template(
|
||||
operation.as_str(),
|
||||
) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
@@ -691,7 +691,7 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std
|
||||
std::vec::Vec<crate::DemoExecutionMetadataMetaplexTokenMetadataScenarioPayload>,
|
||||
std::string::String,
|
||||
> {
|
||||
let matrix = match kb_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix()
|
||||
let matrix = match ks_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix()
|
||||
{
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -703,14 +703,14 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std
|
||||
.collect::<std::collections::BTreeMap<
|
||||
std::string::String,
|
||||
(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus,
|
||||
std::vec::Vec<std::string::String>,
|
||||
),
|
||||
>>();
|
||||
let mut payloads = std::vec::Vec::new();
|
||||
for scenario in kb_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios()
|
||||
for scenario in ks_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios()
|
||||
.into_iter()
|
||||
.chain(kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios())
|
||||
.chain(ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios())
|
||||
{
|
||||
let status = statuses.get(scenario.id.as_str());
|
||||
let validation_status = match status {
|
||||
@@ -742,74 +742,74 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std
|
||||
}
|
||||
|
||||
fn asset_family_code(
|
||||
value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily,
|
||||
value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily,
|
||||
) -> std::string::String {
|
||||
return match value {
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft => "nft".to_string(),
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft => "sft".to_string(),
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft => "nft".to_string(),
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft => "sft".to_string(),
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible => {
|
||||
"fungible".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection => {
|
||||
"collection".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft => {
|
||||
"programmable_nft".to_string()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn fixture_kind_code(
|
||||
value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureKind,
|
||||
value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureKind,
|
||||
) -> std::string::String {
|
||||
return format!("{value:?}").to_lowercase();
|
||||
}
|
||||
|
||||
fn fixture_state_code(
|
||||
value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureState,
|
||||
value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureState,
|
||||
) -> std::string::String {
|
||||
return format!("{value:?}").to_lowercase();
|
||||
}
|
||||
|
||||
fn scenario_mode_code(
|
||||
value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode,
|
||||
value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode,
|
||||
) -> std::string::String {
|
||||
return match value {
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::Synthetic => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::Synthetic => {
|
||||
"synthetic".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation => {
|
||||
"network_simulation".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSubmission => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSubmission => {
|
||||
"network_submission".to_string()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
fn validation_status_code(
|
||||
value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus,
|
||||
value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus,
|
||||
) -> std::string::String {
|
||||
return match value {
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::NotRun => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::NotRun => {
|
||||
"not_run".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::SyntheticValidated => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::SyntheticValidated => {
|
||||
"synthetic_validated".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Simulated => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Simulated => {
|
||||
"simulated".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Submitted => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Submitted => {
|
||||
"submitted".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Confirmed => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Confirmed => {
|
||||
"confirmed".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Unavailable => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Unavailable => {
|
||||
"unavailable".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Failed => {
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Failed => {
|
||||
"failed".to_string()
|
||||
},
|
||||
};
|
||||
@@ -895,7 +895,7 @@ struct CampaignProjection {
|
||||
|
||||
type CampaignProjectionFuture<'a> = std::pin::Pin<
|
||||
std::boxed::Box<
|
||||
dyn std::future::Future<Output = kb_core::Result<CampaignProjection>>
|
||||
dyn std::future::Future<Output = ks_core::Result<CampaignProjection>>
|
||||
+ std::marker::Send
|
||||
+ 'a,
|
||||
>,
|
||||
@@ -917,7 +917,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
label: label.to_string(),
|
||||
asset_family: family.to_string(),
|
||||
operation_names:
|
||||
kb_pipeline_demo_scenarios::metaplex_create_mint_campaign_operation_names()
|
||||
ks_pipeline_demo_scenarios::metaplex_create_mint_campaign_operation_names()
|
||||
.iter()
|
||||
.map(|value| return (*value).to_string())
|
||||
.collect(),
|
||||
@@ -930,7 +930,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"collection_verify",
|
||||
"Collection — Verify → Unverify",
|
||||
"collection",
|
||||
kb_pipeline_demo_scenarios::metaplex_collection_verify_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_collection_verify_campaign_operation_names(),
|
||||
"confirmed",
|
||||
"fresh collection parent + fresh unverified member",
|
||||
),
|
||||
@@ -938,7 +938,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"print_burn",
|
||||
"NFT imprimable — Print → Burn",
|
||||
"nft",
|
||||
kb_pipeline_demo_scenarios::metaplex_print_burn_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_print_burn_campaign_operation_names(),
|
||||
"confirmed",
|
||||
"fresh limited-supply master NFT + fresh printed edition",
|
||||
),
|
||||
@@ -946,7 +946,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"pnft_lifecycle",
|
||||
"pNFT — Delegate → Lock → Unlock → Revoke → Delegate → Transfer",
|
||||
"programmable_nft",
|
||||
kb_pipeline_demo_scenarios::metaplex_pnft_lifecycle_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_pnft_lifecycle_campaign_operation_names(),
|
||||
"confirmed",
|
||||
"fresh pNFT + delegate wallet + destination owner",
|
||||
),
|
||||
@@ -954,7 +954,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"escrow",
|
||||
"Token Owned Escrow — Create → TransferOut → Close",
|
||||
"nft",
|
||||
kb_pipeline_demo_scenarios::metaplex_escrow_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_escrow_campaign_operation_names(),
|
||||
"confirmed",
|
||||
"fresh NFT parent + fresh fungible attribute + escrow ATA deposit",
|
||||
),
|
||||
@@ -962,7 +962,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"maintenance",
|
||||
"Maintenance — Update + probes réservés/legacy",
|
||||
"nft",
|
||||
kb_pipeline_demo_scenarios::metaplex_maintenance_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_maintenance_campaign_operation_names(),
|
||||
"mixed_confirmed_unavailable",
|
||||
"fresh NFT; Update submitted; Resize/Migrate/Collect/CloseAccounts simulation-only probes",
|
||||
),
|
||||
@@ -970,7 +970,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns()
|
||||
"use_probe",
|
||||
"Use — probe runtime",
|
||||
"nft",
|
||||
kb_pipeline_demo_scenarios::metaplex_use_probe_operation_names(),
|
||||
ks_pipeline_demo_scenarios::metaplex_use_probe_operation_names(),
|
||||
"runtime_unavailable_probe",
|
||||
"fresh NFT with two bounded Multiple uses; Use is simulation-only when rejected",
|
||||
),
|
||||
@@ -1036,7 +1036,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_execute_campaign(
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -1131,19 +1131,19 @@ pub(crate) async fn demo_execution_metadata_metaplex_execute_campaign(
|
||||
fn execute_campaign_projection<'a, S, O>(
|
||||
campaign_id: &'a str,
|
||||
wallet_dir: std::path::PathBuf,
|
||||
http_pool: &'a kb_onchain_transport::HttpEndpointPool,
|
||||
http_pool: &'a ks_onchain_transport::HttpEndpointPool,
|
||||
store: &'a S,
|
||||
profile: &'a kb_config::ProfileConfig,
|
||||
profile: &'a ks_config::ProfileConfig,
|
||||
workspace_root: &'a std::path::Path,
|
||||
observer: &'a O,
|
||||
) -> CampaignProjectionFuture<'a>
|
||||
where
|
||||
S: kb_store::RawTransactionStore
|
||||
+ kb_store::CoreExtractionStore
|
||||
+ kb_store::DecodePipelineStore
|
||||
S: ks_store::RawTransactionStore
|
||||
+ ks_store::CoreExtractionStore
|
||||
+ ks_store::DecodePipelineStore
|
||||
+ Sync
|
||||
+ 'a,
|
||||
O: kb_pipeline_demo_scenarios::SolanaExecutionObserver + 'a,
|
||||
O: ks_pipeline_demo_scenarios::SolanaExecutionObserver + 'a,
|
||||
{
|
||||
return std::boxed::Box::pin(execute_campaign_projection_unboxed(
|
||||
campaign_id,
|
||||
@@ -1159,27 +1159,27 @@ where
|
||||
async fn execute_campaign_projection_unboxed<S, O>(
|
||||
campaign_id: &str,
|
||||
wallet_dir: std::path::PathBuf,
|
||||
http_pool: &kb_onchain_transport::HttpEndpointPool,
|
||||
http_pool: &ks_onchain_transport::HttpEndpointPool,
|
||||
store: &S,
|
||||
profile: &kb_config::ProfileConfig,
|
||||
profile: &ks_config::ProfileConfig,
|
||||
workspace_root: &std::path::Path,
|
||||
observer: &O,
|
||||
) -> kb_core::Result<CampaignProjection>
|
||||
) -> ks_core::Result<CampaignProjection>
|
||||
where
|
||||
S: kb_store::RawTransactionStore
|
||||
+ kb_store::CoreExtractionStore
|
||||
+ kb_store::DecodePipelineStore
|
||||
S: ks_store::RawTransactionStore
|
||||
+ ks_store::CoreExtractionStore
|
||||
+ ks_store::DecodePipelineStore
|
||||
+ Sync,
|
||||
O: kb_pipeline_demo_scenarios::SolanaExecutionObserver,
|
||||
O: ks_pipeline_demo_scenarios::SolanaExecutionObserver,
|
||||
{
|
||||
let base_options =
|
||||
kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir);
|
||||
ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir);
|
||||
return match campaign_id {
|
||||
"create_mint_nft" => {
|
||||
execute_create_mint_projection(
|
||||
"Create → Mint — NFT",
|
||||
base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
),
|
||||
http_pool,
|
||||
store,
|
||||
@@ -1193,7 +1193,7 @@ where
|
||||
execute_create_mint_projection(
|
||||
"Create → Mint — SFT",
|
||||
base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft,
|
||||
),
|
||||
http_pool,
|
||||
store,
|
||||
@@ -1207,7 +1207,7 @@ where
|
||||
execute_create_mint_projection(
|
||||
"Create → Mint — Fungible",
|
||||
base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible,
|
||||
),
|
||||
http_pool,
|
||||
store,
|
||||
@@ -1221,7 +1221,7 @@ where
|
||||
execute_create_mint_projection(
|
||||
"Create → Mint — Collection",
|
||||
base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection,
|
||||
),
|
||||
http_pool,
|
||||
store,
|
||||
@@ -1235,7 +1235,7 @@ where
|
||||
execute_create_mint_projection(
|
||||
"Create → Mint — pNFT",
|
||||
base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft,
|
||||
),
|
||||
http_pool,
|
||||
store,
|
||||
@@ -1246,7 +1246,7 @@ where
|
||||
.await
|
||||
},
|
||||
"collection_verify" => {
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_collection_verify_campaign(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_collection_verify_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1285,7 +1285,7 @@ where
|
||||
},
|
||||
"print_burn" => {
|
||||
let summary =
|
||||
match kb_pipeline_demo_scenarios::execute_devnet_metaplex_print_burn_campaign(
|
||||
match ks_pipeline_demo_scenarios::execute_devnet_metaplex_print_burn_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1324,10 +1324,10 @@ where
|
||||
},
|
||||
"pnft_lifecycle" => {
|
||||
let options = base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft,
|
||||
);
|
||||
let summary =
|
||||
match kb_pipeline_demo_scenarios::execute_devnet_metaplex_pnft_lifecycle_campaign(
|
||||
match ks_pipeline_demo_scenarios::execute_devnet_metaplex_pnft_lifecycle_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1361,7 +1361,7 @@ where
|
||||
})
|
||||
},
|
||||
"escrow" => {
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_escrow_campaign(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_escrow_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1407,10 +1407,10 @@ where
|
||||
},
|
||||
"maintenance" => {
|
||||
let options = base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
);
|
||||
let summary =
|
||||
match kb_pipeline_demo_scenarios::execute_devnet_metaplex_maintenance_campaign(
|
||||
match ks_pipeline_demo_scenarios::execute_devnet_metaplex_maintenance_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1463,9 +1463,9 @@ where
|
||||
},
|
||||
"use_probe" => {
|
||||
let options = base_options.clone().with_asset_family(
|
||||
kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft,
|
||||
);
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_use_probe(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_use_probe(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1501,7 +1501,7 @@ where
|
||||
}),
|
||||
})
|
||||
},
|
||||
_ => std::result::Result::Err(kb_core::Error::config(format!(
|
||||
_ => std::result::Result::Err(ks_core::Error::config(format!(
|
||||
"unknown qualified Metaplex desktop campaign `{campaign_id}`"
|
||||
))),
|
||||
};
|
||||
@@ -1509,21 +1509,21 @@ where
|
||||
|
||||
async fn execute_create_mint_projection<S, O>(
|
||||
label: &str,
|
||||
options: kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions,
|
||||
http_pool: &kb_onchain_transport::HttpEndpointPool,
|
||||
options: ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions,
|
||||
http_pool: &ks_onchain_transport::HttpEndpointPool,
|
||||
store: &S,
|
||||
profile: &kb_config::ProfileConfig,
|
||||
profile: &ks_config::ProfileConfig,
|
||||
workspace_root: &std::path::Path,
|
||||
observer: &O,
|
||||
) -> kb_core::Result<CampaignProjection>
|
||||
) -> ks_core::Result<CampaignProjection>
|
||||
where
|
||||
S: kb_store::RawTransactionStore
|
||||
+ kb_store::CoreExtractionStore
|
||||
+ kb_store::DecodePipelineStore
|
||||
S: ks_store::RawTransactionStore
|
||||
+ ks_store::CoreExtractionStore
|
||||
+ ks_store::DecodePipelineStore
|
||||
+ Sync,
|
||||
O: kb_pipeline_demo_scenarios::SolanaExecutionObserver,
|
||||
O: ks_pipeline_demo_scenarios::SolanaExecutionObserver,
|
||||
{
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_create_mint_campaign(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_create_mint_campaign(
|
||||
http_pool,
|
||||
store,
|
||||
profile,
|
||||
@@ -1554,7 +1554,7 @@ where
|
||||
|
||||
fn metaplex_execution_json(
|
||||
label: &str,
|
||||
summary: &kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionSummary,
|
||||
summary: &ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionSummary,
|
||||
) -> serde_json::Value {
|
||||
let classification = if execution_confirmation_is_confirmed(&summary.confirmation) {
|
||||
"confirmed"
|
||||
@@ -1594,13 +1594,13 @@ fn metaplex_execution_json(
|
||||
}
|
||||
|
||||
fn execution_confirmation_is_confirmed(
|
||||
confirmation: &std::option::Option<kb_lib::ExApiExecutionConfirmationResult>,
|
||||
confirmation: &std::option::Option<ks_lib::ExApiExecutionConfirmationResult>,
|
||||
) -> bool {
|
||||
return confirmation.as_ref().is_some_and(|value| {
|
||||
return matches!(
|
||||
value.status,
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| kb_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| ks_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1611,7 +1611,7 @@ fn execution_is_confirmed_json(value: &serde_json::Value) -> bool {
|
||||
}
|
||||
|
||||
fn create_mint_state_json(
|
||||
state: &kb_pipeline_demo_scenarios::DevnetMetaplexCreateMintTokenState,
|
||||
state: &ks_pipeline_demo_scenarios::DevnetMetaplexCreateMintTokenState,
|
||||
) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"expectedAmountRaw": state.expected_amount_raw,
|
||||
@@ -1625,7 +1625,7 @@ fn create_mint_state_json(
|
||||
}
|
||||
|
||||
fn print_burn_state_json(
|
||||
state: &kb_pipeline_demo_scenarios::DevnetMetaplexPrintBurnState,
|
||||
state: &ks_pipeline_demo_scenarios::DevnetMetaplexPrintBurnState,
|
||||
) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"editionNumber": state.edition_number,
|
||||
@@ -1648,7 +1648,7 @@ fn print_burn_state_json(
|
||||
}
|
||||
|
||||
fn pnft_state_json(
|
||||
state: &kb_pipeline_demo_scenarios::DevnetMetaplexPnftLifecycleState,
|
||||
state: &ks_pipeline_demo_scenarios::DevnetMetaplexPnftLifecycleState,
|
||||
) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"delegate": &state.delegate,
|
||||
@@ -1671,7 +1671,7 @@ fn pnft_state_json(
|
||||
}
|
||||
|
||||
fn escrow_state_json(
|
||||
state: &kb_pipeline_demo_scenarios::DevnetMetaplexEscrowCampaignState,
|
||||
state: &ks_pipeline_demo_scenarios::DevnetMetaplexEscrowCampaignState,
|
||||
) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"depositAmountRaw": state.deposit_amount_raw,
|
||||
@@ -1697,8 +1697,8 @@ mod tests {
|
||||
},
|
||||
};
|
||||
let expected_count =
|
||||
kb_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios().len()
|
||||
+ kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios().len();
|
||||
ks_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios().len()
|
||||
+ ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios().len();
|
||||
assert_eq!(payloads.len(), expected_count);
|
||||
assert!(payloads.iter().all(|payload| return !payload.operation_codes.is_empty()));
|
||||
assert!(payloads.iter().all(|payload| return payload.requires_postcondition));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Thin desktop adapter for complete Solana Program Metadata Devnet campaigns.
|
||||
|
||||
@@ -98,7 +98,7 @@ pub(crate) struct DemoExecutionMetadataSolanaProgramCampaignSummaryPayload {
|
||||
/// Returns the two canonical Solana Program Metadata Devnet journeys.
|
||||
pub(crate) fn demo_execution_metadata_solana_program_scenarios()
|
||||
-> std::vec::Vec<crate::DemoExecutionMetadataSolanaProgramScenarioPayload> {
|
||||
return kb_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios()
|
||||
return ks_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios()
|
||||
.into_iter()
|
||||
.map(|scenario| {
|
||||
return crate::DemoExecutionMetadataSolanaProgramScenarioPayload {
|
||||
@@ -159,19 +159,19 @@ pub(crate) async fn demo_execution_metadata_solana_program_execute_campaign(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let mut options =
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new();
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new();
|
||||
options.operator_confirmed = true;
|
||||
let observer = crate::DemoExecutionMetadataObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign(
|
||||
&http_pool,
|
||||
&profile,
|
||||
workspace_root.as_path(),
|
||||
@@ -187,7 +187,7 @@ pub(crate) async fn demo_execution_metadata_solana_program_execute_campaign(
|
||||
}
|
||||
|
||||
fn campaign_summary_payload(
|
||||
summary: kb_pipeline_demo_scenarios::DevnetSolanaProgramMetadataCampaignSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetSolanaProgramMetadataCampaignSummary,
|
||||
) -> crate::DemoExecutionMetadataSolanaProgramCampaignSummaryPayload {
|
||||
let mut confirmed_step_count = 0_usize;
|
||||
let mut materialized_snapshot_count = 0_usize;
|
||||
@@ -201,8 +201,8 @@ fn campaign_summary_payload(
|
||||
let confirmed = match step.execution.confirmation.as_ref() {
|
||||
std::option::Option::Some(value) => matches!(
|
||||
value.status,
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| kb_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| ks_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
),
|
||||
std::option::Option::None => false,
|
||||
};
|
||||
@@ -235,7 +235,7 @@ fn campaign_summary_payload(
|
||||
"materializedSnapshots": &step.execution.materialized_snapshots
|
||||
}));
|
||||
}
|
||||
let expected_step_count = kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len();
|
||||
let expected_step_count = ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len();
|
||||
let completed = summary.steps.len() == expected_step_count
|
||||
&& confirmed_step_count == expected_step_count
|
||||
&& summary.steps.iter().all(|step| {
|
||||
@@ -246,7 +246,7 @@ fn campaign_summary_payload(
|
||||
.find(|prepared| return prepared.step_id == step.step_id)
|
||||
{
|
||||
std::option::Option::Some(prepared) => {
|
||||
prepared.operation.operation_code() == kb_lib::EX_METADATA_SPM_CLOSE_OPERATION
|
||||
prepared.operation.operation_code() == ks_lib::EX_METADATA_SPM_CLOSE_OPERATION
|
||||
},
|
||||
std::option::Option::None => false,
|
||||
};
|
||||
@@ -285,22 +285,22 @@ fn campaign_summary_payload(
|
||||
}
|
||||
|
||||
fn fixture_state_code(
|
||||
value: kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState,
|
||||
value: ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState,
|
||||
) -> std::string::String {
|
||||
return match value {
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Prefunded => {
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Prefunded => {
|
||||
"prefunded".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Buffer => {
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Buffer => {
|
||||
"buffer".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::MutableMetadata => {
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::MutableMetadata => {
|
||||
"mutable_metadata".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::ImmutableMetadata => {
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::ImmutableMetadata => {
|
||||
"immutable_metadata".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Closed => {
|
||||
ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Closed => {
|
||||
"closed".to_string()
|
||||
},
|
||||
};
|
||||
@@ -314,11 +314,11 @@ mod tests {
|
||||
assert_eq!(payloads.len(), 2);
|
||||
assert_eq!(
|
||||
payloads.iter().map(|scenario| return scenario.steps.len()).sum::<usize>(),
|
||||
kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()
|
||||
ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()
|
||||
);
|
||||
assert!(payloads.iter().flat_map(|scenario| return scenario.steps.iter()).all(|step| {
|
||||
return !step.required_evidence.is_empty()
|
||||
&& kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES
|
||||
&& ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES
|
||||
.contains(&step.operation_code.as_str());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Thin desktop adapter for the complete Token-2022 Token Metadata Devnet campaign.
|
||||
|
||||
@@ -84,7 +84,7 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -103,13 +103,13 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign(
|
||||
workspace_root.join(configured_wallet_dir)
|
||||
};
|
||||
let mut options =
|
||||
kb_pipeline_demo_scenarios::Token2022MetadataFixturePreparationOptions::new(wallet_dir);
|
||||
ks_pipeline_demo_scenarios::Token2022MetadataFixturePreparationOptions::new(wallet_dir);
|
||||
options.operator_confirmed = true;
|
||||
let observer = crate::DemoExecutionMetadataObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_token_2022_metadata_campaign(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_token_2022_metadata_campaign(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -127,7 +127,7 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign(
|
||||
|
||||
fn campaign_summary_payload(
|
||||
profile_name: std::string::String,
|
||||
summary: kb_pipeline_demo_scenarios::DevnetToken2022MetadataCampaignSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetToken2022MetadataCampaignSummary,
|
||||
) -> crate::DemoExecutionMetadataToken2022CampaignSummaryPayload {
|
||||
let mut confirmed_step_count = 0_usize;
|
||||
let mut materialization_count = 0_usize;
|
||||
@@ -136,8 +136,8 @@ fn campaign_summary_payload(
|
||||
let confirmed = match step.execution.confirmation.as_ref() {
|
||||
std::option::Option::Some(value) => matches!(
|
||||
value.status,
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| kb_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Confirmed
|
||||
| ks_lib::ExApiExecutionConfirmationStatus::Finalized
|
||||
),
|
||||
std::option::Option::None => false,
|
||||
};
|
||||
@@ -161,12 +161,12 @@ fn campaign_summary_payload(
|
||||
}));
|
||||
}
|
||||
let expected_step_count =
|
||||
kb_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names().len();
|
||||
ks_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names().len();
|
||||
let completed = summary.steps.len() == expected_step_count
|
||||
&& confirmed_step_count == expected_step_count
|
||||
&& summary.steps.iter().all(|step| {
|
||||
return step.postcondition.status
|
||||
== kb_pipeline::Token2022ExecutionPostconditionStatus::Confirmed;
|
||||
== ks_pipeline::Token2022ExecutionPostconditionStatus::Confirmed;
|
||||
});
|
||||
let fixture_json = crate::pretty_json(&serde_json::json!({
|
||||
"mint": &summary.fixture.mint,
|
||||
@@ -198,7 +198,7 @@ mod tests {
|
||||
#[test]
|
||||
fn desktop_campaign_exposes_the_exact_five_token_metadata_operations() {
|
||||
assert_eq!(
|
||||
kb_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names(),
|
||||
ks_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names(),
|
||||
&[
|
||||
"initialize_token_metadata",
|
||||
"update_token_metadata_field",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_solana_core.rs
|
||||
// version: 13
|
||||
// version: 14
|
||||
|
||||
//! Tauri adapter for bounded Solana Core execution on Devnet.
|
||||
|
||||
@@ -290,8 +290,8 @@ impl crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) {
|
||||
impl ks_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -306,8 +306,8 @@ impl kb_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) {
|
||||
impl ks_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -322,8 +322,8 @@ impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObser
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) {
|
||||
impl ks_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserver<'_> {
|
||||
fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
event.level.code(),
|
||||
@@ -338,12 +338,12 @@ impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserve
|
||||
}
|
||||
}
|
||||
|
||||
impl kb_pipeline_demo_scenarios::SolanaExecutionObserver
|
||||
impl ks_pipeline_demo_scenarios::SolanaExecutionObserver
|
||||
for crate::DemoExecutionSolanaCoreObserver<'_>
|
||||
{
|
||||
fn on_execution_progress(
|
||||
&self,
|
||||
event: &kb_pipeline_demo_scenarios::SolanaExecutionProgressEvent,
|
||||
event: &ks_pipeline_demo_scenarios::SolanaExecutionProgressEvent,
|
||||
) {
|
||||
self.emit(
|
||||
event.timestamp.clone(),
|
||||
@@ -360,10 +360,10 @@ impl kb_pipeline_demo_scenarios::SolanaExecutionObserver
|
||||
}
|
||||
|
||||
pub(crate) fn select_devnet_profile(
|
||||
config: &kb_config::AppConfig,
|
||||
config: &ks_config::AppConfig,
|
||||
profile_name: &str,
|
||||
) -> std::result::Result<kb_config::ProfileConfig, std::string::String> {
|
||||
return kb_pipeline_demo_scenarios::resolve_demo_devnet_profile(
|
||||
) -> std::result::Result<ks_config::ProfileConfig, std::string::String> {
|
||||
return ks_pipeline_demo_scenarios::resolve_demo_devnet_profile(
|
||||
config,
|
||||
std::option::Option::Some(profile_name),
|
||||
)
|
||||
@@ -371,26 +371,26 @@ pub(crate) fn select_devnet_profile(
|
||||
}
|
||||
|
||||
pub(crate) fn execution_cluster_code(
|
||||
cluster: kb_lib::ExApiExecutionCluster,
|
||||
cluster: ks_lib::ExApiExecutionCluster,
|
||||
) -> std::string::String {
|
||||
return match cluster {
|
||||
kb_lib::ExApiExecutionCluster::Localnet => "localnet".to_string(),
|
||||
kb_lib::ExApiExecutionCluster::Devnet => "devnet".to_string(),
|
||||
kb_lib::ExApiExecutionCluster::Testnet => "testnet".to_string(),
|
||||
kb_lib::ExApiExecutionCluster::Mainnet => "mainnet".to_string(),
|
||||
ks_lib::ExApiExecutionCluster::Localnet => "localnet".to_string(),
|
||||
ks_lib::ExApiExecutionCluster::Devnet => "devnet".to_string(),
|
||||
ks_lib::ExApiExecutionCluster::Testnet => "testnet".to_string(),
|
||||
ks_lib::ExApiExecutionCluster::Mainnet => "mainnet".to_string(),
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) fn confirmation_status_code(
|
||||
status: kb_lib::ExApiExecutionConfirmationStatus,
|
||||
status: ks_lib::ExApiExecutionConfirmationStatus,
|
||||
) -> std::string::String {
|
||||
return match status {
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Processed => "processed".to_string(),
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Confirmed => "confirmed".to_string(),
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Finalized => "finalized".to_string(),
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Failed => "failed".to_string(),
|
||||
kb_lib::ExApiExecutionConfirmationStatus::Expired => "expired".to_string(),
|
||||
kb_lib::ExApiExecutionConfirmationStatus::TimedOut => "timed_out".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Processed => "processed".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Confirmed => "confirmed".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Finalized => "finalized".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Failed => "failed".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::Expired => "expired".to_string(),
|
||||
ks_lib::ExApiExecutionConfirmationStatus::TimedOut => "timed_out".to_string(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ pub(crate) async fn demo_execution_devnet_prepare_profile(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let readiness =
|
||||
match kb_pipeline_demo_scenarios::prepare_demo_devnet_profile_store(&profile).await {
|
||||
match ks_pipeline_demo_scenarios::prepare_demo_devnet_profile_store(&profile).await {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
@@ -433,11 +433,11 @@ pub(crate) fn demo_execution_solana_core_options(
|
||||
pub(crate) fn demo_execution_solana_core_generate_recipient()
|
||||
-> std::result::Result<crate::DemoExecutionSolanaCoreGeneratedRecipientPayload, std::string::String>
|
||||
{
|
||||
let alias = match kb_wallet::WalletAlias::parse("demo-devnet-recipient") {
|
||||
let alias = match ks_wallet::WalletAlias::parse("demo-devnet-recipient") {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let wallet = kb_wallet::TemporaryWallet::generate(alias);
|
||||
let wallet = ks_wallet::TemporaryWallet::generate(alias);
|
||||
return std::result::Result::Ok(crate::DemoExecutionSolanaCoreGeneratedRecipientPayload {
|
||||
public_key: wallet.public_key(),
|
||||
});
|
||||
@@ -469,7 +469,7 @@ pub(crate) async fn demo_execution_solana_core_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -481,9 +481,9 @@ pub(crate) async fn demo_execution_solana_core_execute(
|
||||
if let std::result::Result::Err(error) = initialize_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSystemTransferRequest::new(
|
||||
let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSystemTransferRequest::new(
|
||||
format!("demo-execution-{}", chrono::Utc::now().timestamp_micros()),
|
||||
kb_lib::MdPubkey(request.recipient.trim().to_string()),
|
||||
ks_lib::MdPubkey(request.recipient.trim().to_string()),
|
||||
request.lamports,
|
||||
);
|
||||
pipeline_request.airdrop_lamports = request.airdrop_lamports;
|
||||
@@ -492,15 +492,15 @@ pub(crate) async fn demo_execution_solana_core_execute(
|
||||
pipeline_request.post_validation_max_retries = 20;
|
||||
pipeline_request.force_post_validation_replay = request.force_post_validation_replay;
|
||||
pipeline_request.materialize_after_decode = request.materialize_after_decode;
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::DcSolanaCoreDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> =
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::DcSolanaCoreDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> =
|
||||
if request.materialize_after_decode {
|
||||
std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer,),
|
||||
std::sync::Arc::new(kb_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtStakingMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer,),
|
||||
std::sync::Arc::new(ks_lib::MtLifecycleMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtStakingMaterializer),
|
||||
]
|
||||
} else {
|
||||
std::vec::Vec::new()
|
||||
@@ -510,7 +510,7 @@ pub(crate) async fn demo_execution_solana_core_execute(
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_system_transfer(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_system_transfer(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -554,7 +554,7 @@ pub(crate) async fn demo_execution_spl_memo_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -565,7 +565,7 @@ pub(crate) async fn demo_execution_spl_memo_execute(
|
||||
if let std::result::Result::Err(error) = store.initialize_store_schema().await {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new(
|
||||
let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new(
|
||||
format!("demo-memo-execution-{}", chrono::Utc::now().timestamp_micros()),
|
||||
request.message,
|
||||
);
|
||||
@@ -574,16 +574,16 @@ pub(crate) async fn demo_execution_spl_memo_execute(
|
||||
pipeline_request.operator_confirmed = request.operator_confirmed;
|
||||
pipeline_request.post_validation_max_retries = 20;
|
||||
pipeline_request.force_post_validation_replay = request.force_post_validation_replay;
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::DcSplMemoDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer,)];
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::DcSplMemoDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer,)];
|
||||
let observer = crate::DemoExecutionSolanaCoreObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_memo(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_memo(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -616,7 +616,7 @@ pub(crate) fn demo_execution_solana_core_cancel(state: tauri::State<'_, crate::A
|
||||
}
|
||||
|
||||
fn devnet_profile_options(
|
||||
config: &kb_config::AppConfig,
|
||||
config: &ks_config::AppConfig,
|
||||
) -> std::vec::Vec<crate::DemoExecutionSolanaCoreProfileOption> {
|
||||
let mut output = std::vec::Vec::new();
|
||||
for profile in &config.profiles {
|
||||
@@ -639,7 +639,7 @@ fn devnet_profile_options(
|
||||
}
|
||||
|
||||
fn summary_payload(
|
||||
summary: kb_pipeline_demo_scenarios::DevnetSystemTransferSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetSystemTransferSummary,
|
||||
) -> crate::DemoExecutionSolanaCoreSummaryPayload {
|
||||
let plan_json = crate::pretty_json(&summary.plan);
|
||||
let simulation_json = crate::pretty_json(&summary.simulation);
|
||||
@@ -720,7 +720,7 @@ fn summary_payload(
|
||||
}
|
||||
|
||||
fn memo_summary_payload(
|
||||
summary: kb_pipeline_demo_scenarios::DevnetMemoExecutionSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetMemoExecutionSummary,
|
||||
) -> crate::DemoExecutionMemoSummaryPayload {
|
||||
let plan_json = crate::pretty_json(&summary.plan);
|
||||
let simulation_json = crate::pretty_json(&summary.simulation);
|
||||
@@ -851,7 +851,7 @@ mod tests {
|
||||
#[test]
|
||||
fn example_config_exposes_one_devnet_execution_profile() {
|
||||
let config =
|
||||
match kb_config::parse_config_json(include_str!("../../config/example.config.json")) {
|
||||
match ks_config::parse_config_json(include_str!("../../config/example.config.json")) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => panic!("example config parse failed: {error}"),
|
||||
};
|
||||
@@ -865,7 +865,7 @@ mod tests {
|
||||
#[test]
|
||||
fn profile_selection_rejects_mainnet_profiles() {
|
||||
let config =
|
||||
match kb_config::parse_config_json(include_str!("../../config/example.config.json")) {
|
||||
match ks_config::parse_config_json(include_str!("../../config/example.config.json")) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => panic!("example config parse failed: {error}"),
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_execution_spl.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
//! Dedicated Tauri window for bounded SPL execution on Devnet.
|
||||
|
||||
@@ -30,32 +30,32 @@ pub(crate) struct DevnetSplValidationScenarioPayload {
|
||||
/// Returns the complete ordered Devnet SPL validation inventory for milestone 0.4.6.
|
||||
pub(crate) fn demo_execution_spl_validation_scenarios()
|
||||
-> std::vec::Vec<crate::DevnetSplValidationScenarioPayload> {
|
||||
return kb_pipeline_demo_scenarios::devnet_spl_validation_scenarios()
|
||||
return ks_pipeline_demo_scenarios::devnet_spl_validation_scenarios()
|
||||
.into_iter()
|
||||
.map(|scenario| {
|
||||
return crate::DevnetSplValidationScenarioPayload {
|
||||
id: scenario.id,
|
||||
label: scenario.label,
|
||||
family: match scenario.family {
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Public => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Public => {
|
||||
"token_2022_public".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationFamily::ElGamalRegistry => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationFamily::ElGamalRegistry => {
|
||||
"elgamal_registry".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Confidential => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Confidential => {
|
||||
"token_2022_confidential".to_string()
|
||||
},
|
||||
},
|
||||
operation_code: scenario.operation_code,
|
||||
implementation_status: match scenario.implementation_status {
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::Executable => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::Executable => {
|
||||
"executable".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::BackendReady => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::BackendReady => {
|
||||
"backend_ready".to_string()
|
||||
},
|
||||
kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::ProofFixtureRequired => {
|
||||
ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::ProofFixtureRequired => {
|
||||
"proof_fixture_required".to_string()
|
||||
},
|
||||
},
|
||||
@@ -75,7 +75,7 @@ mod tests {
|
||||
profile_name: "local_devnet".to_string(),
|
||||
cluster: "devnet".to_string(),
|
||||
genesis_hash: "EtWTRABZaYq6iMfeYKouRu166VU2xqa1".to_string(),
|
||||
wallet_public_key: kb_program_ids::SYSTEM_PROGRAM_ID.to_string(),
|
||||
wallet_public_key: ks_program_ids::SYSTEM_PROGRAM_ID.to_string(),
|
||||
balance_lamports: u64::MAX.to_string(),
|
||||
fee_lamports: std::option::Option::Some(u64::MAX.to_string()),
|
||||
simulation_success: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_http.rs
|
||||
// version: 13
|
||||
// version: 14
|
||||
|
||||
//! HTTP JSON-RPC demo commands.
|
||||
|
||||
@@ -142,13 +142,13 @@ pub(crate) async fn demo_http_execute_request(
|
||||
std::result::Result::Ok(text) => text,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let method_class = kb_onchain_transport::HttpClient::classify_method(&method);
|
||||
let method_class = ks_onchain_transport::HttpClient::classify_method(&method);
|
||||
return std::result::Result::Ok(crate::DemoHttpExecutionPayload {
|
||||
endpoint_name: selected_client.endpoint_name().to_string(),
|
||||
provider: selected_client.provider().to_string(),
|
||||
endpoint_url: selected_client.endpoint_url().to_string(),
|
||||
role,
|
||||
request_kind: kb_onchain_transport::request_kind_from_method(&method),
|
||||
request_kind: ks_onchain_transport::request_kind_from_method(&method),
|
||||
method,
|
||||
method_class: method_class_to_string(method_class).to_string(),
|
||||
response_json,
|
||||
@@ -157,7 +157,7 @@ pub(crate) async fn demo_http_execute_request(
|
||||
|
||||
pub(crate) fn demo_http_list_pool_clients(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::vec::Vec<kb_onchain_transport::HttpPoolClientSnapshot> {
|
||||
) -> std::vec::Vec<ks_onchain_transport::HttpPoolClientSnapshot> {
|
||||
return state.http_pool().snapshot();
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ pub(crate) fn demo_http_options(
|
||||
}
|
||||
|
||||
fn build_http_role_options(
|
||||
snapshots: std::vec::Vec<kb_onchain_transport::HttpPoolClientSnapshot>,
|
||||
snapshots: std::vec::Vec<ks_onchain_transport::HttpPoolClientSnapshot>,
|
||||
) -> std::vec::Vec<crate::DemoHttpRoleOption> {
|
||||
let mut roles = std::collections::BTreeMap::<
|
||||
std::string::String,
|
||||
@@ -256,7 +256,7 @@ fn build_http_method_options() -> std::vec::Vec<crate::DemoHttpMethodOption> {
|
||||
for (method, label, requires_first_arg, supports_config_json) in methods {
|
||||
options.push(crate::DemoHttpMethodOption {
|
||||
method: method.to_string(),
|
||||
request_kind: kb_onchain_transport::request_kind_from_method(method),
|
||||
request_kind: ks_onchain_transport::request_kind_from_method(method),
|
||||
label: label.to_string(),
|
||||
requires_first_arg,
|
||||
supports_config_json,
|
||||
@@ -367,11 +367,11 @@ fn parse_optional_params_json(
|
||||
return std::result::Result::Ok(std::option::Option::Some(array));
|
||||
}
|
||||
|
||||
fn method_class_to_string(method_class: kb_onchain_transport::HttpMethodClass) -> &'static str {
|
||||
fn method_class_to_string(method_class: ks_onchain_transport::HttpMethodClass) -> &'static str {
|
||||
return match method_class {
|
||||
kb_onchain_transport::HttpMethodClass::GeneralRpc => "GeneralRpc",
|
||||
kb_onchain_transport::HttpMethodClass::SendTransaction => "SendTransaction",
|
||||
kb_onchain_transport::HttpMethodClass::HeavyRead => "HeavyRead",
|
||||
ks_onchain_transport::HttpMethodClass::GeneralRpc => "GeneralRpc",
|
||||
ks_onchain_transport::HttpMethodClass::SendTransaction => "SendTransaction",
|
||||
ks_onchain_transport::HttpMethodClass::HeavyRead => "HeavyRead",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ mod tests {
|
||||
assert!(names.insert(option.method.as_str()));
|
||||
assert_eq!(
|
||||
option.request_kind,
|
||||
kb_onchain_transport::request_kind_from_method(option.method.as_str())
|
||||
ks_onchain_transport::request_kind_from_method(option.method.as_str())
|
||||
);
|
||||
}
|
||||
assert!(!options.is_empty());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_spl_ata.rs
|
||||
// version: 12
|
||||
// version: 13
|
||||
|
||||
//! Thin Tauri adapter for ATA execution, derivation and lifecycle journal reads.
|
||||
|
||||
@@ -228,15 +228,15 @@ pub(crate) async fn demo_execution_spl_ata_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let wallet_owner = kb_lib::MdPubkey(request.wallet_owner.trim().to_string());
|
||||
let mint = kb_lib::MdPubkey(request.mint.trim().to_string());
|
||||
let wallet_owner = ks_lib::MdPubkey(request.wallet_owner.trim().to_string());
|
||||
let mint = ks_lib::MdPubkey(request.mint.trim().to_string());
|
||||
let operation = match request.mode.as_str() {
|
||||
"create" => kb_lib::ExSplAssociatedTokenAccountOperation::Create {
|
||||
"create" => ks_lib::ExSplAssociatedTokenAccountOperation::Create {
|
||||
wallet_owner,
|
||||
mint,
|
||||
token_program,
|
||||
},
|
||||
"create_idempotent" => kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent {
|
||||
"create_idempotent" => ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent {
|
||||
wallet_owner,
|
||||
mint,
|
||||
token_program,
|
||||
@@ -248,7 +248,7 @@ pub(crate) async fn demo_execution_spl_ata_execute(
|
||||
},
|
||||
};
|
||||
let mut pipeline_request =
|
||||
kb_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionRequest::new(
|
||||
ks_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionRequest::new(
|
||||
format!("demo-spl-ata-execution-{}", chrono::Utc::now().timestamp_micros()),
|
||||
operation,
|
||||
);
|
||||
@@ -256,7 +256,7 @@ pub(crate) async fn demo_execution_spl_ata_execute(
|
||||
pipeline_request.operator_confirmed = request.operator_confirmed;
|
||||
pipeline_request.post_validation_max_retries = 20;
|
||||
pipeline_request.force_post_validation_replay = request.force_post_validation_replay;
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -267,19 +267,19 @@ pub(crate) async fn demo_execution_spl_ata_execute(
|
||||
if let std::result::Result::Err(error) = store.initialize_store_schema().await {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> = std::vec![
|
||||
std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder),
|
||||
std::sync::Arc::new(kb_lib::DcSplTokenDecoder),
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> = std::vec![
|
||||
std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder),
|
||||
std::sync::Arc::new(ks_lib::DcSplTokenDecoder),
|
||||
];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtRiskMaterializer),
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtRiskMaterializer),
|
||||
];
|
||||
let observer = crate::DemoExecutionSolanaCoreObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_associated_token_account(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_associated_token_account(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -314,7 +314,7 @@ pub(crate) async fn demo_spl_ata_journal(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let filter = match kb_store::MaterializedEventFilter::new(
|
||||
let filter = match ks_store::MaterializedEventFilter::new(
|
||||
std::option::Option::Some("materializer.token.accounts".to_string()),
|
||||
std::option::Option::None,
|
||||
request.signature_contains.clone(),
|
||||
@@ -323,7 +323,7 @@ pub(crate) async fn demo_spl_ata_journal(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let rows = match kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await
|
||||
let rows = match ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await
|
||||
{
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -344,19 +344,19 @@ pub(crate) async fn demo_spl_ata_journal(
|
||||
}
|
||||
|
||||
async fn load_profile_wallet(
|
||||
profile: &kb_config::ProfileConfig,
|
||||
) -> std::result::Result<kb_wallet::TemporaryWallet, std::string::String> {
|
||||
profile: &ks_config::ProfileConfig,
|
||||
) -> std::result::Result<ks_wallet::TemporaryWallet, std::string::String> {
|
||||
let configured = std::path::PathBuf::from(profile.wallet.wallet_dir.as_str());
|
||||
let directory = if configured.is_absolute() {
|
||||
configured
|
||||
} else {
|
||||
crate::workspace_root_dir().join(configured)
|
||||
};
|
||||
let store = match kb_wallet::TemporaryWalletStore::new(directory) {
|
||||
let store = match ks_wallet::TemporaryWalletStore::new(directory) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let alias = match kb_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) {
|
||||
let alias = match ks_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -368,10 +368,10 @@ async fn load_profile_wallet(
|
||||
|
||||
fn parse_token_program(
|
||||
value: &str,
|
||||
) -> std::result::Result<kb_lib::ExSplAssociatedTokenProgram, std::string::String> {
|
||||
) -> std::result::Result<ks_lib::ExSplAssociatedTokenProgram, std::string::String> {
|
||||
return match value.trim() {
|
||||
"classic" => std::result::Result::Ok(kb_lib::ExSplAssociatedTokenProgram::Classic),
|
||||
"token_2022" => std::result::Result::Ok(kb_lib::ExSplAssociatedTokenProgram::Token2022),
|
||||
"classic" => std::result::Result::Ok(ks_lib::ExSplAssociatedTokenProgram::Classic),
|
||||
"token_2022" => std::result::Result::Ok(ks_lib::ExSplAssociatedTokenProgram::Token2022),
|
||||
_ => std::result::Result::Err("Token Program must be classic or token_2022".to_string()),
|
||||
};
|
||||
}
|
||||
@@ -410,7 +410,7 @@ fn derive_ata(
|
||||
}
|
||||
|
||||
fn summary_payload(
|
||||
summary: kb_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionSummary,
|
||||
) -> crate::DemoExecutionSplAtaSummaryPayload {
|
||||
let (associated_token_account, token_program_id) = match summary.plan.instructions.first() {
|
||||
std::option::Option::Some(instruction) => {
|
||||
@@ -522,10 +522,10 @@ fn summary_payload(
|
||||
balance_lamports: summary.balance_lamports.to_string(),
|
||||
fee_lamports: summary.fee.fee_lamports.map(|value| return value.to_string()),
|
||||
readiness_status: match summary.stateful_readiness.status {
|
||||
kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready => {
|
||||
ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready => {
|
||||
"ready".to_string()
|
||||
},
|
||||
kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Blocked => {
|
||||
ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Blocked => {
|
||||
"blocked".to_string()
|
||||
},
|
||||
},
|
||||
@@ -558,7 +558,7 @@ fn journal_matches(payload: &serde_json::Value, request: &crate::DemoSplAtaJourn
|
||||
return true;
|
||||
}
|
||||
|
||||
fn journal_row(row: kb_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJournalRow {
|
||||
fn journal_row(row: ks_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJournalRow {
|
||||
let text = |key: &str| {
|
||||
return row
|
||||
.payload_json
|
||||
@@ -585,11 +585,11 @@ fn journal_row(row: kb_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJou
|
||||
mod tests {
|
||||
#[test]
|
||||
fn classic_and_token_2022_derivations_are_distinct_and_canonical() {
|
||||
let wallet = kb_program_ids::SYSTEM_PROGRAM_ID;
|
||||
let wallet = ks_program_ids::SYSTEM_PROGRAM_ID;
|
||||
let mint = "So11111111111111111111111111111111111111112";
|
||||
let classic = super::derive_ata(wallet, mint, kb_program_ids::SPL_TOKEN_PROGRAM_ID)
|
||||
let classic = super::derive_ata(wallet, mint, ks_program_ids::SPL_TOKEN_PROGRAM_ID)
|
||||
.unwrap_or_else(|error| panic!("classic derivation failed: {error}"));
|
||||
let token_2022 = super::derive_ata(wallet, mint, kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID)
|
||||
let token_2022 = super::derive_ata(wallet, mint, ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID)
|
||||
.unwrap_or_else(|error| panic!("Token-2022 derivation failed: {error}"));
|
||||
assert_eq!(classic, "aqxoAhCwpy3oB1BpNw9hL1HdLYLgPpbPjzxDrrQj3Fs");
|
||||
assert_eq!(token_2022, "2sZUUBGq1i6aE47ZoxCaCW89jmYm2EXLPPmNMgMDXHMS");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_spl_token.rs
|
||||
// version: 9
|
||||
// version: 10
|
||||
|
||||
//! Thin Tauri adapter for classic SPL Token execution and materialized journals.
|
||||
|
||||
@@ -179,7 +179,7 @@ pub(crate) async fn demo_execution_spl_token_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -191,20 +191,20 @@ pub(crate) async fn demo_execution_spl_token_execute(
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
let amount_raw = request.amount_raw.trim().to_string();
|
||||
let operation = kb_lib::ExSplClassicTokenOperation::Instruction {
|
||||
value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked {
|
||||
source: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: kb_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
authority: kb_lib::ExSplClassicTokenAuthority {
|
||||
authority: kb_lib::MdPubkey(request.authority.trim().to_string()),
|
||||
let operation = ks_lib::ExSplClassicTokenOperation::Instruction {
|
||||
value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked {
|
||||
source: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: ks_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
authority: ks_lib::ExSplClassicTokenAuthority {
|
||||
authority: ks_lib::MdPubkey(request.authority.trim().to_string()),
|
||||
multisig_signers: std::vec::Vec::new(),
|
||||
},
|
||||
amount: kb_lib::ExSplClassicTokenAmount(amount_raw.clone()),
|
||||
amount: ks_lib::ExSplClassicTokenAmount(amount_raw.clone()),
|
||||
decimals: request.decimals,
|
||||
},
|
||||
};
|
||||
let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSplTokenExecutionRequest::new(
|
||||
let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSplTokenExecutionRequest::new(
|
||||
format!("demo-spl-token-execution-{}", chrono::Utc::now().timestamp_micros()),
|
||||
operation,
|
||||
);
|
||||
@@ -212,19 +212,19 @@ pub(crate) async fn demo_execution_spl_token_execute(
|
||||
pipeline_request.operator_confirmed = request.operator_confirmed;
|
||||
pipeline_request.post_validation_max_retries = 20;
|
||||
pipeline_request.force_post_validation_replay = request.force_post_validation_replay;
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::DcSplTokenDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtRiskMaterializer),
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::DcSplTokenDecoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtRiskMaterializer),
|
||||
];
|
||||
let observer = crate::DemoExecutionSolanaCoreObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_token(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_token(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -266,11 +266,11 @@ pub(crate) async fn demo_spl_token_journal(
|
||||
let needs_payload_filter =
|
||||
validated.mint.is_some() || validated.account.is_some() || validated.operation.is_some();
|
||||
let query_limit = if needs_payload_filter {
|
||||
kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS
|
||||
ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS
|
||||
} else {
|
||||
validated.limit
|
||||
};
|
||||
let filter = match kb_store::MaterializedEventFilter::new(
|
||||
let filter = match ks_store::MaterializedEventFilter::new(
|
||||
std::option::Option::None,
|
||||
validated.family.clone(),
|
||||
validated.signature_contains.clone(),
|
||||
@@ -279,7 +279,7 @@ pub(crate) async fn demo_spl_token_journal(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let rows = match kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await
|
||||
let rows = match ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await
|
||||
{
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -299,7 +299,7 @@ pub(crate) async fn demo_spl_token_journal(
|
||||
}
|
||||
|
||||
fn summary_payload(
|
||||
summary: kb_pipeline_demo_scenarios::DevnetSplTokenExecutionSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetSplTokenExecutionSummary,
|
||||
amount_raw: std::string::String,
|
||||
decimals: u8,
|
||||
) -> crate::DemoExecutionSplTokenSummaryPayload {
|
||||
@@ -370,8 +370,8 @@ fn summary_payload(
|
||||
amount_raw,
|
||||
decimals,
|
||||
readiness_status: match summary.stateful_readiness.status {
|
||||
kb_pipeline::SplTokenStatefulReadinessStatus::Ready => "ready".to_string(),
|
||||
kb_pipeline::SplTokenStatefulReadinessStatus::Blocked => "blocked".to_string(),
|
||||
ks_pipeline::SplTokenStatefulReadinessStatus::Ready => "ready".to_string(),
|
||||
ks_pipeline::SplTokenStatefulReadinessStatus::Blocked => "blocked".to_string(),
|
||||
},
|
||||
simulation_success: summary.simulation.success,
|
||||
simulation_error: summary.simulation.error,
|
||||
@@ -389,7 +389,7 @@ fn summary_payload(
|
||||
};
|
||||
}
|
||||
|
||||
fn replay_diagnostics(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
fn replay_diagnostics(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"campaignId": summary.campaign_id,
|
||||
"selected": summary.selected,
|
||||
@@ -415,10 +415,10 @@ fn replay_diagnostics(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json:
|
||||
fn validate_journal_request(
|
||||
request: crate::DemoSplTokenJournalRequest,
|
||||
) -> std::result::Result<crate::DemoSplTokenJournalRequest, std::string::String> {
|
||||
if request.limit == 0 || request.limit > kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS {
|
||||
if request.limit == 0 || request.limit > ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS {
|
||||
return std::result::Result::Err(format!(
|
||||
"journal limit must be between 1 and {}",
|
||||
kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS
|
||||
ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS
|
||||
));
|
||||
}
|
||||
if request.profile_name.trim().is_empty() {
|
||||
@@ -499,7 +499,7 @@ fn payload_matches(
|
||||
return true;
|
||||
}
|
||||
|
||||
fn journal_row(row: kb_store::MaterializedEventQueryRow) -> DemoSplTokenJournalRow {
|
||||
fn journal_row(row: ks_store::MaterializedEventQueryRow) -> DemoSplTokenJournalRow {
|
||||
let operation = row
|
||||
.payload_json
|
||||
.get("operation")
|
||||
@@ -605,7 +605,7 @@ mod tests {
|
||||
payload.get("amountRaw").and_then(serde_json::Value::as_str),
|
||||
std::option::Option::Some("18446744073709551615")
|
||||
);
|
||||
let row = super::journal_row(kb_store::MaterializedEventQueryRow {
|
||||
let row = super::journal_row(ks_store::MaterializedEventQueryRow {
|
||||
processor_name: "materializer.token.accounts".to_string(),
|
||||
processor_version: "0.4.4".to_string(),
|
||||
input_key: "input".to_string(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_spl_token_2022.rs
|
||||
// version: 12
|
||||
// version: 13
|
||||
|
||||
//! Thin Tauri adapter for independent public Token-2022 Devnet validation scenarios.
|
||||
|
||||
@@ -157,7 +157,7 @@ pub(crate) async fn demo_execution_spl_token_2022_execute(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
@@ -173,7 +173,7 @@ pub(crate) async fn demo_execution_spl_token_2022_execute(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let operation_code = operation.operation_code().to_string();
|
||||
let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest::new(
|
||||
let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest::new(
|
||||
format!("demo-spl-token-2022-execution-{}", chrono::Utc::now().timestamp_micros()),
|
||||
operation,
|
||||
);
|
||||
@@ -181,21 +181,21 @@ pub(crate) async fn demo_execution_spl_token_2022_execute(
|
||||
pipeline_request.operator_confirmed = request.operator_confirmed;
|
||||
pipeline_request.post_validation_max_retries = 20;
|
||||
pipeline_request.force_post_validation_replay = request.force_post_validation_replay;
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn kb_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(kb_lib::DcSplToken2022Decoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn kb_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtRiskMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtFeesMaterializer),
|
||||
std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer),
|
||||
let decoders: std::vec::Vec<std::sync::Arc<dyn ks_lib::DcApiInstructionDecoder>> =
|
||||
std::vec![std::sync::Arc::new(ks_lib::DcSplToken2022Decoder)];
|
||||
let materializers: std::vec::Vec<std::sync::Arc<dyn ks_lib::MtApiEventMaterializer>> = std::vec![
|
||||
std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtAdminMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtRiskMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtFeesMaterializer),
|
||||
std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer),
|
||||
];
|
||||
let observer = crate::DemoExecutionSolanaCoreObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_execution_solana_core_cancel_requested(),
|
||||
};
|
||||
let workspace_root = crate::workspace_root_dir();
|
||||
let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_token_2022(
|
||||
let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_token_2022(
|
||||
&http_pool,
|
||||
&store,
|
||||
&profile,
|
||||
@@ -321,63 +321,63 @@ pub(crate) fn demo_spl_token_2022_fixture(
|
||||
|
||||
fn operation_from_request(
|
||||
request: &crate::DemoExecutionSplToken2022Request,
|
||||
) -> std::result::Result<kb_lib::ExSplToken2022Operation, std::string::String> {
|
||||
let authority = kb_lib::ExSplTokenAuthority {
|
||||
authority: kb_lib::MdPubkey(request.authority.trim().to_string()),
|
||||
) -> std::result::Result<ks_lib::ExSplToken2022Operation, std::string::String> {
|
||||
let authority = ks_lib::ExSplTokenAuthority {
|
||||
authority: ks_lib::MdPubkey(request.authority.trim().to_string()),
|
||||
multisig_signers: std::vec::Vec::new(),
|
||||
};
|
||||
let freeze_authority = kb_lib::ExSplTokenAuthority {
|
||||
authority: kb_lib::MdPubkey(request.freeze_authority.trim().to_string()),
|
||||
let freeze_authority = ks_lib::ExSplTokenAuthority {
|
||||
authority: ks_lib::MdPubkey(request.freeze_authority.trim().to_string()),
|
||||
multisig_signers: std::vec::Vec::new(),
|
||||
};
|
||||
let value = match request.scenario_id.trim() {
|
||||
"token_2022_mint_to_checked" => kb_lib::ExSplTokenSingleOperation::MintToChecked {
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
"token_2022_mint_to_checked" => ks_lib::ExSplTokenSingleOperation::MintToChecked {
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
authority,
|
||||
amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
decimals: request.decimals,
|
||||
},
|
||||
"token_2022_transfer_checked" => kb_lib::ExSplTokenSingleOperation::TransferChecked {
|
||||
source: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: kb_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
"token_2022_transfer_checked" => ks_lib::ExSplTokenSingleOperation::TransferChecked {
|
||||
source: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
destination: ks_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
authority,
|
||||
amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
decimals: request.decimals,
|
||||
},
|
||||
"token_2022_approve_checked" => kb_lib::ExSplTokenSingleOperation::ApproveChecked {
|
||||
source: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
delegate: kb_lib::MdPubkey(request.delegate.trim().to_string()),
|
||||
"token_2022_approve_checked" => ks_lib::ExSplTokenSingleOperation::ApproveChecked {
|
||||
source: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
delegate: ks_lib::MdPubkey(request.delegate.trim().to_string()),
|
||||
authority,
|
||||
amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
decimals: request.decimals,
|
||||
},
|
||||
"token_2022_revoke" => kb_lib::ExSplTokenSingleOperation::Revoke {
|
||||
source: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
"token_2022_revoke" => ks_lib::ExSplTokenSingleOperation::Revoke {
|
||||
source: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
authority,
|
||||
},
|
||||
"token_2022_burn_checked" => kb_lib::ExSplTokenSingleOperation::BurnChecked {
|
||||
source: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
"token_2022_burn_checked" => ks_lib::ExSplTokenSingleOperation::BurnChecked {
|
||||
source: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
authority,
|
||||
amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()),
|
||||
decimals: request.decimals,
|
||||
},
|
||||
"token_2022_freeze_account" => kb_lib::ExSplTokenSingleOperation::FreezeAccount {
|
||||
account: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
"token_2022_freeze_account" => ks_lib::ExSplTokenSingleOperation::FreezeAccount {
|
||||
account: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
authority: freeze_authority,
|
||||
},
|
||||
"token_2022_thaw_account" => kb_lib::ExSplTokenSingleOperation::ThawAccount {
|
||||
account: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: kb_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
"token_2022_thaw_account" => ks_lib::ExSplTokenSingleOperation::ThawAccount {
|
||||
account: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
mint: ks_lib::MdPubkey(request.mint.trim().to_string()),
|
||||
authority: freeze_authority,
|
||||
},
|
||||
"token_2022_close_destination" => kb_lib::ExSplTokenSingleOperation::CloseAccount {
|
||||
account: kb_lib::MdPubkey(request.source.trim().to_string()),
|
||||
destination: kb_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
"token_2022_close_destination" => ks_lib::ExSplTokenSingleOperation::CloseAccount {
|
||||
account: ks_lib::MdPubkey(request.source.trim().to_string()),
|
||||
destination: ks_lib::MdPubkey(request.destination.trim().to_string()),
|
||||
authority,
|
||||
},
|
||||
other => {
|
||||
@@ -386,7 +386,7 @@ fn operation_from_request(
|
||||
));
|
||||
},
|
||||
};
|
||||
return std::result::Result::Ok(kb_lib::ExSplToken2022Operation::Instruction {
|
||||
return std::result::Result::Ok(ks_lib::ExSplToken2022Operation::Instruction {
|
||||
value: std::boxed::Box::new(value),
|
||||
});
|
||||
}
|
||||
@@ -394,7 +394,7 @@ fn operation_from_request(
|
||||
fn summary_payload(
|
||||
scenario_id: std::string::String,
|
||||
operation: std::string::String,
|
||||
summary: kb_pipeline_demo_scenarios::DevnetSplToken2022ExecutionSummary,
|
||||
summary: ks_pipeline_demo_scenarios::DevnetSplToken2022ExecutionSummary,
|
||||
) -> crate::DemoExecutionSplToken2022SummaryPayload {
|
||||
let plan_json = crate::pretty_json(&summary.plan);
|
||||
let preflight_json = crate::pretty_json(&summary.stateful_preflight);
|
||||
@@ -477,7 +477,7 @@ fn parse_fixture(
|
||||
return values;
|
||||
}
|
||||
|
||||
fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::Value {
|
||||
fn backfill_summary_json(summary: &ks_pipeline::BackfillSummary) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"captureSessionId": summary.capture_session_id,
|
||||
"filterCode": summary.filter_code,
|
||||
@@ -505,7 +505,7 @@ fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::
|
||||
});
|
||||
}
|
||||
|
||||
fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> serde_json::Value {
|
||||
fn core_extraction_summary_json(summary: &ks_pipeline::CoreExtractionSummary) -> serde_json::Value {
|
||||
return serde_json::json!({
|
||||
"processorVersion": summary.processor_version,
|
||||
"selected": summary.selected,
|
||||
@@ -522,7 +522,7 @@ fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) ->
|
||||
});
|
||||
}
|
||||
|
||||
fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
fn decode_replay_summary_json(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value {
|
||||
let processors = summary
|
||||
.processors
|
||||
.iter()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_sql_common.rs
|
||||
// version: 12
|
||||
// version: 13
|
||||
|
||||
//! Shared SQL demo helpers and serializable payloads.
|
||||
|
||||
@@ -34,12 +34,12 @@ pub(crate) struct DemoSqlTableSnapshot {
|
||||
pub(crate) latest_created_at: std::option::Option<std::string::String>,
|
||||
}
|
||||
|
||||
/// Builds PostgreSQL options from the active profile without coupling kb-store to kb-config.
|
||||
/// Builds PostgreSQL options from the active profile without coupling ks-store to ks-config.
|
||||
pub(crate) fn postgres_store_options_from_profile(
|
||||
profile: &kb_config::ProfileConfig,
|
||||
profile: &ks_config::ProfileConfig,
|
||||
auto_initialize_schema: bool,
|
||||
) -> kb_core::Result<kb_store::PostgresStoreOptions> {
|
||||
return kb_store::PostgresStoreOptions::new(
|
||||
) -> ks_core::Result<ks_store::PostgresStoreOptions> {
|
||||
return ks_store::PostgresStoreOptions::new(
|
||||
profile.database.postgres.url.clone(),
|
||||
profile.database.postgres.max_connections,
|
||||
profile.database.postgres.connect_timeout_ms,
|
||||
@@ -49,8 +49,8 @@ pub(crate) fn postgres_store_options_from_profile(
|
||||
|
||||
/// Connects to PostgreSQL without reapplying schemas initialized at application startup.
|
||||
pub(crate) async fn connect_postgres_store(
|
||||
profile: &kb_config::ProfileConfig,
|
||||
) -> std::result::Result<kb_store::PostgresStore, std::string::String> {
|
||||
profile: &ks_config::ProfileConfig,
|
||||
) -> std::result::Result<ks_store::PostgresStore, std::string::String> {
|
||||
if !profile.database.enabled {
|
||||
return std::result::Result::Err(std::string::String::from(
|
||||
"database configuration is disabled in the active profile",
|
||||
@@ -62,7 +62,7 @@ pub(crate) async fn connect_postgres_store(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
options.auto_initialize_schema = false;
|
||||
let store_result = kb_store::PostgresStore::connect(options).await;
|
||||
let store_result = ks_store::PostgresStore::connect(options).await;
|
||||
return match store_result {
|
||||
std::result::Result::Ok(store) => std::result::Result::Ok(store),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
@@ -71,7 +71,7 @@ pub(crate) async fn connect_postgres_store(
|
||||
|
||||
/// Converts store table diagnostics to the UI payload shape.
|
||||
pub(crate) fn table_snapshot_from_pg(
|
||||
value: &kb_store::PostgresTableDiagnostics,
|
||||
value: &ks_store::PostgresTableDiagnostics,
|
||||
) -> crate::DemoSqlTableSnapshot {
|
||||
let row_count = match &value.statistics {
|
||||
std::option::Option::Some(statistics) => std::option::Option::Some(statistics.row_count),
|
||||
@@ -103,7 +103,7 @@ pub(crate) fn table_snapshot_from_pg(
|
||||
|
||||
/// Converts many table diagnostics to UI payloads.
|
||||
pub(crate) fn table_snapshots_from_pg(
|
||||
values: &[kb_store::PostgresTableDiagnostics],
|
||||
values: &[ks_store::PostgresTableDiagnostics],
|
||||
) -> std::vec::Vec<crate::DemoSqlTableSnapshot> {
|
||||
let mut output = std::vec::Vec::new();
|
||||
for value in values {
|
||||
@@ -169,7 +169,7 @@ pub(crate) async fn initialize_postgres_schema_for_startup(
|
||||
);
|
||||
}
|
||||
tracing::debug!(target: crate::TRACING_TARGET, dsn = masked_dsn.as_str(), "start PostgreSQL schema initialization");
|
||||
let store_result = kb_store::PostgresStore::connect(options).await;
|
||||
let store_result = ks_store::PostgresStore::connect(options).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
@@ -218,8 +218,8 @@ pub(crate) fn debug_status<T: std::fmt::Debug>(value: T) -> std::string::String
|
||||
|
||||
fn emit_sql_startup_table_report(
|
||||
splash_window: &tauri::WebviewWindow,
|
||||
before_tables: &[kb_store::PostgresTableDiagnostics],
|
||||
after_tables: &[kb_store::PostgresTableDiagnostics],
|
||||
before_tables: &[ks_store::PostgresTableDiagnostics],
|
||||
after_tables: &[ks_store::PostgresTableDiagnostics],
|
||||
) {
|
||||
let mut created_count = 0_u32;
|
||||
let mut existing_count = 0_u32;
|
||||
@@ -268,7 +268,7 @@ fn emit_sql_startup_table_report(
|
||||
}
|
||||
|
||||
fn table_exists_in(
|
||||
tables: &[kb_store::PostgresTableDiagnostics],
|
||||
tables: &[ks_store::PostgresTableDiagnostics],
|
||||
table_name: &str,
|
||||
) -> std::option::Option<bool> {
|
||||
for table in tables {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// file: kb-app-demo-desktop/src/demo_sql_replay_candidates.rs
|
||||
// version: 12
|
||||
// version: 13
|
||||
|
||||
//! Read-only SQL replay candidate browser commands.
|
||||
|
||||
use ts_rs::TS; // rust-rules: derive-import
|
||||
|
||||
/// One program identifier exposed by the runtime `kb_program_ids` registry.
|
||||
/// One program identifier exposed by the runtime `ks_program_ids` registry.
|
||||
#[derive(Clone, Debug, serde::Serialize, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(
|
||||
@@ -33,7 +33,7 @@ pub(crate) struct DemoSqlReplayOptionsPayload {
|
||||
pub(crate) masked_dsn: std::string::String,
|
||||
/// Maximum rows accepted by one query.
|
||||
pub(crate) maximum_limit: u32,
|
||||
/// Program identifiers enumerable from `kb_program_ids`.
|
||||
/// Program identifiers enumerable from `ks_program_ids`.
|
||||
pub(crate) known_programs: std::vec::Vec<crate::DemoSqlReplayKnownProgramOption>,
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ pub(crate) struct DemoSqlReplayProgramRequest {
|
||||
export_to = "../frontend/ts/bindings/kb_app_demo_desktop/demo_sql_replay_candidates/DemoSqlReplayProgramRow.ts"
|
||||
)]
|
||||
pub(crate) struct DemoSqlReplayProgramRow {
|
||||
/// Optional stable code from `kb_program_ids`.
|
||||
/// Optional stable code from `ks_program_ids`.
|
||||
pub(crate) program_code: std::option::Option<std::string::String>,
|
||||
/// Program id.
|
||||
pub(crate) program_id: std::string::String,
|
||||
@@ -251,8 +251,8 @@ pub(crate) async fn demo_sql_replay_options(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
let mut known_programs =
|
||||
std::vec::Vec::with_capacity(kb_program_ids::registered_program_ids().len());
|
||||
for entry in kb_program_ids::registered_program_ids() {
|
||||
std::vec::Vec::with_capacity(ks_program_ids::registered_program_ids().len());
|
||||
for entry in ks_program_ids::registered_program_ids() {
|
||||
known_programs.push(crate::DemoSqlReplayKnownProgramOption {
|
||||
code: entry.code().to_owned(),
|
||||
program_id: entry.program_id().to_owned(),
|
||||
@@ -261,7 +261,7 @@ pub(crate) async fn demo_sql_replay_options(
|
||||
return std::result::Result::Ok(crate::DemoSqlReplayOptionsPayload {
|
||||
active_profile_name: profile.name,
|
||||
masked_dsn: options.masked_dsn(),
|
||||
maximum_limit: kb_store::MAX_REPLAY_CANDIDATE_ROWS,
|
||||
maximum_limit: ks_store::MAX_REPLAY_CANDIDATE_ROWS,
|
||||
known_programs,
|
||||
});
|
||||
}
|
||||
@@ -281,7 +281,7 @@ pub(crate) async fn load_demo_sql_replay_transactions(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let filter_result = kb_store::PostgresReplayTransactionFilter::new(
|
||||
let filter_result = ks_store::PostgresReplayTransactionFilter::new(
|
||||
request.signature_contains,
|
||||
request.min_slot,
|
||||
request.max_slot,
|
||||
@@ -322,7 +322,7 @@ pub(crate) async fn load_demo_sql_replay_programs(
|
||||
request: crate::DemoSqlReplayProgramRequest,
|
||||
) -> std::result::Result<std::vec::Vec<crate::DemoSqlReplayProgramRow>, std::string::String> {
|
||||
let filter_result =
|
||||
kb_store::PostgresReplayProgramFilter::new(request.program_id_contains, request.limit);
|
||||
ks_store::PostgresReplayProgramFilter::new(request.program_id_contains, request.limit);
|
||||
let filter = match filter_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
@@ -355,7 +355,7 @@ pub(crate) async fn load_demo_sql_replay_entities(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let filter_result = kb_store::PostgresReplayEntityFilter::new(
|
||||
let filter_result = ks_store::PostgresReplayEntityFilter::new(
|
||||
entity_kind,
|
||||
request.entity_value_contains,
|
||||
request.limit,
|
||||
@@ -383,7 +383,7 @@ pub(crate) async fn load_demo_sql_replay_entities(
|
||||
}
|
||||
|
||||
fn transaction_row_from_pg(
|
||||
row: kb_store::PostgresReplayTransactionCandidate,
|
||||
row: ks_store::PostgresReplayTransactionCandidate,
|
||||
) -> crate::DemoSqlReplayTransactionRow {
|
||||
return crate::DemoSqlReplayTransactionRow {
|
||||
signature: row.signature,
|
||||
@@ -404,9 +404,9 @@ fn transaction_row_from_pg(
|
||||
}
|
||||
|
||||
fn program_row_from_pg(
|
||||
row: kb_store::PostgresReplayProgramSummary,
|
||||
row: ks_store::PostgresReplayProgramSummary,
|
||||
) -> crate::DemoSqlReplayProgramRow {
|
||||
let program_code = kb_program_ids::find_registered_program_id(&row.program_id)
|
||||
let program_code = ks_program_ids::find_registered_program_id(&row.program_id)
|
||||
.map(|entry| return entry.code().to_owned());
|
||||
return crate::DemoSqlReplayProgramRow {
|
||||
program_code,
|
||||
@@ -420,7 +420,7 @@ fn program_row_from_pg(
|
||||
};
|
||||
}
|
||||
|
||||
fn entity_row_from_pg(row: kb_store::PostgresReplayEntitySummary) -> crate::DemoSqlReplayEntityRow {
|
||||
fn entity_row_from_pg(row: ks_store::PostgresReplayEntitySummary) -> crate::DemoSqlReplayEntityRow {
|
||||
return crate::DemoSqlReplayEntityRow {
|
||||
entity_kind: row.entity_kind,
|
||||
entity_value: row.entity_value,
|
||||
@@ -480,19 +480,19 @@ async fn available_csv_export_path(
|
||||
|
||||
fn program_scope_from_code(
|
||||
code: &str,
|
||||
) -> std::result::Result<kb_store::PostgresReplayProgramScope, std::string::String> {
|
||||
) -> std::result::Result<ks_store::PostgresReplayProgramScope, std::string::String> {
|
||||
return match code {
|
||||
"any" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Any),
|
||||
"outer" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Outer),
|
||||
"inner" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Inner),
|
||||
"logs" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Logs),
|
||||
"any" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Any),
|
||||
"outer" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Outer),
|
||||
"inner" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Inner),
|
||||
"logs" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Logs),
|
||||
_ => std::result::Result::Err(format!("unsupported replay program scope: {code}")),
|
||||
};
|
||||
}
|
||||
|
||||
fn optional_entity_kind_from_code(
|
||||
code: std::option::Option<&str>,
|
||||
) -> std::result::Result<std::option::Option<kb_store::PostgresReplayEntityKind>, std::string::String>
|
||||
) -> std::result::Result<std::option::Option<ks_store::PostgresReplayEntityKind>, std::string::String>
|
||||
{
|
||||
return match code {
|
||||
std::option::Option::Some(value) => {
|
||||
@@ -510,11 +510,11 @@ fn optional_entity_kind_from_code(
|
||||
|
||||
fn entity_kind_from_code(
|
||||
code: &str,
|
||||
) -> std::result::Result<kb_store::PostgresReplayEntityKind, std::string::String> {
|
||||
) -> std::result::Result<ks_store::PostgresReplayEntityKind, std::string::String> {
|
||||
return match code {
|
||||
"mint" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::Mint),
|
||||
"owner" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::Owner),
|
||||
"account_key" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::AccountKey),
|
||||
"mint" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::Mint),
|
||||
"owner" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::Owner),
|
||||
"account_key" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::AccountKey),
|
||||
_ => std::result::Result::Err(format!("unsupported replay entity kind: {code}")),
|
||||
};
|
||||
}
|
||||
@@ -524,7 +524,7 @@ mod tests {
|
||||
#[test]
|
||||
fn program_scope_parser_accepts_logs() {
|
||||
let result = super::program_scope_from_code("logs");
|
||||
assert_eq!(result, std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Logs));
|
||||
assert_eq!(result, std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Logs));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -551,8 +551,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn program_row_exposes_registered_code() {
|
||||
let row = kb_store::PostgresReplayProgramSummary {
|
||||
program_id: kb_program_ids::SYSTEM_PROGRAM_ID.to_owned(),
|
||||
let row = ks_store::PostgresReplayProgramSummary {
|
||||
program_id: ks_program_ids::SYSTEM_PROGRAM_ID.to_owned(),
|
||||
transaction_count: 1,
|
||||
outer_instruction_count: 1,
|
||||
inner_instruction_count: 0,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// file: kb-app-demo-desktop/src/demo_ws.rs
|
||||
// version: 19
|
||||
// version: 20
|
||||
|
||||
//! Standard Solana WebSocket demo commands backed by `kb_onchain_transport::WsSession`.
|
||||
//! Standard Solana WebSocket demo commands backed by `ks_onchain_transport::WsSession`.
|
||||
|
||||
use tauri::Emitter; // rust-rules: trait-import
|
||||
use tauri::Manager; // rust-rules: trait-import
|
||||
@@ -179,7 +179,7 @@ pub(crate) struct DemoWsMessagePayload {
|
||||
pub(crate) payload_json: std::string::String,
|
||||
}
|
||||
|
||||
/// Connects if needed, then subscribes through `kb_onchain_transport::WsSession`.
|
||||
/// Connects if needed, then subscribes through `ks_onchain_transport::WsSession`.
|
||||
pub(crate) async fn demo_ws_connect(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: &crate::AppState,
|
||||
@@ -233,7 +233,7 @@ pub(crate) async fn demo_ws_connect(
|
||||
endpoint_url: selected_client.endpoint_url().to_string(),
|
||||
role,
|
||||
method: method.clone(),
|
||||
request_kind: kb_onchain_transport::request_kind_from_method(&method),
|
||||
request_kind: ks_onchain_transport::request_kind_from_method(&method),
|
||||
response_kind: acknowledgement.response.kind_name().to_string(),
|
||||
subscription_id: acknowledgement.subscription.remote_subscription_id,
|
||||
response_json,
|
||||
@@ -260,7 +260,7 @@ pub(crate) async fn demo_ws_status(
|
||||
pub(crate) fn demo_ws_list_pool_clients(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<
|
||||
std::vec::Vec<kb_onchain_transport::WsPoolClientSnapshot>,
|
||||
std::vec::Vec<ks_onchain_transport::WsPoolClientSnapshot>,
|
||||
std::string::String,
|
||||
> {
|
||||
let pool = match state.demo_ws_pool() {
|
||||
@@ -384,15 +384,15 @@ impl DemoWsUiRateLimiter {
|
||||
async fn ensure_session(
|
||||
app_handle: &tauri::AppHandle,
|
||||
state: &crate::AppState,
|
||||
selected_client: kb_onchain_transport::WsClient,
|
||||
) -> std::result::Result<std::sync::Arc<kb_onchain_transport::WsSession>, std::string::String> {
|
||||
selected_client: ks_onchain_transport::WsClient,
|
||||
) -> std::result::Result<std::sync::Arc<ks_onchain_transport::WsSession>, std::string::String> {
|
||||
let existing = {
|
||||
let guard = state.demo_ws_session().lock().await;
|
||||
guard.clone()
|
||||
};
|
||||
if let std::option::Option::Some(session) = existing {
|
||||
let snapshot = session.snapshot().await;
|
||||
if snapshot.state != kb_onchain_transport::WsSessionState::Disconnected {
|
||||
if snapshot.state != ks_onchain_transport::WsSessionState::Disconnected {
|
||||
if snapshot.endpoint_url != selected_client.endpoint_url() {
|
||||
return std::result::Result::Err(format!(
|
||||
"demo WebSocket session already uses endpoint '{}'; disconnect before selecting '{}'",
|
||||
@@ -404,7 +404,7 @@ async fn ensure_session(
|
||||
}
|
||||
}
|
||||
let reconnect_policy = if selected_client.endpoint_config().auto_reconnect {
|
||||
match kb_onchain_transport::WsReconnectPolicy::bounded(
|
||||
match ks_onchain_transport::WsReconnectPolicy::bounded(
|
||||
DEMO_WS_RECONNECT_ATTEMPTS,
|
||||
DEMO_WS_RECONNECT_INITIAL_DELAY_MS,
|
||||
DEMO_WS_RECONNECT_MAX_DELAY_MS,
|
||||
@@ -413,12 +413,12 @@ async fn ensure_session(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
}
|
||||
} else {
|
||||
kb_onchain_transport::WsReconnectPolicy::disabled()
|
||||
ks_onchain_transport::WsReconnectPolicy::disabled()
|
||||
};
|
||||
let capabilities = kb_onchain_transport::StandardWsCapabilities::from_endpoint(
|
||||
let capabilities = ks_onchain_transport::StandardWsCapabilities::from_endpoint(
|
||||
selected_client.endpoint_config(),
|
||||
);
|
||||
let session = match kb_onchain_transport::WsSession::connect(
|
||||
let session = match ks_onchain_transport::WsSession::connect(
|
||||
selected_client,
|
||||
capabilities,
|
||||
reconnect_policy,
|
||||
@@ -438,7 +438,7 @@ async fn ensure_session(
|
||||
|
||||
fn spawn_event_bridge(
|
||||
app_handle: tauri::AppHandle,
|
||||
session: std::sync::Arc<kb_onchain_transport::WsSession>,
|
||||
session: std::sync::Arc<ks_onchain_transport::WsSession>,
|
||||
) {
|
||||
let mut receiver = session.subscribe_events();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
@@ -460,7 +460,7 @@ fn spawn_event_bridge(
|
||||
std::result::Result::Err(tokio::sync::broadcast::error::RecvError::Closed) => break,
|
||||
};
|
||||
match event {
|
||||
kb_onchain_transport::WsSessionEvent::Notification { notification, .. } => {
|
||||
ks_onchain_transport::WsSessionEvent::Notification { notification, .. } => {
|
||||
let compact_payload = match serde_json::to_string(¬ification) {
|
||||
std::result::Result::Ok(payload) => payload,
|
||||
std::result::Result::Err(error) => {
|
||||
@@ -480,10 +480,10 @@ fn spawn_event_bridge(
|
||||
emit_message(&app_handle, "notification", truncate_payload(ui_payload));
|
||||
}
|
||||
},
|
||||
kb_onchain_transport::WsSessionEvent::Diagnostic { code, message } => {
|
||||
ks_onchain_transport::WsSessionEvent::Diagnostic { code, message } => {
|
||||
emit_message(&app_handle, &code, truncate_payload(message));
|
||||
},
|
||||
kb_onchain_transport::WsSessionEvent::Reconnecting {
|
||||
ks_onchain_transport::WsSessionEvent::Reconnecting {
|
||||
attempt,
|
||||
maximum_attempts,
|
||||
} => {
|
||||
@@ -494,7 +494,7 @@ fn spawn_event_bridge(
|
||||
);
|
||||
emit_status(&app_handle, session.snapshot().await);
|
||||
},
|
||||
kb_onchain_transport::WsSessionEvent::Reconnected { reconnect_count } => {
|
||||
ks_onchain_transport::WsSessionEvent::Reconnected { reconnect_count } => {
|
||||
emit_message(
|
||||
&app_handle,
|
||||
"reconnected",
|
||||
@@ -502,13 +502,13 @@ fn spawn_event_bridge(
|
||||
);
|
||||
emit_status(&app_handle, session.snapshot().await);
|
||||
},
|
||||
kb_onchain_transport::WsSessionEvent::Connected
|
||||
| kb_onchain_transport::WsSessionEvent::SubscriptionAdded(_)
|
||||
| kb_onchain_transport::WsSessionEvent::SubscriptionRemapped { .. }
|
||||
| kb_onchain_transport::WsSessionEvent::SubscriptionRemoved(_) => {
|
||||
ks_onchain_transport::WsSessionEvent::Connected
|
||||
| ks_onchain_transport::WsSessionEvent::SubscriptionAdded(_)
|
||||
| ks_onchain_transport::WsSessionEvent::SubscriptionRemapped { .. }
|
||||
| ks_onchain_transport::WsSessionEvent::SubscriptionRemoved(_) => {
|
||||
emit_status(&app_handle, session.snapshot().await);
|
||||
},
|
||||
kb_onchain_transport::WsSessionEvent::Disconnected => {
|
||||
ks_onchain_transport::WsSessionEvent::Disconnected => {
|
||||
emit_status(&app_handle, session.snapshot().await);
|
||||
break;
|
||||
},
|
||||
@@ -517,7 +517,7 @@ fn spawn_event_bridge(
|
||||
});
|
||||
}
|
||||
|
||||
fn emit_status(app_handle: &tauri::AppHandle, snapshot: kb_onchain_transport::WsSessionSnapshot) {
|
||||
fn emit_status(app_handle: &tauri::AppHandle, snapshot: ks_onchain_transport::WsSessionSnapshot) {
|
||||
let window = match app_handle.get_webview_window("demo_ws") {
|
||||
std::option::Option::Some(window) => window,
|
||||
std::option::Option::None => return,
|
||||
@@ -542,7 +542,7 @@ fn emit_message(app_handle: &tauri::AppHandle, kind: &str, payload_json: std::st
|
||||
}
|
||||
|
||||
fn status_from_snapshot(
|
||||
snapshot: kb_onchain_transport::WsSessionSnapshot,
|
||||
snapshot: ks_onchain_transport::WsSessionSnapshot,
|
||||
) -> crate::DemoWsStatusPayload {
|
||||
let mut subscriptions = std::vec::Vec::new();
|
||||
for subscription in &snapshot.subscriptions {
|
||||
@@ -567,7 +567,7 @@ fn status_from_snapshot(
|
||||
},
|
||||
};
|
||||
return crate::DemoWsStatusPayload {
|
||||
connected: snapshot.state != kb_onchain_transport::WsSessionState::Disconnected,
|
||||
connected: snapshot.state != ks_onchain_transport::WsSessionState::Disconnected,
|
||||
endpoint_name: std::option::Option::Some(snapshot.endpoint_name),
|
||||
endpoint_url: std::option::Option::Some(snapshot.endpoint_url),
|
||||
method,
|
||||
@@ -595,7 +595,7 @@ fn disconnected_status() -> crate::DemoWsStatusPayload {
|
||||
}
|
||||
|
||||
fn build_ws_role_options(
|
||||
snapshots: std::vec::Vec<kb_onchain_transport::WsPoolClientSnapshot>,
|
||||
snapshots: std::vec::Vec<ks_onchain_transport::WsPoolClientSnapshot>,
|
||||
) -> std::vec::Vec<crate::DemoWsRoleOption> {
|
||||
let mut roles = std::collections::BTreeMap::<
|
||||
std::string::String,
|
||||
@@ -635,7 +635,7 @@ fn build_ws_method_options() -> std::vec::Vec<crate::DemoWsMethodOption> {
|
||||
("voteSubscribe", ("Votes", false, false, false)),
|
||||
]);
|
||||
let mut options = std::vec::Vec::new();
|
||||
for specification in &kb_onchain_transport::STANDARD_WS_SUBSCRIPTIONS {
|
||||
for specification in &ks_onchain_transport::STANDARD_WS_SUBSCRIPTIONS {
|
||||
let metadata = labels.get(specification.subscribe_method);
|
||||
let (label, requires_target, requires_filter_json, supports_config_json) = match metadata {
|
||||
std::option::Option::Some(metadata) => *metadata,
|
||||
@@ -644,7 +644,7 @@ fn build_ws_method_options() -> std::vec::Vec<crate::DemoWsMethodOption> {
|
||||
options.push(crate::DemoWsMethodOption {
|
||||
method: specification.subscribe_method.to_string(),
|
||||
unsubscribe_method: specification.unsubscribe_method.to_string(),
|
||||
request_kind: kb_onchain_transport::request_kind_from_method(
|
||||
request_kind: ks_onchain_transport::request_kind_from_method(
|
||||
specification.subscribe_method,
|
||||
),
|
||||
label: label.to_string(),
|
||||
@@ -661,7 +661,7 @@ fn build_standard_ws_request(
|
||||
target: std::option::Option<std::string::String>,
|
||||
filter_json: std::option::Option<std::string::String>,
|
||||
config_json: std::option::Option<std::string::String>,
|
||||
) -> std::result::Result<kb_onchain_transport::StandardWsRequest, std::string::String> {
|
||||
) -> std::result::Result<ks_onchain_transport::StandardWsRequest, std::string::String> {
|
||||
return match method {
|
||||
"accountSubscribe" => {
|
||||
let target = match required_target(target, method) {
|
||||
@@ -669,7 +669,7 @@ fn build_standard_ws_request(
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let mut config = match parse_optional_json_as::<
|
||||
kb_onchain_transport::WsAccountSubscribeConfig,
|
||||
ks_onchain_transport::WsAccountSubscribeConfig,
|
||||
>(config_json, "configJson")
|
||||
{
|
||||
std::result::Result::Ok(config) => config.unwrap_or_default(),
|
||||
@@ -677,15 +677,15 @@ fn build_standard_ws_request(
|
||||
};
|
||||
if config.encoding.is_none() {
|
||||
config.encoding =
|
||||
std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64);
|
||||
std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64);
|
||||
}
|
||||
if let std::result::Result::Err(error) =
|
||||
reject_present(filter_json, "filterJson", method)
|
||||
{
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Account(
|
||||
kb_onchain_transport::AccountSubscribeRequest {
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Account(
|
||||
ks_onchain_transport::AccountSubscribeRequest {
|
||||
pubkey: target,
|
||||
config: std::option::Option::Some(config),
|
||||
},
|
||||
@@ -695,44 +695,44 @@ fn build_standard_ws_request(
|
||||
if let std::result::Result::Err(error) = reject_present(target, "target", method) {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
let filter = match parse_required_json_as::<kb_onchain_transport::WsBlockFilter>(
|
||||
let filter = match parse_required_json_as::<ks_onchain_transport::WsBlockFilter>(
|
||||
filter_json,
|
||||
"filterJson",
|
||||
) {
|
||||
std::result::Result::Ok(filter) => filter,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let config = match parse_optional_json_as::<kb_onchain_transport::WsBlockSubscribeConfig>(
|
||||
let config = match parse_optional_json_as::<ks_onchain_transport::WsBlockSubscribeConfig>(
|
||||
config_json,
|
||||
"configJson",
|
||||
) {
|
||||
std::result::Result::Ok(config) => config,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Block(
|
||||
kb_onchain_transport::BlockSubscribeRequest { filter, config },
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Block(
|
||||
ks_onchain_transport::BlockSubscribeRequest { filter, config },
|
||||
))
|
||||
},
|
||||
"logsSubscribe" => {
|
||||
if let std::result::Result::Err(error) = reject_present(target, "target", method) {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
let filter = match parse_required_json_as::<kb_onchain_transport::WsLogsFilter>(
|
||||
let filter = match parse_required_json_as::<ks_onchain_transport::WsLogsFilter>(
|
||||
filter_json,
|
||||
"filterJson",
|
||||
) {
|
||||
std::result::Result::Ok(filter) => filter,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let config = match parse_optional_json_as::<kb_onchain_transport::WsLogsSubscribeConfig>(
|
||||
let config = match parse_optional_json_as::<ks_onchain_transport::WsLogsSubscribeConfig>(
|
||||
config_json,
|
||||
"configJson",
|
||||
) {
|
||||
std::result::Result::Ok(config) => config,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Logs(
|
||||
kb_onchain_transport::LogsSubscribeRequest { filter, config },
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Logs(
|
||||
ks_onchain_transport::LogsSubscribeRequest { filter, config },
|
||||
))
|
||||
},
|
||||
"programSubscribe" => {
|
||||
@@ -746,7 +746,7 @@ fn build_standard_ws_request(
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
let mut config = match parse_optional_json_as::<
|
||||
kb_onchain_transport::WsProgramSubscribeConfig,
|
||||
ks_onchain_transport::WsProgramSubscribeConfig,
|
||||
>(config_json, "configJson")
|
||||
{
|
||||
std::result::Result::Ok(config) => config.unwrap_or_default(),
|
||||
@@ -754,10 +754,10 @@ fn build_standard_ws_request(
|
||||
};
|
||||
if config.encoding.is_none() {
|
||||
config.encoding =
|
||||
std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64);
|
||||
std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Program(
|
||||
kb_onchain_transport::ProgramSubscribeRequest {
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Program(
|
||||
ks_onchain_transport::ProgramSubscribeRequest {
|
||||
program_id: target,
|
||||
config: std::option::Option::Some(config),
|
||||
},
|
||||
@@ -774,14 +774,14 @@ fn build_standard_ws_request(
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
let config = match parse_optional_json_as::<
|
||||
kb_onchain_transport::WsSignatureSubscribeConfig,
|
||||
ks_onchain_transport::WsSignatureSubscribeConfig,
|
||||
>(config_json, "configJson")
|
||||
{
|
||||
std::result::Result::Ok(config) => config,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Signature(
|
||||
kb_onchain_transport::SignatureSubscribeRequest { signature: target, config },
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Signature(
|
||||
ks_onchain_transport::SignatureSubscribeRequest { signature: target, config },
|
||||
))
|
||||
},
|
||||
"rootSubscribe" => {
|
||||
@@ -790,8 +790,8 @@ fn build_standard_ws_request(
|
||||
{
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Root(
|
||||
kb_onchain_transport::RootSubscribeRequest,
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Root(
|
||||
ks_onchain_transport::RootSubscribeRequest,
|
||||
))
|
||||
},
|
||||
"slotSubscribe" => {
|
||||
@@ -800,8 +800,8 @@ fn build_standard_ws_request(
|
||||
{
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Slot(
|
||||
kb_onchain_transport::SlotSubscribeRequest,
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Slot(
|
||||
ks_onchain_transport::SlotSubscribeRequest,
|
||||
))
|
||||
},
|
||||
"slotsUpdatesSubscribe" => {
|
||||
@@ -810,8 +810,8 @@ fn build_standard_ws_request(
|
||||
{
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::SlotsUpdates(
|
||||
kb_onchain_transport::SlotsUpdatesSubscribeRequest,
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::SlotsUpdates(
|
||||
ks_onchain_transport::SlotsUpdatesSubscribeRequest,
|
||||
))
|
||||
},
|
||||
"voteSubscribe" => {
|
||||
@@ -820,8 +820,8 @@ fn build_standard_ws_request(
|
||||
{
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Vote(
|
||||
kb_onchain_transport::VoteSubscribeRequest,
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Vote(
|
||||
ks_onchain_transport::VoteSubscribeRequest,
|
||||
))
|
||||
},
|
||||
_ => std::result::Result::Err(format!("unsupported standard WebSocket method '{method}'")),
|
||||
@@ -930,30 +930,30 @@ mod tests {
|
||||
std::option::Option::None,
|
||||
);
|
||||
let account = match account {
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Account(value)) => {
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Account(value)) => {
|
||||
value
|
||||
},
|
||||
_ => panic!("accountSubscribe request was not built"),
|
||||
};
|
||||
assert_eq!(
|
||||
account.config.and_then(|value| return value.encoding),
|
||||
std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64)
|
||||
std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64)
|
||||
);
|
||||
let program = super::build_standard_ws_request(
|
||||
"programSubscribe",
|
||||
std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()),
|
||||
std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()),
|
||||
std::option::Option::None,
|
||||
std::option::Option::Some(r#"{"encoding":"jsonParsed"}"#.to_string()),
|
||||
);
|
||||
let program = match program {
|
||||
std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Program(value)) => {
|
||||
std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Program(value)) => {
|
||||
value
|
||||
},
|
||||
_ => panic!("programSubscribe request was not built"),
|
||||
};
|
||||
assert_eq!(
|
||||
program.config.and_then(|value| return value.encoding),
|
||||
std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::JsonParsed)
|
||||
std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::JsonParsed)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/main_window.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Main-window helpers and workspace README loading.
|
||||
|
||||
@@ -11,12 +11,12 @@ pub(crate) fn workspace_root_dir() -> std::path::PathBuf {
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) fn load_project_readme() -> kb_core::Result<std::string::String> {
|
||||
pub(crate) fn load_project_readme() -> ks_core::Result<std::string::String> {
|
||||
let path = crate::workspace_root_dir().join("README.md");
|
||||
let content = match std::fs::read_to_string(&path) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(kb_core::Error::io(format!(
|
||||
return std::result::Result::Err(ks_core::Error::io(format!(
|
||||
"cannot read project README '{}': {error}",
|
||||
path.display()
|
||||
)));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/tauri.rs
|
||||
// version: 34
|
||||
// version: 35
|
||||
|
||||
//! Tauri runtime assembly and private command wrappers.
|
||||
|
||||
@@ -9,7 +9,7 @@ use tauri::Manager; // rust-rules: trait-import
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
#[allow(clippy::question_mark)]
|
||||
pub fn run() -> kb_core::Result<()> {
|
||||
pub fn run() -> ks_core::Result<()> {
|
||||
let rustls_result = install_default_rustls_provider();
|
||||
if let std::result::Result::Err(error) = rustls_result {
|
||||
return std::result::Result::Err(error);
|
||||
@@ -131,20 +131,20 @@ pub fn run() -> kb_core::Result<()> {
|
||||
let run_result = builder.run(tauri::generate_context!());
|
||||
return match run_result {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::tauri(
|
||||
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::tauri(
|
||||
format!("cannot run desktop demo application: {error:?}"),
|
||||
)),
|
||||
};
|
||||
}
|
||||
|
||||
fn install_default_rustls_provider() -> kb_core::Result<()> {
|
||||
fn install_default_rustls_provider() -> ks_core::Result<()> {
|
||||
if rustls::crypto::CryptoProvider::get_default().is_some() {
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let provider_result = rustls::crypto::aws_lc_rs::default_provider().install_default();
|
||||
return match provider_result {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::invalid_state(
|
||||
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::invalid_state(
|
||||
format!("cannot install default rustls crypto provider: {error:?}"),
|
||||
)),
|
||||
};
|
||||
@@ -160,12 +160,12 @@ fn open_or_focus_demo_window(
|
||||
if let std::option::Option::Some(window) = app_handle.get_webview_window(label) {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
return std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot show {label} window: {error}")).to_string(),
|
||||
ks_core::Error::tauri(format!("cannot show {label} window: {error}")).to_string(),
|
||||
);
|
||||
}
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(),
|
||||
ks_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(),
|
||||
);
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
@@ -185,12 +185,12 @@ fn open_or_focus_demo_window(
|
||||
std::result::Result::Ok(window) => match window.set_focus() {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus created {label} window: {error}"))
|
||||
ks_core::Error::tauri(format!("cannot focus created {label} window: {error}"))
|
||||
.to_string(),
|
||||
),
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(),
|
||||
ks_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(),
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -256,7 +256,7 @@ fn open_demo_http_window(
|
||||
#[tauri::command]
|
||||
fn demo_http_list_pool_clients(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::vec::Vec<kb_onchain_transport::HttpPoolClientSnapshot> {
|
||||
) -> std::vec::Vec<ks_onchain_transport::HttpPoolClientSnapshot> {
|
||||
return crate::demo_http_list_pool_clients(state);
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ fn open_demo_ws_window(
|
||||
fn demo_ws_list_pool_clients(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<
|
||||
std::vec::Vec<kb_onchain_transport::WsPoolClientSnapshot>,
|
||||
std::vec::Vec<ks_onchain_transport::WsPoolClientSnapshot>,
|
||||
std::string::String,
|
||||
> {
|
||||
return crate::demo_ws_list_pool_clients(state);
|
||||
|
||||
Reference in New Issue
Block a user