diff --git a/nym-wallet/src/components/Bonding/forms/gatewayValidationSchema.ts b/nym-wallet/src/components/Bonding/forms/gatewayValidationSchema.ts index fb1625adc1..c126d6c309 100644 --- a/nym-wallet/src/components/Bonding/forms/gatewayValidationSchema.ts +++ b/nym-wallet/src/components/Bonding/forms/gatewayValidationSchema.ts @@ -1,5 +1,6 @@ import * as Yup from 'yup'; import { + isLessThan, isValidHostname, validateAmount, validateKey, @@ -56,4 +57,15 @@ export const amountSchema = Yup.object().shape({ return true; }), }), + operatorCost: Yup.object().shape({ + amount: Yup.string() + .required('An operating cost is required') + .test('valid-operating-cost', 'A valid amount is required (min 40)', async function isValidAmount(this, value) { + if (value && (!Number(value) || isLessThan(+value, 40))) { + return false; + } + + return true; + }), + }), }); diff --git a/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx b/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx index f6bc04f6c7..d983da0f51 100644 --- a/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx +++ b/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx @@ -24,7 +24,7 @@ const defaultGatewayValues: GatewayData = { const defaultAmountValues = (denom: CurrencyDenom) => ({ amount: { amount: '100', denom }, - operatorCost: { amount: '0', denom }, + operatorCost: { amount: '40', denom }, tokenPool: 'balance', }); diff --git a/nym-wallet/src/pages/bonding/node-settings/NodeSettings.tsx b/nym-wallet/src/pages/bonding/node-settings/NodeSettings.tsx index 096e1632a3..c9bd51687f 100644 --- a/nym-wallet/src/pages/bonding/node-settings/NodeSettings.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/NodeSettings.tsx @@ -15,7 +15,8 @@ import { AppContext, urls } from 'src/context/main'; import { NodeGeneralSettings } from './settings-pages/general-settings'; import { NodeUnbondPage } from './settings-pages/NodeUnbondPage'; -import { navItems, NodeSettingsNav } from './node-settings.constant'; +import { createNavItems } from './node-settings.constant'; +import { isMixnode } from 'src/types'; export const NodeSettings = () => { const theme = useTheme(); @@ -25,9 +26,9 @@ export const NodeSettings = () => { const location = useLocation(); const [confirmationDetails, setConfirmationDetails] = useState(); - const [value, setValue] = React.useState('General'); + const [value, setValue] = React.useState('General'); const handleChange = (event: React.SyntheticEvent, tab: string) => { - setValue(tab as NodeSettingsNav); + setValue(tab); }; useEffect(() => { @@ -53,6 +54,10 @@ export const NodeSettings = () => { }); }; + if (!bondedNode) { + return null; + } + return ( { { + const navItems = ['Unbond']; + if (isMixnode) return ['General', ...navItems]; + return navItems; +};