diff --git a/nym-wallet/src/pages/settings/index.tsx b/nym-wallet/src/pages/settings/index.tsx index e40c919f75..0f6e64e7e5 100644 --- a/nym-wallet/src/pages/settings/index.tsx +++ b/nym-wallet/src/pages/settings/index.tsx @@ -17,7 +17,7 @@ export const Settings = () => { const { showSettings, handleShowSettings } = useContext(ClientContext) const [selectedTab, setSelectedTab] = useState(0) - const { mixnodeDetails, status, saturation, rewardEstimation } = useSettingsState(showSettings) + const { mixnodeDetails, status, saturation, rewardEstimation, getBondDetails } = useSettingsState(showSettings) const handleTabChange = (_: React.SyntheticEvent, newTab: number) => setSelectedTab(newTab) @@ -47,6 +47,7 @@ export const Settings = () => { mixnodeDetails={mixnodeDetails.mix_node} saturation={saturation} rewardEstimation={rewardEstimation} + onUpdate={getBondDetails} /> )} {selectedTab === 2 && mixnodeDetails && } diff --git a/nym-wallet/src/pages/settings/profile.tsx b/nym-wallet/src/pages/settings/profile.tsx index 228d63e8ad..b9c50b6ff3 100644 --- a/nym-wallet/src/pages/settings/profile.tsx +++ b/nym-wallet/src/pages/settings/profile.tsx @@ -1,7 +1,6 @@ +import React from 'react' import { Button, Stack, TextField } from '@mui/material' import { Box } from '@mui/system' -import React from 'react' -import { InfoTooltip } from '../../components/InfoToolTip' export const Profile = () => { return ( diff --git a/nym-wallet/src/pages/settings/system-variables.tsx b/nym-wallet/src/pages/settings/system-variables.tsx index 34081fad65..cc411ea9dd 100644 --- a/nym-wallet/src/pages/settings/system-variables.tsx +++ b/nym-wallet/src/pages/settings/system-variables.tsx @@ -19,6 +19,7 @@ import { TMixnodeBondDetails } from '../../types' import { validationSchema } from './validationSchema' import { getGasFee, updateMixnode } from '../../requests' import { ClientContext, MAJOR_CURRENCY } from '../../context/main' +import { Fee } from '../../components' type TFormData = { profitMarginPercent: number @@ -28,10 +29,12 @@ export const SystemVariables = ({ mixnodeDetails, saturation, rewardEstimation, + onUpdate, }: { mixnodeDetails: TMixnodeBondDetails['mix_node'] saturation: number rewardEstimation: number + onUpdate: () => void }) => { const [nodeUpdateResponse, setNodeUpdateResponse] = useState<'success' | 'failed'>() const [configFee, setConfigFee] = useState() @@ -45,21 +48,16 @@ export const SystemVariables = ({ defaultValues: { profitMarginPercent: mixnodeDetails.profit_margin_percent.toString() }, }) - useEffect(() => { - ;(async () => { - const fee = await getGasFee('UpdateMixnodeConfig') - setConfigFee(fee.amount) - })() - }, []) + const { userBalance } = useContext(ClientContext) const onSubmit = async (data: TFormData) => { try { - await updateMixnode({ profitMarginPercent: data.profitMarginPercent }).then(() => { - userBalance.fetchBalance() - setNodeUpdateResponse('success') - }) + await updateMixnode({ profitMarginPercent: data.profitMarginPercent }) + await userBalance.fetchBalance() + onUpdate() + setNodeUpdateResponse('success') } catch (e) { setNodeUpdateResponse('failed') console.log(e) @@ -127,9 +125,7 @@ export const SystemVariables = ({ ) : nodeUpdateResponse === 'failed' ? ( Node updated failed ) : ( - - Fee for this transaction: {`${configFee} ${MAJOR_CURRENCY}`}{' '} - + )}