diff --git a/src/routes/safe/components/Settings/Advanced/ChangeThreshold/index.tsx b/src/routes/safe/components/Settings/Advanced/ChangeThreshold/index.tsx deleted file mode 100644 index d9f1f765..00000000 --- a/src/routes/safe/components/Settings/Advanced/ChangeThreshold/index.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import IconButton from '@material-ui/core/IconButton' -import MenuItem from '@material-ui/core/MenuItem' -import { withStyles } from '@material-ui/core/styles' -import Close from '@material-ui/icons/Close' -import React, { useEffect, useState } from 'react' - -import { styles } from './style' - -import Field from 'src/components/forms/Field' -import GnoForm from 'src/components/forms/GnoForm' -import SelectField from 'src/components/forms/SelectField' -import { composeValidators, differentFrom, minValue, mustBeInteger, required } from 'src/components/forms/validator' -import Block from 'src/components/layout/Block' -import Button from 'src/components/layout/Button' -import Col from 'src/components/layout/Col' -import Hairline from 'src/components/layout/Hairline' -import Paragraph from 'src/components/layout/Paragraph' -import Row from 'src/components/layout/Row' -import { getGnosisSafeInstanceAt } from 'src/logic/contracts/safeContracts' -import { estimateTxGasCosts } from 'src/logic/safe/transactions/gasNew' -import { formatAmount } from 'src/logic/tokens/utils/formatAmount' -import { getWeb3 } from 'src/logic/wallets/getWeb3' - -const THRESHOLD_FIELD_NAME = 'threshold' - -const ChangeThreshold = ({ classes, onChangeThreshold, onClose, owners, safeAddress, threshold }) => { - const [gasCosts, setGasCosts] = useState('< 0.001') - - useEffect(() => { - let isCurrent = true - const estimateGasCosts = async () => { - const web3 = getWeb3() - const { fromWei, toBN } = web3.utils - const safeInstance = await getGnosisSafeInstanceAt(safeAddress) - const txData = safeInstance.contract.methods.changeThreshold('1').encodeABI() - const estimatedGasCosts = await estimateTxGasCosts(safeAddress, safeAddress, txData) - const gasCostsAsEth = fromWei(toBN(estimatedGasCosts), 'ether') - const formattedGasCosts = formatAmount(gasCostsAsEth) - if (isCurrent) { - setGasCosts(formattedGasCosts) - } - } - - estimateGasCosts() - - return () => { - isCurrent = false - } - }, [safeAddress]) - - const handleSubmit = (values) => { - const newThreshold = values[THRESHOLD_FIELD_NAME] - - onClose() - onChangeThreshold(newThreshold) - } - - return ( - <> - - - Change required confirmations - - - - - - - - {() => ( - <> - - - Any transaction requires the confirmation of: - - - - ( - <> - - {[...Array(Number(owners.size))].map((x, index) => ( - - {index + 1} - - ))} - - {props.meta.error && props.meta.touched && ( - - {props.meta.error} - - )} - - )} - validate={composeValidators(required, mustBeInteger, minValue(1), differentFrom(threshold))} - /> - - - - {`out of ${owners.size} owner(s)`} - - - - - - {`You're about to create a transaction and will have to confirm it with your currently connected wallet. Make sure you have ${gasCosts} (fee price) ETH in this wallet to fund this confirmation.`} - - - - - - - - - - )} - - - ) -} - -export default withStyles(styles as any)(ChangeThreshold) diff --git a/src/routes/safe/components/Settings/Advanced/ChangeThreshold/style.ts b/src/routes/safe/components/Settings/Advanced/ChangeThreshold/style.ts deleted file mode 100644 index e0f9c000..00000000 --- a/src/routes/safe/components/Settings/Advanced/ChangeThreshold/style.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { lg, md, secondaryText, sm } from 'src/theme/variables' - -export const styles = () => ({ - heading: { - padding: `${sm} ${lg}`, - justifyContent: 'space-between', - boxSizing: 'border-box', - maxHeight: '75px', - }, - annotation: { - letterSpacing: '-1px', - color: secondaryText, - marginRight: 'auto', - marginLeft: '20px', - }, - headingText: { - fontSize: '20px', - }, - close: { - height: '35px', - width: '35px', - }, - modalContent: { - padding: `${md} ${lg}`, - }, - ownersText: { - marginLeft: sm, - }, - buttonRow: { - height: '84px', - justifyContent: 'center', - position: 'absolute', - bottom: 0, - width: '100%', - }, - inputRow: { - position: 'relative', - }, - errorText: { - position: 'absolute', - bottom: '-25px', - }, -})