v0.2.6-pre.004

This commit is contained in:
2026-08-20 23:01:41 +02:00
parent 6eb4d71043
commit 76bfce17c1
22 changed files with 903 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-wallet-desk/src/tauri.rs
// version: 1
// version: 2
//! Tauri runtime assembly for the KSP wallet desktop application.
@@ -37,7 +37,14 @@ fn configure_plugins(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<taur
#[allow(clippy::question_mark_used)] // Tauri generates the question-mark operator internally for async command dispatch.
fn configure_commands(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tauri::Wry> {
return builder.invoke_handler(tauri::generate_handler![emit_frontend_log, get_runtime_status, splash_frontend_ready]);
return builder.invoke_handler(tauri::generate_handler![
emit_frontend_log,
get_runtime_status,
list_wallets,
refresh_wallets,
select_wallet,
splash_frontend_ready
]);
}
fn configure_setup(builder: tauri::Builder<tauri::Wry>) -> tauri::Builder<tauri::Wry> {
@@ -73,6 +80,41 @@ fn get_runtime_status(state: tauri::State<'_, crate::AppState>) -> std::result::
};
}
#[tauri::command]
async fn list_wallets(state: tauri::State<'_, crate::AppState>) -> std::result::Result<std::vec::Vec<crate::WalletInventoryEntryDto>, crate::CommandErrorDto> {
let root = state.wallet_inventory_root().to_path_buf();
let result = crate::list_wallet_inventory(root.as_path()).await;
return match result {
std::result::Result::Ok(value) => std::result::Result::Ok(value),
std::result::Result::Err(error) => std::result::Result::Err(crate::CommandErrorDto::from_error(&error)),
};
}
#[tauri::command]
async fn refresh_wallets(
state: tauri::State<'_, crate::AppState>,
) -> std::result::Result<std::vec::Vec<crate::WalletInventoryEntryDto>, crate::CommandErrorDto> {
let root = state.wallet_inventory_root().to_path_buf();
let result = crate::list_wallet_inventory(root.as_path()).await;
return match result {
std::result::Result::Ok(value) => std::result::Result::Ok(value),
std::result::Result::Err(error) => std::result::Result::Err(crate::CommandErrorDto::from_error(&error)),
};
}
#[tauri::command]
async fn select_wallet(
request: crate::WalletSelectionRequestDto,
state: tauri::State<'_, crate::AppState>,
) -> std::result::Result<crate::LockedWalletDto, crate::CommandErrorDto> {
let root = state.wallet_inventory_root().to_path_buf();
let result = crate::select_locked_wallet(root.as_path(), request).await;
return match result {
std::result::Result::Ok(value) => std::result::Result::Ok(value),
std::result::Result::Err(error) => std::result::Result::Err(crate::CommandErrorDto::from_error(&error)),
};
}
#[tauri::command]
async fn splash_frontend_ready(
app: tauri::AppHandle,