From 748e3e4248aa52068c43107e146fe1ddfbe6da80 Mon Sep 17 00:00:00 2001 From: Tommy Verrall Date: Wed, 9 Apr 2025 12:46:03 +0200 Subject: [PATCH] fix remaining lint and cargo clippy errors --- nym-wallet/src-tauri/src/config/mod.rs | 5 +++-- nym-wallet/src-tauri/src/main.rs | 1 - nym-wallet/src-tauri/src/menu.rs | 1 + nym-wallet/src-tauri/src/operations/mixnet/send.rs | 2 +- .../src-tauri/src/operations/nym_api/status.rs | 12 ------------ .../src/pages/node-settings/useSettingsState.ts | 11 +---------- nym-wallet/src/requests/mixnodeDetails.ts | 10 ---------- nym-wallet/src/requests/queries.ts | 4 ---- 8 files changed, 6 insertions(+), 40 deletions(-) diff --git a/nym-wallet/src-tauri/src/config/mod.rs b/nym-wallet/src-tauri/src/config/mod.rs index d708540d67..418e07eda9 100644 --- a/nym-wallet/src-tauri/src/config/mod.rs +++ b/nym-wallet/src-tauri/src/config/mod.rs @@ -253,6 +253,7 @@ impl Config { } } + #[allow(clippy::to_string_in_format_args)] pub fn set_default_nyxd_url(&mut self, nyxd_url: Url, network: &WalletNetwork) { log::debug!( "set default nyxd URL for {network} {}", @@ -310,7 +311,7 @@ impl Config { self.networks.get(&network.as_key()).and_then(|config| { log::debug!( "get selected nyxd url for {} {:?}", - network.to_string(), + network, config.selected_nyxd_url, ); config.selected_nyxd_url.clone() @@ -321,7 +322,7 @@ impl Config { self.networks.get(&network.as_key()).and_then(|config| { log::debug!( "get default nyxd url for {} {:?}", - network.to_string(), + network, config.default_nyxd_url, ); config.default_nyxd_url.clone() diff --git a/nym-wallet/src-tauri/src/main.rs b/nym-wallet/src-tauri/src/main.rs index 1231c14ff8..fe9aa8664c 100644 --- a/nym-wallet/src-tauri/src/main.rs +++ b/nym-wallet/src-tauri/src/main.rs @@ -129,7 +129,6 @@ fn main() { nym_api::status::compute_mixnode_reward_estimation, nym_api::status::gateway_core_node_status, nym_api::status::mixnode_core_node_status, - nym_api::status::mixnode_inclusion_probability, nym_api::status::mixnode_reward_estimation, nym_api::status::mixnode_stake_saturation, nym_api::status::mixnode_status, diff --git a/nym-wallet/src-tauri/src/menu.rs b/nym-wallet/src-tauri/src/menu.rs index 618944ca13..58caa8b803 100644 --- a/nym-wallet/src-tauri/src/menu.rs +++ b/nym-wallet/src-tauri/src/menu.rs @@ -4,6 +4,7 @@ use tauri::menu::{MenuBuilder, MenuItemBuilder, SubmenuBuilder}; pub const SHOW_LOG_WINDOW: &str = "show_log_window"; pub trait AddDefaultSubmenus { + #[allow(dead_code)] fn add_default_app_submenus(self) -> Self; } diff --git a/nym-wallet/src-tauri/src/operations/mixnet/send.rs b/nym-wallet/src-tauri/src/operations/mixnet/send.rs index ad5596bf21..9e1ae7849c 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/send.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/send.rs @@ -32,7 +32,7 @@ pub async fn send( .nyxd .send(&to_address, vec![amount_base], memo, fee) .await?; - log::info!("<<< tx hash = {}", raw_res.hash.to_string()); + log::info!("<<< tx hash = {}", raw_res.hash); let res = SendTxResult::new( raw_res, TransactionDetails::new(amount, from_address, to_address.to_string()), diff --git a/nym-wallet/src-tauri/src/operations/nym_api/status.rs b/nym-wallet/src-tauri/src/operations/nym_api/status.rs index 20218b7e31..2f3332b700 100644 --- a/nym-wallet/src-tauri/src/operations/nym_api/status.rs +++ b/nym-wallet/src-tauri/src/operations/nym_api/status.rs @@ -109,18 +109,6 @@ pub async fn mixnode_stake_saturation( .await?) } -// TODO: fix later (yeah...) -#[allow(deprecated)] -#[tauri::command] -pub async fn mixnode_inclusion_probability( - mix_id: NodeId, - state: tauri::State<'_, WalletState>, -) -> Result { - Ok(api_client!(state) - .get_mixnode_inclusion_probability(mix_id) - .await?) -} - #[tauri::command] pub async fn get_nymnode_role( node_id: NodeId, diff --git a/nym-wallet/src/pages/node-settings/useSettingsState.ts b/nym-wallet/src/pages/node-settings/useSettingsState.ts index 736fabad13..463fbfd5d0 100644 --- a/nym-wallet/src/pages/node-settings/useSettingsState.ts +++ b/nym-wallet/src/pages/node-settings/useSettingsState.ts @@ -1,7 +1,7 @@ import { useState } from 'react'; import { useSnackbar } from 'notistack'; import { decimalToPercentage, InclusionProbabilityResponse, MixnodeStatus } from '@nymproject/types'; -import { getInclusionProbability, getMixnodeStakeSaturation, getMixnodeStatus } from '../../requests'; +import { getMixnodeStakeSaturation, getMixnodeStatus } from '../../requests'; export const useSettingsState = () => { const [status, setStatus] = useState('not_found'); @@ -27,14 +27,6 @@ export const useSettingsState = () => { } }; - const getMixnodeInclusionProbability = async (mixId: number) => { - const probability = await getInclusionProbability(mixId); - if (probability) { - // eslint-disable-next-line @typescript-eslint/naming-convention - setInclusionProbability({ in_active: probability.in_active, in_reserve: probability.in_reserve }); - } - }; - const reset = () => { setStatus('not_found'); setSaturation('-'); @@ -46,7 +38,6 @@ export const useSettingsState = () => { try { await getStatus(mixId); await getStakeSaturation(mixId); - await getMixnodeInclusionProbability(mixId); } catch (e) { enqueueSnackbar(e as string, { variant: 'error', preventDuplicate: true }); reset(); diff --git a/nym-wallet/src/requests/mixnodeDetails.ts b/nym-wallet/src/requests/mixnodeDetails.ts index 093f880261..1e6a41a5ef 100644 --- a/nym-wallet/src/requests/mixnodeDetails.ts +++ b/nym-wallet/src/requests/mixnodeDetails.ts @@ -14,7 +14,6 @@ import { getMixnodeUptime, getMixnodeStakeSaturation, getMixnodeRewardEstimation, - getInclusionProbability, getMixnodeAvgUptime, getMixNodeDescription as getNodeDescriptionRequest, getPendingOperatorRewards, @@ -80,14 +79,6 @@ async function getAdditionalMixnodeDetails(mixId: number, host: string, port: nu }, }; - const inclusionReq: TauriReq = { - name: 'getInclusionProbability', - request: () => getInclusionProbability(mixId), - onFulfilled: (value) => { - details.setProbability = value; - }, - }; - const avgUptimeReq: TauriReq = { name: 'getMixnodeAvgUptime', request: () => getMixnodeAvgUptime(), @@ -117,7 +108,6 @@ async function getAdditionalMixnodeDetails(mixId: number, host: string, port: nu uptimeReq, stakeSaturationReq, rewardReq, - inclusionReq, avgUptimeReq, nodeDescReq, operatorRewardsReq, diff --git a/nym-wallet/src/requests/queries.ts b/nym-wallet/src/requests/queries.ts index 4f4cce2412..43d52a664b 100644 --- a/nym-wallet/src/requests/queries.ts +++ b/nym-wallet/src/requests/queries.ts @@ -1,6 +1,5 @@ import { DecCoin, - InclusionProbabilityResponse, MixnodeStatusResponse, PendingIntervalEvent, RewardEstimationResponse, @@ -33,9 +32,6 @@ export const checkGatewayOwnership = async () => invokeWrapper('owns_ga export const checkNymNodeOwnership = async () => invokeWrapper('owns_nym_node'); -export const getInclusionProbability = async (mixId: number) => - invokeWrapper('mixnode_inclusion_probability', { mixId }); - export const getCurrentInterval = async () => invokeWrapper('get_current_interval'); export const getNumberOfMixnodeDelegators = async (mixId: number) =>