Starting work on claim delegator rewards button
This commit is contained in:
@@ -3,4 +3,5 @@ pub mod admin;
|
||||
pub mod bond;
|
||||
pub mod delegate;
|
||||
pub mod epoch;
|
||||
pub mod rewards;
|
||||
pub mod send;
|
||||
|
||||
@@ -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<Fee>,
|
||||
state: tauri::State<'_, Arc<RwLock<State>>>,
|
||||
) -> Result<ExecuteResult, NymdError> {
|
||||
let identity_key = IdentityKey::from_str(identity).unwrap();
|
||||
Ok(nymd_client!(state)
|
||||
.claim_delegator_reward(identity_key, fee)
|
||||
.await
|
||||
.unwrap())
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user