wallet: fix clippy (#1339)

This commit is contained in:
Jon Häggblad
2022-06-10 00:02:31 +02:00
committed by GitHub
parent 62baada93d
commit 9a103d5e20
5 changed files with 27 additions and 31 deletions
@@ -28,5 +28,5 @@ pub async fn simulate_update_contract_settings(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
@@ -33,5 +33,5 @@ pub async fn simulate_send(
};
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
@@ -36,7 +36,7 @@ pub async fn simulate_bond_gateway(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -56,7 +56,7 @@ pub async fn simulate_unbond_gateway(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -83,7 +83,7 @@ pub async fn simulate_bond_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -103,7 +103,7 @@ pub async fn simulate_unbond_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -126,7 +126,7 @@ pub async fn simulate_update_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -151,7 +151,7 @@ pub async fn simulate_delegate_to_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -174,7 +174,7 @@ pub async fn simulate_undelegate_from_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -185,7 +185,7 @@ pub async fn simulate_claim_operator_reward(
.simulate_claim_operator_reward(None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -196,7 +196,7 @@ pub async fn simulate_compound_operator_reward(
.simulate_compound_operator_reward(None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -208,7 +208,7 @@ pub async fn simulate_claim_delegator_reward(
.simulate_claim_delegator_reward(mix_identity, None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -220,5 +220,5 @@ pub async fn simulate_compound_delegator_reward(
.simulate_compound_delegator_reward(mix_identity, None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
use nym_types::currency::MajorCurrencyAmount;
use nym_types::error::TypesError;
use nym_types::fees::FeeDetails;
use validator_client::nymd::cosmwasm_client::types::GasInfo;
use validator_client::nymd::{tx, CosmosCoin, Fee, GasPrice};
@@ -30,15 +29,12 @@ impl SimulateResult {
}
}
pub fn detailed_fee(&self) -> Result<FeeDetails, TypesError> {
let amount: Option<MajorCurrencyAmount> = match self.to_fee_amount() {
Some(a) => Some(a.into()),
None => None,
};
Ok(FeeDetails {
pub fn detailed_fee(&self) -> FeeDetails {
let amount = self.to_fee_amount().map(MajorCurrencyAmount::from);
FeeDetails {
amount,
fee: self.to_fee(),
})
}
}
fn to_fee_amount(&self) -> Option<CosmosCoin> {
@@ -37,7 +37,7 @@ pub async fn simulate_vesting_bond_gateway(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -57,7 +57,7 @@ pub async fn simulate_vesting_unbond_gateway(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -85,7 +85,7 @@ pub async fn simulate_vesting_bond_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -105,7 +105,7 @@ pub async fn simulate_vesting_unbond_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -128,7 +128,7 @@ pub async fn simulate_vesting_update_mixnode(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -150,7 +150,7 @@ pub async fn simulate_withdraw_vested_coins(
)?;
let result = client.nymd.simulate(vec![msg]).await?;
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -161,7 +161,7 @@ pub async fn simulate_vesting_claim_operator_reward(
.simulate_vesting_claim_operator_reward(None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -172,7 +172,7 @@ pub async fn simulate_vesting_compound_operator_reward(
.simulate_vesting_compound_operator_reward(None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -184,7 +184,7 @@ pub async fn simulate_vesting_claim_delegator_reward(
.simulate_vesting_claim_delegator_reward(mix_identity, None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}
#[tauri::command]
@@ -196,5 +196,5 @@ pub async fn simulate_vesting_compound_delegator_reward(
.simulate_vesting_compound_delegator_reward(mix_identity, None)
.await?;
let gas_price = nymd_client!(state).gas_price().clone();
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee()?)
Ok(SimulateResult::new(result.gas_info, gas_price).detailed_fee())
}