diff --git a/nym-wallet/src-tauri/src/operations/mixnet/mod.rs b/nym-wallet/src-tauri/src/operations/mixnet/mod.rs index e59890f38e..40ebc405d8 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/mod.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/mod.rs @@ -3,4 +3,5 @@ pub mod admin; pub mod bond; pub mod delegate; pub mod epoch; +pub mod rewards; pub mod send; diff --git a/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs b/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs new file mode 100644 index 0000000000..f61736751a --- /dev/null +++ b/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs @@ -0,0 +1,20 @@ +use std::{str::FromStr, sync::Arc}; + +use mixnet_contract_common::IdentityKey; +use tauri::async_runtime::RwLock; +use validator_client::nymd::{cosmwasm_client::types::ExecuteResult, error::NymdError, Fee}; + +use crate::{nymd_client, state::State}; + +#[tauri::command] +pub async fn claim_delegator_reward( + identity: &str, + fee: Option, + state: tauri::State<'_, Arc>>, +) -> Result { + let identity_key = IdentityKey::from_str(identity).unwrap(); + Ok(nymd_client!(state) + .claim_delegator_reward(identity_key, fee) + .await + .unwrap()) +} diff --git a/nym-wallet/src/requests/rewards.ts b/nym-wallet/src/requests/rewards.ts new file mode 100644 index 0000000000..836c8205c2 --- /dev/null +++ b/nym-wallet/src/requests/rewards.ts @@ -0,0 +1,7 @@ +import { invoke } from "@tauri-apps/api"; + +export const claimDelegatorRewards = async () => { + const res: string = await invoke('claim_delegator_rewards'); + console.log(res); + return res; +}; \ No newline at end of file