mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
isAddress utils replacement
This commit is contained in:
parent
00c145ad99
commit
b9b72f13c2
@ -16,9 +16,9 @@ import {
|
||||
getUserSales
|
||||
} from '@utils/aquarius'
|
||||
import axios, { CancelToken } from 'axios'
|
||||
import web3 from 'web3'
|
||||
import { useMarketMetadata } from '../MarketMetadata'
|
||||
import { getEnsProfile } from '@utils/ens'
|
||||
import { isAddress } from 'ethers/lib/utils'
|
||||
|
||||
interface ProfileProviderValue {
|
||||
profile: Profile
|
||||
@ -64,7 +64,7 @@ function ProfileProvider({
|
||||
// when accountId is no ETH address
|
||||
//
|
||||
useEffect(() => {
|
||||
const isEthAddress = web3.utils.isAddress(accountId)
|
||||
const isEthAddress = isAddress(accountId)
|
||||
setIsEthAddress(isEthAddress)
|
||||
}, [accountId])
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { FileInfo } from '@oceanprotocol/lib'
|
||||
import * as Yup from 'yup'
|
||||
import web3 from 'web3'
|
||||
import { isAddress } from 'ethers/lib/utils'
|
||||
import { testLinks } from '../../../@utils/yup'
|
||||
|
||||
export const validationSchema = Yup.object().shape({
|
||||
@ -41,7 +41,7 @@ export const validationSchema = Yup.object().shape({
|
||||
'ValidAddress',
|
||||
'Must be a valid Ethereum Address.',
|
||||
(value) => {
|
||||
return web3.utils.isAddress(value)
|
||||
return isAddress(value)
|
||||
}
|
||||
),
|
||||
retireAsset: Yup.string()
|
||||
|
@ -6,7 +6,7 @@ import ProfileProvider from '@context/Profile'
|
||||
import { getEnsAddress, getEnsName } from '@utils/ens'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useAccount, useEnsName } from 'wagmi'
|
||||
import { utils } from 'ethers'
|
||||
import { isAddress } from 'ethers/lib/utils'
|
||||
|
||||
export default function PageProfile(): ReactElement {
|
||||
const router = useRouter()
|
||||
@ -32,7 +32,7 @@ export default function PageProfile(): ReactElement {
|
||||
const pathAccount = router.query.account as string
|
||||
|
||||
// Path has ETH address
|
||||
if (utils.isAddress(pathAccount)) {
|
||||
if (isAddress(pathAccount)) {
|
||||
setOwnAccount(pathAccount === address)
|
||||
const finalAccountId = pathAccount || address
|
||||
setFinalAccountId(finalAccountId)
|
||||
|
@ -4,7 +4,7 @@ import Page from '@shared/Page'
|
||||
import { accountTruncate } from '@utils/web3'
|
||||
import { MAXIMUM_NUMBER_OF_PAGES_WITH_RESULTS } from '@utils/aquarius'
|
||||
import { useRouter } from 'next/router'
|
||||
import web3 from 'web3'
|
||||
import { isAddress } from 'ethers/lib/utils'
|
||||
|
||||
export default function PageSearch(): ReactElement {
|
||||
const router = useRouter()
|
||||
@ -13,7 +13,7 @@ export default function PageSearch(): ReactElement {
|
||||
const [totalResults, setTotalResults] = useState<number>()
|
||||
const [totalPagesNumber, setTotalPagesNumber] = useState<number>()
|
||||
|
||||
const isETHAddress = web3.utils.isAddress(text as string)
|
||||
const isETHAddress = isAddress(text as string)
|
||||
const searchValue =
|
||||
(isETHAddress ? accountTruncate(text as string) : text) ||
|
||||
tags ||
|
||||
|
Loading…
Reference in New Issue
Block a user