move `isValidEnsName` to utils

This commit is contained in:
fernandomg 2020-06-03 16:29:27 -03:00
parent 45a3719bb0
commit 3ac845106b
3 changed files with 4 additions and 4 deletions

View File

@ -5,8 +5,7 @@ import { OnChange } from 'react-final-form-listeners'
import TextField from 'src/components/forms/TextField'
import { composeValidators, mustBeEthereumAddress, required } from 'src/components/forms/validator'
import { getAddressFromENS } from 'src/logic/wallets/getWeb3'
const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)
import { isValidEnsName } from 'src/logic/wallets/ethAddresses'
// an idea for second field was taken from here
// https://github.com/final-form/react-final-form-listeners/blob/master/src/OnBlur.js

View File

@ -43,3 +43,5 @@ export const isUserOwner = (safe, userAccount) => {
}
export const isUserOwnerOnAnySafe = (safes, userAccount) => safes.some((safe) => isUserOwner(safe, userAccount))
export const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)

View File

@ -12,6 +12,7 @@ import Identicon from 'src/components/Identicon'
import { mustBeEthereumAddress, mustBeEthereumContractAddress } from 'src/components/forms/validator'
import { getAddressBookListSelector } from 'src/logic/addressBook/store/selectors'
import { getAddressFromENS } from 'src/logic/wallets/getWeb3'
import { isValidEnsName } from 'src/logic/wallets/ethAddresses'
const textFieldLabelStyle = makeStyles(() => ({
root: {
@ -38,8 +39,6 @@ const filterAddressBookWithContractAddresses = async (addressBook) => {
return addressBook.filter((adbkEntry, index) => abFlags[index])
}
const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)
const AddressBookInput = ({
classes,
fieldMutator,