Refactor mustBeEthereumContractAddress validator

This commit is contained in:
Germán Martínez 2019-09-18 23:21:38 +02:00
parent 1f8ed4eb3b
commit af99c70299
2 changed files with 2 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import {
composeValidators, composeValidators,
required, required,
mustBeEthereumAddress, mustBeEthereumAddress,
mustBeEthereumContractAddress,
} from '~/components/forms/validator' } from '~/components/forms/validator'
import { getAddressFromENS } from '~/logic/wallets/getWeb3' import { getAddressFromENS } from '~/logic/wallets/getWeb3'
@ -20,7 +19,6 @@ type Props = {
testId?: string, testId?: string,
validators?: Function[], validators?: Function[],
inputAdornment?: React.Element, inputAdornment?: React.Element,
mustBeContract?: boolean,
} }
const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name) const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)
@ -37,7 +35,6 @@ const AddressInput = ({
testId, testId,
inputAdornment, inputAdornment,
validators = [], validators = [],
mustBeContract,
}: Props): React.Element<*> => ( }: Props): React.Element<*> => (
<> <>
<Field <Field
@ -47,7 +44,6 @@ const AddressInput = ({
validate={composeValidators( validate={composeValidators(
required, required,
mustBeEthereumAddress, mustBeEthereumAddress,
mustBeContract && mustBeEthereumContractAddress,
...validators, ...validators,
)} )}
inputAdornment={inputAdornment} inputAdornment={inputAdornment}

View File

@ -20,6 +20,7 @@ import {
composeValidators, composeValidators,
mustBeFloat, mustBeFloat,
maxValue, maxValue,
mustBeEthereumContractAddress,
} from '~/components/forms/validator' } from '~/components/forms/validator'
import SafeInfo from '~/routes/safe/components/Balances/SendModal/SafeInfo' import SafeInfo from '~/routes/safe/components/Balances/SendModal/SafeInfo'
import ArrowDown from '../assets/arrow-down.svg' import ArrowDown from '../assets/arrow-down.svg'
@ -103,7 +104,7 @@ const SendCustomTx = ({
text="Recipient*" text="Recipient*"
className={classes.addressInput} className={classes.addressInput}
fieldMutator={mutators.setRecipient} fieldMutator={mutators.setRecipient}
mustBeContract validators={[mustBeEthereumContractAddress]}
/> />
</Col> </Col>
</Row> </Row>