move `isValidEnsName` to utils
This commit is contained in:
parent
45a3719bb0
commit
3ac845106b
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue