Refactor mustBeEthereumContractAddress validator
This commit is contained in:
parent
1f8ed4eb3b
commit
af99c70299
|
@ -7,7 +7,6 @@ import {
|
|||
composeValidators,
|
||||
required,
|
||||
mustBeEthereumAddress,
|
||||
mustBeEthereumContractAddress,
|
||||
} from '~/components/forms/validator'
|
||||
import { getAddressFromENS } from '~/logic/wallets/getWeb3'
|
||||
|
||||
|
@ -20,7 +19,6 @@ type Props = {
|
|||
testId?: string,
|
||||
validators?: Function[],
|
||||
inputAdornment?: React.Element,
|
||||
mustBeContract?: boolean,
|
||||
}
|
||||
|
||||
const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)
|
||||
|
@ -37,7 +35,6 @@ const AddressInput = ({
|
|||
testId,
|
||||
inputAdornment,
|
||||
validators = [],
|
||||
mustBeContract,
|
||||
}: Props): React.Element<*> => (
|
||||
<>
|
||||
<Field
|
||||
|
@ -47,7 +44,6 @@ const AddressInput = ({
|
|||
validate={composeValidators(
|
||||
required,
|
||||
mustBeEthereumAddress,
|
||||
mustBeContract && mustBeEthereumContractAddress,
|
||||
...validators,
|
||||
)}
|
||||
inputAdornment={inputAdornment}
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
composeValidators,
|
||||
mustBeFloat,
|
||||
maxValue,
|
||||
mustBeEthereumContractAddress,
|
||||
} from '~/components/forms/validator'
|
||||
import SafeInfo from '~/routes/safe/components/Balances/SendModal/SafeInfo'
|
||||
import ArrowDown from '../assets/arrow-down.svg'
|
||||
|
@ -103,7 +104,7 @@ const SendCustomTx = ({
|
|||
text="Recipient*"
|
||||
className={classes.addressInput}
|
||||
fieldMutator={mutators.setRecipient}
|
||||
mustBeContract
|
||||
validators={[mustBeEthereumContractAddress]}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
Loading…
Reference in New Issue