diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/BondGatewayForm.tsx b/nym-wallet/src/components/Bonding/forms/legacyForms/BondGatewayForm.tsx deleted file mode 100644 index 843d604053..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/BondGatewayForm.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import { Box } from '@mui/material'; -import { NodeTypeSelector } from 'src/components'; -import { CurrencyDenom, TNodeType } from '@nymproject/types'; -import { GatewayAmount, GatewayData } from 'src/pages/bonding/types'; -import GatewayInitForm from './GatewayInitForm'; -import GatewayAmountForm from './GatewayAmountForm'; - -export const BondGatewayForm = ({ - step, - denom, - gatewayData, - amountData, - hasVestingTokens, - onSelectNodeType, - onValidateGatewayData, - onValidateAmountData, -}: { - step: 1 | 2 | 3 | 4; - gatewayData: GatewayData; - amountData: GatewayAmount; - denom: CurrencyDenom; - hasVestingTokens: boolean; - onSelectNodeType: (nodeType: TNodeType) => void; - onValidateGatewayData: (data: GatewayData) => void; - onValidateAmountData: (data: GatewayAmount) => Promise; -}) => ( - <> - {step === 1 && ( - <> - - - - - - )} - {step === 2 && ( - - )} - -); diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayAmountForm.tsx b/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayAmountForm.tsx deleted file mode 100644 index 7135d2b154..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayAmountForm.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React, { useEffect } from 'react'; -import { CurrencyDenom } from '@nymproject/types'; -import { useForm } from 'react-hook-form'; -import { yupResolver } from '@hookform/resolvers/yup/dist/yup'; -import { CurrencyFormField } from '@nymproject/react/currency/CurrencyFormField'; -import { Box, Stack } from '@mui/material'; -import { amountSchema } from './gatewayValidationSchema'; -import { checkHasEnoughFunds, checkHasEnoughLockedTokens } from '../../../../utils'; -import { GatewayAmount } from '../../../../pages/bonding/types'; -import { TokenPoolSelector } from '../../../TokenPoolSelector'; - -const GatewayAmountForm = ({ - denom, - amountData, - hasVestingTokens, - onNext, -}: { - denom: CurrencyDenom; - amountData: GatewayAmount; - hasVestingTokens: boolean; - onNext: (data: any) => void; -}) => { - const { - formState: { errors }, - handleSubmit, - setValue, - getValues, - setError, - } = useForm({ resolver: yupResolver(amountSchema), defaultValues: amountData }); - - const handleRequestValidation = async (event: { detail: { step: number } }) => { - let hasSufficientTokens = true; - const values = getValues(); - - if (values.tokenPool === 'balance') { - hasSufficientTokens = await checkHasEnoughFunds(values.amount.amount); - } - - if (values.tokenPool === 'locked') { - hasSufficientTokens = await checkHasEnoughLockedTokens(values.amount.amount); - } - - if (event.detail.step === 2 && hasSufficientTokens) { - handleSubmit(onNext)(); - } else { - setError('amount.amount', { message: 'Not enough tokens' }); - } - }; - - useEffect(() => { - window.addEventListener('validate_bond_gateway_step' as any, handleRequestValidation); - return () => window.removeEventListener('validate_bond_gateway_step' as any, handleRequestValidation); - }, []); - - return ( - - - {hasVestingTokens && setValue('tokenPool', pool)} />} - setValue('amount', newValue, { shouldValidate: true })} - validationError={errors.amount?.amount?.message} - denom={denom} - initialValue={amountData.amount.amount} - /> - setValue('operatorCost', newValue, { shouldValidate: true })} - validationError={errors.operatorCost?.amount?.message} - denom={denom} - initialValue={amountData.operatorCost.amount} - /> - - - ); -}; - -export default GatewayAmountForm; diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayInitForm.tsx b/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayInitForm.tsx deleted file mode 100644 index 5a891700c9..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/GatewayInitForm.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useForm } from 'react-hook-form'; -import { clean } from 'semver'; -import { Checkbox, FormControlLabel, Stack, TextField } from '@mui/material'; -import { IdentityKeyFormField } from '@nymproject/react/mixnodes/IdentityKeyFormField'; -import { yupResolver } from '@hookform/resolvers/yup/dist/yup'; -import { GatewayData } from '../../../../pages/bonding/types'; -import { gatewayValidationSchema } from './gatewayValidationSchema'; - -const GatewayInitForm = ({ - gatewayData, - onNext, -}: { - gatewayData: GatewayData; - onNext: (data: GatewayData) => void; -}) => { - const [showAdvancedOptions, setShowAdvancedOptions] = useState(false); - - const { - register, - formState: { errors }, - handleSubmit, - setValue, - } = useForm({ resolver: yupResolver(gatewayValidationSchema), defaultValues: gatewayData }); - - const handleRequestValidation = (event: { detail: { step: number } }) => { - if (event.detail.step === 1) { - handleSubmit((data) => { - const validatedData = { - ...data, - version: clean(data.version) as string, - }; - onNext(validatedData); - })(); - } - }; - - useEffect(() => { - window.addEventListener('validate_bond_gateway_step' as any, handleRequestValidation); - return () => window.removeEventListener('validate_bond_gateway_step' as any, handleRequestValidation); - }, []); - - return ( - - setValue('identityKey', value)} - showTickOnValid={false} - /> - - - - - - - setShowAdvancedOptions((show) => !show)} checked={showAdvancedOptions} />} - label="Show advanced options" - /> - {showAdvancedOptions && ( - - - - - )} - - ); -}; - -export default GatewayInitForm; diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeAmountForm.tsx b/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeAmountForm.tsx deleted file mode 100644 index 13176dadf6..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeAmountForm.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import React, { useContext, useEffect } from 'react'; -import { useForm } from 'react-hook-form'; -import { Box, FormHelperText, Stack, TextField, Typography } from '@mui/material'; -import { yupResolver } from '@hookform/resolvers/yup/dist/yup'; -import { CurrencyFormField } from '@nymproject/react/currency/CurrencyFormField'; -import { CurrencyDenom } from '@nymproject/types'; -import { amountSchema } from './mixnodeValidationSchema'; -import { MixnodeAmount } from '../../../../pages/bonding/types'; -import { AppContext } from '../../../../context'; -import { checkHasEnoughFunds, checkHasEnoughLockedTokens } from '../../../../utils'; -import { TokenPoolSelector } from '../../../TokenPoolSelector'; -import { ModalListItem } from '../../../Modals/ModalListItem'; - -const MixnodeAmountForm = ({ - amountData, - hasVestingTokens, - denom, - onNext, -}: { - amountData: MixnodeAmount; - hasVestingTokens: boolean; - denom: CurrencyDenom; - onNext: (data: MixnodeAmount) => void; -}) => { - const { mixnetContractParams } = useContext(AppContext); - - const { - register, - formState: { errors }, - handleSubmit, - setValue, - getValues, - setError, - } = useForm({ resolver: yupResolver(amountSchema(mixnetContractParams)), defaultValues: amountData }); - - const { userBalance } = useContext(AppContext); - - const handleRequestValidation = async (event: { detail: { step: number } }) => { - let hasSufficientTokens = true; - const values = getValues(); - - if (values.tokenPool === 'balance') { - hasSufficientTokens = await checkHasEnoughFunds(values.amount.amount); - } - - if (values.tokenPool === 'locked') { - hasSufficientTokens = await checkHasEnoughLockedTokens(values.amount.amount); - } - - if (event.detail.step === 2 && hasSufficientTokens) { - handleSubmit(onNext)(); - } else { - setError('amount.amount', { message: 'Not enough tokens' }); - } - }; - - useEffect(() => { - window.addEventListener('validate_bond_mixnode_step' as any, handleRequestValidation); - return () => window.removeEventListener('validate_bond_mixnode_step' as any, handleRequestValidation); - }, []); - - return ( - - - {hasVestingTokens && setValue('tokenPool', pool)} />} - { - setValue('amount', newValue, { shouldValidate: true }); - }} - validationError={errors.amount?.amount?.message} - denom={denom} - initialValue={amountData.amount.amount} - /> - - - { - setValue('operatorCost', newValue, { shouldValidate: true }); - }} - validationError={errors.operatorCost?.amount?.message} - denom={denom} - initialValue={amountData.operatorCost.amount} - /> - - Monthly operational costs of running your node. If your node is in the active set the amount will be paid back - to you from the rewards. - - - - - - The percentage of node rewards that you as the node operator take before rewards are distributed to operator - and delegators. - - - - {!hasVestingTokens && ( - - )} - Est. fee for this transaction will be calculated in the next page - - - ); -}; - -export default MixnodeAmountForm; diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeInitForm.tsx b/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeInitForm.tsx deleted file mode 100644 index 0032bb3364..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/MixnodeInitForm.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { useForm } from 'react-hook-form'; -import { clean } from 'semver'; -import { Checkbox, FormControlLabel, Stack, TextField } from '@mui/material'; -import { IdentityKeyFormField } from '@nymproject/react/mixnodes/IdentityKeyFormField'; -import { yupResolver } from '@hookform/resolvers/yup/dist/yup'; -import { mixnodeValidationSchema } from './mixnodeValidationSchema'; -import { MixnodeData } from '../../../../pages/bonding/types'; - -const MixnodeInitForm = ({ mixnodeData, onNext }: { mixnodeData: MixnodeData; onNext: (data: any) => void }) => { - const [showAdvancedOptions, setShowAdvancedOptions] = useState(false); - - const { - register, - formState: { errors }, - handleSubmit, - setValue, - } = useForm({ resolver: yupResolver(mixnodeValidationSchema), defaultValues: mixnodeData }); - - const handleRequestValidation = (event: { detail: { step: number } }) => { - if (event.detail.step === 1) { - handleSubmit((data) => { - const validatedData = { - ...data, - version: clean(data.version), - }; - onNext(validatedData); - })(); - } - }; - - useEffect(() => { - window.addEventListener('validate_bond_mixnode_step' as any, handleRequestValidation); - return () => window.removeEventListener('validate_bond_mixnode_step' as any, handleRequestValidation); - }, []); - - return ( - - setValue('identityKey', value)} - showTickOnValid={false} - /> - - - - - - setShowAdvancedOptions((show) => !show)} checked={showAdvancedOptions} />} - label="Show advanced options" - /> - {showAdvancedOptions && ( - - - - - - )} - - ); -}; - -export default MixnodeInitForm; diff --git a/nym-wallet/src/components/Bonding/forms/legacyForms/gatewayValidationSchema.ts b/nym-wallet/src/components/Bonding/forms/legacyForms/gatewayValidationSchema.ts deleted file mode 100644 index 9de1e6a1f7..0000000000 --- a/nym-wallet/src/components/Bonding/forms/legacyForms/gatewayValidationSchema.ts +++ /dev/null @@ -1,91 +0,0 @@ -import * as Yup from 'yup'; -import { - isLessThan, - isValidHostname, - validateAmount, - validateKey, - validateLocation, - validateRawPort, - validateVersion, -} from 'src/utils'; - -export const gatewayValidationSchema = Yup.object().shape({ - identityKey: Yup.string() - .required('An identity key is required') - .test('valid-id-key', 'A valid identity key is required', (value) => validateKey(value || '', 32)), - - sphinxKey: Yup.string() - .required('A sphinx key is required') - .test('valid-sphinx-key', 'A valid sphinx key is required', (value) => validateKey(value || '', 32)), - - host: Yup.string() - .required('A host is required') - .test('no-whitespace', 'Host cannot contain whitespace', (value) => !/\s/.test(value || '')) - .test('valid-host', 'A valid host is required', (value) => (value ? isValidHostname(value) : false)), - - version: Yup.string() - .required('A version is required') - .test('no-whitespace', 'A version cannot contain whitespace', (value) => !/\s/.test(value || '')) - .test('valid-version', 'A valid version is required', (value) => (value ? validateVersion(value) : false)), - - location: Yup.string() - .required('A location is required') - .test('valid-location', 'A valid location is required', (locationValueTest) => - locationValueTest ? validateLocation(locationValueTest) : false, - ), - - mixPort: Yup.number() - .required('A mixport is required') - .test('valid-mixport', 'A valid mixport is required', (value) => (value ? validateRawPort(value) : false)), - - clientsPort: Yup.number() - .required('A clients port is required') - .test('valid-clients', 'A valid clients port is required', (value) => (value ? validateRawPort(value) : false)), -}); - -export const amountSchema = Yup.object().shape({ - amount: Yup.object().shape({ - amount: Yup.string() - .required('An amount is required') - .test('valid-amount', 'Pledge error', async function isValidAmount(this, value) { - const isValid = await validateAmount(value || '', '100'); - if (!isValid) { - return this.createError({ message: 'A valid amount is required (min 100)' }); - } - return true; - }), - }), - operatorCost: Yup.object().shape({ - amount: Yup.string() - .required('An operating cost is required') - // eslint-disable-next-line - .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; - }), - }), -}); - -export const updateGatewayValidationSchema = Yup.object().shape({ - host: Yup.string() - .required('A host is required') - .test('no-whitespace', 'Host cannot contain whitespace', (value) => !/\s/.test(value || '')) - .test('valid-host', 'A valid host is required', (value) => (value ? isValidHostname(value) : false)), - - mixPort: Yup.number() - .required('A mixport is required') - .test('valid-mixport', 'A valid mixport is required', (value) => (value ? validateRawPort(value) : false)), - - httpApiPort: Yup.number() - .required('A clients port is required') - .test('valid-clients', 'A valid clients port is required', (value) => (value ? validateRawPort(value) : false)), - location: Yup.string().test('valid-location', 'A valid location is required', (value) => - value ? validateLocation(value) : false, - ), - version: Yup.string() - .test('no-whitespace', 'A version cannot contain whitespace', (value) => !/\s/.test(value || '')) - .test('valid-version', 'A valid version is required', (value) => (value ? validateVersion(value) : false)), -}); diff --git a/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx b/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx deleted file mode 100644 index 1060b7c533..0000000000 --- a/nym-wallet/src/components/Bonding/modals/BondGatewayModal.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import React, { useContext, useEffect, useState } from 'react'; -import { Box } from '@mui/material'; -import { CurrencyDenom, TNodeType } from '@nymproject/types'; -import { ConfirmTx } from 'src/components/ConfirmTX'; -import { ModalListItem } from 'src/components/Modals/ModalListItem'; -import { SimpleModal } from 'src/components/Modals/SimpleModal'; -import { useGetFee } from 'src/hooks/useGetFee'; -import { GatewayAmount, GatewayData } from 'src/pages/bonding/types'; -import { BalanceWarning } from 'src/components/FeeWarning'; -import { AppContext } from 'src/context'; -import { BondGatewayForm } from '../forms/legacyForms/BondGatewayForm'; - -const defaultGatewayValues: GatewayData = { - identityKey: '', - sphinxKey: '', - ownerSignature: '', - location: '', - host: '', - version: '', - mixPort: 1789, - clientsPort: 9000, -}; - -const defaultAmountValues = (denom: CurrencyDenom) => ({ - amount: { amount: '100', denom }, - operatorCost: { amount: '40', denom }, - tokenPool: 'balance', -}); - -export const BondGatewayModal = ({ - denom, - hasVestingTokens, - onSelectNodeType, - onClose, - onError, -}: { - denom: CurrencyDenom; - hasVestingTokens: boolean; - onSelectNodeType: (type: TNodeType) => void; - onClose: () => void; - onError: (e: string) => void; -}) => { - const [step, setStep] = useState<1 | 2 | 3>(1); - const [gatewayData, setGatewayData] = useState(defaultGatewayValues); - const [amountData, setAmountData] = useState(defaultAmountValues(denom)); - - const { fee, resetFeeState, feeError } = useGetFee(); - const { userBalance } = useContext(AppContext); - - useEffect(() => { - if (feeError) { - onError(feeError); - } - }, [feeError]); - - const validateStep = async (s: number) => { - const event = new CustomEvent('validate_bond_gateway_step', { detail: { step: s } }); - window.dispatchEvent(event); - }; - - const handleBack = () => { - if (step === 2) { - setStep(1); - } else if (step === 3) { - setStep(2); - } - }; - - const handleUpdateGatwayData = (data: GatewayData) => { - setGatewayData(data); - setStep(2); - }; - - const handleUpdateAmountData = async (data: GatewayAmount) => { - setAmountData(data); - setStep(3); - }; - - const handleConfirm = async () => {}; - - if (fee) { - return ( - - - - {fee.amount?.amount && userBalance.balance && ( - - )} - - ); - } - - return ( - { - await validateStep(step); - }} - onBack={step === 2 ? handleBack : undefined} - onClose={onClose} - header="Bond gateway" - subHeader={`Step ${step}/3`} - okLabel="Next" - > - - - - - ); -}; diff --git a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralGatewaySettings.tsx b/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralGatewaySettings.tsx deleted file mode 100644 index 7f8bdb6d08..0000000000 --- a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralGatewaySettings.tsx +++ /dev/null @@ -1,254 +0,0 @@ -import React, { useContext, useState } from 'react'; -import { useForm } from 'react-hook-form'; -import { clean } from 'semver'; -import { yupResolver } from '@hookform/resolvers/yup'; -import { Button, Divider, Typography, TextField, Grid, Box } from '@mui/material'; -import { useTheme } from '@mui/material/styles'; -import { - simulateUpdateGatewayConfig, - simulateVestingUpdateGatewayConfig, - updateGatewayConfig, - vestingUpdateGatewayConfig, -} from 'src/requests'; -import { useBondingContext } from 'src/context/bonding'; -import { SimpleModal } from 'src/components/Modals/SimpleModal'; -import { Console } from 'src/utils/console'; -import { Alert } from 'src/components/Alert'; -import { ConfirmTx } from 'src/components/ConfirmTX'; -import { useGetFee } from 'src/hooks/useGetFee'; -import { LoadingModal } from 'src/components/Modals/LoadingModal'; -import { updateGatewayValidationSchema } from 'src/components/Bonding/forms/legacyForms/gatewayValidationSchema'; -import { BalanceWarning } from 'src/components/FeeWarning'; -import { AppContext } from 'src/context'; -import { TBondedGateway } from 'src/requests/gatewayDetails'; - -export const GeneralGatewaySettings = ({ bondedNode }: { bondedNode: TBondedGateway }) => { - const [openConfirmationModal, setOpenConfirmationModal] = useState(false); - const { getFee, fee, resetFeeState } = useGetFee(); - const { refresh } = useBondingContext(); - const { userBalance } = useContext(AppContext); - - const theme = useTheme(); - - const { - register, - handleSubmit, - formState: { errors, isSubmitting, isDirty, isValid }, - } = useForm({ - resolver: yupResolver(updateGatewayValidationSchema), - mode: 'onChange', - defaultValues: { - host: bondedNode.host, - mixPort: bondedNode.mixPort, - httpApiPort: bondedNode.httpApiPort, - version: bondedNode.version, - location: bondedNode.location, - }, - }); - - const onSubmit = async (data: any) => { - resetFeeState(); - const { host, mixPort, httpApiPort, version, location } = data; - - try { - const GatewayConfigParams = { - host, - mix_port: mixPort, - location, - version: clean(version) as string, - clients_port: httpApiPort, - }; - - if (bondedNode.proxy) { - await vestingUpdateGatewayConfig(GatewayConfigParams, fee?.fee); - } else { - await updateGatewayConfig(GatewayConfigParams, fee?.fee); - } - - setOpenConfirmationModal(true); - } catch (error) { - Console.error(error); - } - }; - - return ( - - {fee && ( - onSubmit(d))} - onPrev={resetFeeState} - onClose={resetFeeState} - > - {fee.amount?.amount && userBalance?.balance?.amount.amount && ( - - - - )} - - )} - {isSubmitting && } - - Changing these values will ONLY change the data about your node on the blockchain. Remember to change your - node’s config file with the same values too - - } - dismissable - /> - - - - - Port - - - - - - - - - - - - - - - - - Host - - - - - - - - - - - - Version - - - - - - - - - - - - Location - - - - - - - - - - - - - - { - setOpenConfirmationModal(false); - await refresh(); - }} - buttonFullWidth - sx={{ - width: '450px', - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - }} - headerStyles={{ - width: '100%', - mb: 1, - textAlign: 'center', - color: theme.palette.nym.nymWallet.text.blue, - fontSize: 16, - }} - subHeaderStyles={{ - width: '100%', - mb: 1, - textAlign: 'center', - color: 'main', - fontSize: 14, - }} - /> - - ); -}; diff --git a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralMixnodeSettings.tsx b/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralMixnodeSettings.tsx deleted file mode 100644 index 08304622c7..0000000000 --- a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/GeneralMixnodeSettings.tsx +++ /dev/null @@ -1,245 +0,0 @@ -import React, { useContext, useState } from 'react'; -import { useForm } from 'react-hook-form'; -import { yupResolver } from '@hookform/resolvers/yup'; -import { clean } from 'semver'; -import { Box, Button, Divider, Grid, Stack, TextField, Typography } from '@mui/material'; -import { useTheme } from '@mui/material/styles'; -import { isMixnode } from 'src/types'; -import { simulateUpdateMixnodeConfig, simulateVestingUpdateMixnodeConfig, updateMixnodeConfig } from 'src/requests'; -import { SimpleModal } from 'src/components/Modals/SimpleModal'; -import { bondedInfoParametersValidationSchema } from 'src/components/Bonding/forms/legacyForms/mixnodeValidationSchema'; -import { Console } from 'src/utils/console'; -import { Alert } from 'src/components/Alert'; -import { vestingUpdateMixnodeConfig } from 'src/requests/vesting'; -import { ConfirmTx } from 'src/components/ConfirmTX'; -import { useGetFee } from 'src/hooks/useGetFee'; -import { LoadingModal } from 'src/components/Modals/LoadingModal'; -import { BalanceWarning } from 'src/components/FeeWarning'; -import { AppContext } from 'src/context'; -import { TBondedMixnode } from 'src/requests/mixnodeDetails'; - -export const GeneralMixnodeSettings = ({ bondedNode }: { bondedNode: TBondedMixnode }) => { - const [openConfirmationModal, setOpenConfirmationModal] = useState(false); - const { getFee, fee, resetFeeState } = useGetFee(); - const { userBalance } = useContext(AppContext); - - const theme = useTheme(); - - const { - register, - handleSubmit, - formState: { errors, isSubmitting, isDirty, isValid }, - } = useForm({ - resolver: yupResolver(bondedInfoParametersValidationSchema), - mode: 'onChange', - defaultValues: isMixnode(bondedNode) ? bondedNode : {}, - }); - - const onSubmit = async (data: { - host?: string; - version?: string; - mixPort?: number; - verlocPort?: number; - httpApiPort?: number; - }) => { - resetFeeState(); - const { host, version, mixPort, verlocPort, httpApiPort } = data; - if (host && version && mixPort && verlocPort && httpApiPort) { - const MixNodeConfigParams = { - host, - mix_port: mixPort, - verloc_port: verlocPort, - http_api_port: httpApiPort, - version: clean(version) as string, - }; - try { - if (bondedNode.proxy) { - await vestingUpdateMixnodeConfig(MixNodeConfigParams); - } else { - await updateMixnodeConfig(MixNodeConfigParams); - } - setOpenConfirmationModal(true); - } catch (error) { - Console.error(error); - } - } - }; - - return ( - - {fee && ( - onSubmit(d))} - onPrev={resetFeeState} - onClose={resetFeeState} - > - {fee.amount?.amount && userBalance?.balance?.amount.amount && ( - - - - )} - - )} - {isSubmitting && } - - - Changing these values will ONLY change the data about your node on the blockchain. - - Remember to change your node’s config file with the same values too. - - } - bgColor={`${theme.palette.nym.nymWallet.text.blue}0D !important`} - dismissable - /> - - - - - Port - - - - - - - - - - - - - - - - - - - Host - - - - - - - - - - - - - Version - - - - - - - - - - - - - - - - - { - await setOpenConfirmationModal(false); - }} - buttonFullWidth - sx={{ - width: '450px', - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center', - }} - headerStyles={{ - width: '100%', - mb: 1, - textAlign: 'center', - color: theme.palette.nym.nymWallet.text.blue, - fontSize: 16, - }} - subHeaderStyles={{ - width: '100%', - mb: 1, - textAlign: 'center', - color: 'main', - fontSize: 14, - }} - /> - - ); -}; diff --git a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/index.tsx b/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/index.tsx index 7c1f4568b4..5157587737 100644 --- a/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/index.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/settings-pages/general-settings/index.tsx @@ -2,9 +2,7 @@ import React, { useState } from 'react'; import { Box, Button, Divider, Grid } from '@mui/material'; import { isGateway, isMixnode, isNymNode } from 'src/types'; import { TBondedNode } from 'src/context/bonding'; -import { GeneralMixnodeSettings } from './GeneralMixnodeSettings'; import { ParametersSettings } from './ParametersSettings'; -import { GeneralGatewaySettings } from './GeneralGatewaySettings'; import { GeneralNymNodeSettings } from './GeneralNymNodeSettings'; const makeGeneralNav = (bondedNode: TBondedNode) => { @@ -22,8 +20,6 @@ export const NodeGeneralSettings = ({ bondedNode }: { bondedNode: TBondedNode }) const getSettings = () => { switch (navSelection) { case 0: { - if (isMixnode(bondedNode)) return ; - if (isGateway(bondedNode)) return ; if (isNymNode(bondedNode)) return ; break; }