Additional tauri commands to get bond details
This commit is contained in:
@@ -36,6 +36,8 @@ fn main() {
|
||||
mixnet::bond::bond_mixnode,
|
||||
mixnet::bond::unbond_gateway,
|
||||
mixnet::bond::unbond_mixnode,
|
||||
mixnet::bond::mixnode_bond_details,
|
||||
mixnet::bond::gateway_bond_details,
|
||||
mixnet::delegate::delegate_to_mixnode,
|
||||
mixnet::delegate::get_reverse_mix_delegations_paged,
|
||||
mixnet::delegate::undelegate_from_mixnode,
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::coin::Coin;
|
||||
use crate::error::BackendError;
|
||||
use crate::state::State;
|
||||
use crate::{Gateway, MixNode};
|
||||
use mixnet_contract::{GatewayBond, MixNodeBond};
|
||||
use std::convert::TryInto;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
@@ -48,3 +49,23 @@ pub async fn bond_mixnode(
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn mixnode_bond_details(
|
||||
state: tauri::State<'_, Arc<RwLock<State>>>,
|
||||
) -> Result<Option<MixNodeBond>, BackendError> {
|
||||
let guard = state.read().await;
|
||||
let client = guard.client()?;
|
||||
let bond = client.owns_mixnode(client.address()).await?;
|
||||
Ok(bond)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn gateway_bond_details(
|
||||
state: tauri::State<'_, Arc<RwLock<State>>>,
|
||||
) -> Result<Option<GatewayBond>, BackendError> {
|
||||
let guard = state.read().await;
|
||||
let client = guard.client()?;
|
||||
let bond = client.owns_gateway(client.address()).await?;
|
||||
Ok(bond)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user