feat(gui): Add button to display monero redeem recovery keys (#64)

This commit is contained in:
binarybaron 2024-09-06 14:23:36 +02:00 committed by GitHub
parent e4bddd2287
commit 177e3e9949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 90 additions and 49 deletions

View file

@ -3,8 +3,8 @@ use std::sync::Arc;
use swap::cli::{
api::{
request::{
BalanceArgs, BuyXmrArgs, GetHistoryArgs, GetSwapInfosAllArgs, ResumeSwapArgs,
SuspendCurrentSwapArgs, WithdrawBtcArgs,
BalanceArgs, BuyXmrArgs, GetHistoryArgs, GetSwapInfosAllArgs, MoneroRecoveryArgs,
ResumeSwapArgs, SuspendCurrentSwapArgs, WithdrawBtcArgs,
},
tauri_bindings::{TauriContextStatusEvent, TauriEmitter, TauriHandle},
Context, ContextBuilder,
@ -167,7 +167,9 @@ pub fn run() {
buy_xmr,
resume_swap,
get_history,
suspend_current_swap
monero_recovery,
suspend_current_swap,
is_context_available,
])
.setup(setup)
.build(tauri::generate_context!())
@ -203,6 +205,15 @@ tauri_command!(get_balance, BalanceArgs);
tauri_command!(buy_xmr, BuyXmrArgs);
tauri_command!(resume_swap, ResumeSwapArgs);
tauri_command!(withdraw_btc, WithdrawBtcArgs);
tauri_command!(monero_recovery, MoneroRecoveryArgs);
// These commands require no arguments
tauri_command!(suspend_current_swap, SuspendCurrentSwapArgs, no_args);
tauri_command!(get_swap_infos_all, GetSwapInfosAllArgs, no_args);
tauri_command!(get_history, GetHistoryArgs, no_args);
/// Here we define Tauri commands whose implementation is not delegated to the Request trait
#[tauri::command]
async fn is_context_available(context: tauri::State<'_, RwLock<State>>) -> Result<bool, String> {
Ok(context.read().await.try_get_context().is_ok())
}