Commit 4c91e208 authored by tom's avatar tom

remove Address component, pt.1

parent 0409b908
...@@ -12,10 +12,8 @@ import dayjs from 'lib/date/dayjs'; ...@@ -12,10 +12,8 @@ import dayjs from 'lib/date/dayjs';
import useSocketChannel from 'lib/socket/useSocketChannel'; import useSocketChannel from 'lib/socket/useSocketChannel';
import useSocketMessage from 'lib/socket/useSocketMessage'; import useSocketMessage from 'lib/socket/useSocketMessage';
import * as stubs from 'stubs/contract'; import * as stubs from 'stubs/contract';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import DataFetchAlert from 'ui/shared/DataFetchAlert'; import DataFetchAlert from 'ui/shared/DataFetchAlert';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import LinkExternal from 'ui/shared/LinkExternal'; import LinkExternal from 'ui/shared/LinkExternal';
import LinkInternal from 'ui/shared/LinkInternal'; import LinkInternal from 'ui/shared/LinkInternal';
import RawDataSnippet from 'ui/shared/RawDataSnippet'; import RawDataSnippet from 'ui/shared/RawDataSnippet';
...@@ -171,10 +169,12 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -171,10 +169,12 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
{ !data?.is_verified && data?.verified_twin_address_hash && !data?.minimal_proxy_address_hash && ( { !data?.is_verified && data?.verified_twin_address_hash && !data?.minimal_proxy_address_hash && (
<Alert status="warning" whiteSpace="pre-wrap" flexWrap="wrap"> <Alert status="warning" whiteSpace="pre-wrap" flexWrap="wrap">
<span>Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB </span> <span>Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB </span>
<Address> <AddressEntity
<AddressIcon address={{ hash: data.verified_twin_address_hash, is_contract: true, implementation_name: null }}/> address={{ hash: data.verified_twin_address_hash, is_contract: true, implementation_name: null }}
<AddressLink type="address" hash={ data.verified_twin_address_hash } truncation="constant" ml={ 2 }/> truncation="constant"
</Address> fontSize="sm"
fontWeight="500"
/>
<chakra.span mt={ 1 }>All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with </chakra.span> <chakra.span mt={ 1 }>All functions displayed below are from ABI of that contract. In order to verify current contract, proceed with </chakra.span>
<LinkInternal href={ route({ pathname: '/address/[hash]/contract-verification', query: { hash: addressHash || '' } }) }> <LinkInternal href={ route({ pathname: '/address/[hash]/contract-verification', query: { hash: addressHash || '' } }) }>
Verify & Publish Verify & Publish
...@@ -185,10 +185,12 @@ const ContractCode = ({ addressHash, noSocket }: Props) => { ...@@ -185,10 +185,12 @@ const ContractCode = ({ addressHash, noSocket }: Props) => {
{ data?.minimal_proxy_address_hash && ( { data?.minimal_proxy_address_hash && (
<Alert status="warning" flexWrap="wrap" whiteSpace="pre-wrap"> <Alert status="warning" flexWrap="wrap" whiteSpace="pre-wrap">
<span>Minimal Proxy Contract for </span> <span>Minimal Proxy Contract for </span>
<Address> <AddressEntity
<AddressIcon address={{ hash: data.minimal_proxy_address_hash, is_contract: true, implementation_name: null }}/> address={{ hash: data.minimal_proxy_address_hash, is_contract: true, implementation_name: null }}
<AddressLink type="address" hash={ data.minimal_proxy_address_hash } truncation="constant" ml={ 2 }/> truncation="constant"
</Address> fontSize="sm"
fontWeight="500"
/>
<span>. </span> <span>. </span>
<Box> <Box>
<Link href="https://eips.ethereum.org/EIPS/eip-1167">EIP-1167</Link> <Link href="https://eips.ethereum.org/EIPS/eip-1167">EIP-1167</Link>
......
...@@ -24,10 +24,7 @@ import arrowIcon from 'icons/arrows/east-mini.svg'; ...@@ -24,10 +24,7 @@ import arrowIcon from 'icons/arrows/east-mini.svg';
import iconWarning from 'icons/status/warning.svg'; import iconWarning from 'icons/status/warning.svg';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
import { apos } from 'lib/html-entities'; import { apos } from 'lib/html-entities';
import Address from 'ui/shared/address/Address'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
interface Props { interface Props {
className?: string; className?: string;
...@@ -38,11 +35,13 @@ const Item = (data: SmartContractExternalLibrary) => { ...@@ -38,11 +35,13 @@ const Item = (data: SmartContractExternalLibrary) => {
return ( return (
<Flex flexDir="column" py={ 2 } w="100%" rowGap={ 1 }> <Flex flexDir="column" py={ 2 } w="100%" rowGap={ 1 }>
<Box>{ data.name }</Box> <Box>{ data.name }</Box>
<Address> <AddressEntity
<AddressIcon address={{ hash: data.address_hash, is_contract: true, implementation_name: null }}/> address={{ hash: data.address_hash, is_contract: true, implementation_name: null }}
<AddressLink hash={ data.address_hash } type="address" ml={ 2 } fontWeight={ 500 } fontSize="sm" target="_blank" query={{ tab: 'contract' }}/> query={{ tab: 'contract' }}
<CopyToClipboard text={ data.address_hash }/> fontSize="sm"
</Address> fontWeight="500"
target="_blank"
/>
</Flex> </Flex>
); );
}; };
......
import { Flex } from '@chakra-ui/react';
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import React from 'react'; import React from 'react';
import type { Address as TAddress } from 'types/api/address'; import type { Address as TAddress } from 'types/api/address';
import { getResourceKey } from 'lib/api/useApiQuery'; import { getResourceKey } from 'lib/api/useApiQuery';
import Address from 'ui/shared/address/Address'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressLink from 'ui/shared/address/AddressLink';
interface Props { interface Props {
hash: string | undefined; hash: string | undefined;
...@@ -22,10 +22,10 @@ const ContractImplementationAddress = ({ hash }: Props) => { ...@@ -22,10 +22,10 @@ const ContractImplementationAddress = ({ hash }: Props) => {
} }
return ( return (
<Address whiteSpace="pre-wrap" flexWrap="wrap" mb={ 6 }> <Flex mb={ 6 } flexWrap="wrap" columnGap={ 2 }>
<span>Implementation address: </span> <span>Implementation address:</span>
<AddressLink type="address" hash={ data.implementation_address }/> <AddressEntity address={{ hash: data.implementation_address, is_contract: true }} noIcon noCopy/>
</Address> </Flex>
); );
}; };
......
...@@ -7,9 +7,7 @@ import type { SmartContractMethodOutput } from 'types/api/contract'; ...@@ -7,9 +7,7 @@ import type { SmartContractMethodOutput } from 'types/api/contract';
import config from 'configs/app'; import config from 'configs/app';
import { WEI } from 'lib/consts'; import { WEI } from 'lib/consts';
import Address from 'ui/shared/address/Address'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressLink from 'ui/shared/address/AddressLink';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
function castValueToString(value: number | string | boolean | bigint | undefined): string { function castValueToString(value: number | string | boolean | bigint | undefined): string {
switch (typeof value) { switch (typeof value) {
...@@ -49,10 +47,10 @@ const ContractMethodStatic = ({ data }: Props) => { ...@@ -49,10 +47,10 @@ const ContractMethodStatic = ({ data }: Props) => {
const content = (() => { const content = (() => {
if (typeof data.value === 'string' && data.type === 'address' && data.value) { if (typeof data.value === 'string' && data.type === 'address' && data.value) {
return ( return (
<Address> <AddressEntity
<AddressLink type="address" hash={ data.value }/> address={{ hash: data.value }}
<CopyToClipboard text={ data.value }/> noIcon
</Address> />
); );
} }
......
...@@ -5,11 +5,8 @@ import React from 'react'; ...@@ -5,11 +5,8 @@ import React from 'react';
import type { AddressesItem } from 'types/api/addresses'; import type { AddressesItem } from 'types/api/addresses';
import config from 'configs/app'; import config from 'configs/app';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Tag from 'ui/shared/chakra/Tag'; import Tag from 'ui/shared/chakra/Tag';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
type Props = { type Props = {
...@@ -31,19 +28,12 @@ const AddressesListItem = ({ ...@@ -31,19 +28,12 @@ const AddressesListItem = ({
return ( return (
<ListItemMobile rowGap={ 3 }> <ListItemMobile rowGap={ 3 }>
<Flex alignItems="center" justifyContent="space-between" w="100%"> <Flex alignItems="center" justifyContent="space-between" w="100%">
<Address maxW="100%" mr={ 8 }> <AddressEntity
<AddressIcon address={ item } mr={ 2 } isLoading={ isLoading }/> address={ item }
<AddressLink isLoading={ isLoading }
fontWeight={ 700 } fontWeight={ 700 }
flexGrow={ 1 } mr={ 2 }
w="calc(100% - 32px)" />
hash={ item.hash }
alias={ item.name }
type="address"
isLoading={ isLoading }
/>
<CopyToClipboard text={ item.hash } isLoading={ isLoading }/>
</Address>
<Skeleton isLoaded={ !isLoading } fontSize="sm" ml="auto" minW={ 6 } color="text_secondary"> <Skeleton isLoaded={ !isLoading } fontSize="sm" ml="auto" minW={ 6 } color="text_secondary">
<span>{ index }</span> <span>{ index }</span>
</Skeleton> </Skeleton>
......
...@@ -5,11 +5,8 @@ import React from 'react'; ...@@ -5,11 +5,8 @@ import React from 'react';
import type { AddressesItem } from 'types/api/addresses'; import type { AddressesItem } from 'types/api/addresses';
import config from 'configs/app'; import config from 'configs/app';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Tag from 'ui/shared/chakra/Tag'; import Tag from 'ui/shared/chakra/Tag';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
type Props = { type Props = {
item: AddressesItem; item: AddressesItem;
...@@ -37,20 +34,12 @@ const AddressesTableItem = ({ ...@@ -37,20 +34,12 @@ const AddressesTableItem = ({
{ index } { index }
</Skeleton> </Skeleton>
</Td> </Td>
<Td> <Td verticalAlign="middle">
<Address display="inline-flex" maxW="100%"> <AddressEntity
<AddressIcon address={ item } mr={ 2 } isLoading={ isLoading }/> address={ item }
<AddressLink isLoading={ isLoading }
fontWeight={ 700 } fontWeight={ 700 }
flexGrow={ 1 } />
w="calc(100% - 32px)"
hash={ item.hash }
alias={ item.name }
type="address"
isLoading={ isLoading }
/>
<CopyToClipboard text={ item.hash } isLoading={ isLoading }/>
</Address>
</Td> </Td>
<Td pl={ 10 }> <Td pl={ 10 }>
{ item.public_tags && item.public_tags.length ? item.public_tags.map(tag => ( { item.public_tags && item.public_tags.length ? item.public_tags.map(tag => (
......
...@@ -14,10 +14,8 @@ import config from 'configs/app'; ...@@ -14,10 +14,8 @@ import config from 'configs/app';
import rightArrowIcon from 'icons/arrows/east.svg'; import rightArrowIcon from 'icons/arrows/east.svg';
import getValueWithUnit from 'lib/getValueWithUnit'; import getValueWithUnit from 'lib/getValueWithUnit';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import TxStatus from 'ui/shared/TxStatus'; import TxStatus from 'ui/shared/TxStatus';
import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo'; import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo';
...@@ -83,31 +81,20 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { ...@@ -83,31 +81,20 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
isLoading={ isLoading } isLoading={ isLoading }
/> />
<Box overflow="hidden" ml={ 1 }> <Box overflow="hidden" ml={ 1 }>
<Address mb={ 2 }> <AddressEntity
<AddressIcon address={ tx.from } isLoading={ isLoading }/> isLoading={ isLoading }
<AddressLink address={ tx.from }
type="address" fontSize="sm"
hash={ tx.from.hash } fontWeight="500"
alias={ tx.from.name } mb={ 2 }
fontWeight="500" />
ml={ 2 } { dataTo && (
fontSize="sm" <AddressEntity
isLoading={ isLoading } isLoading={ isLoading }
address={ dataTo }
fontSize="sm"
fontWeight="500"
/> />
</Address>
{ dataTo && (
<Address>
<AddressIcon address={ dataTo } isLoading={ isLoading }/>
<AddressLink
type="address"
hash={ dataTo.hash }
alias={ dataTo.name }
fontWeight="500"
ml={ 2 }
fontSize="sm"
isLoading={ isLoading }
/>
</Address>
) } ) }
</Box> </Box>
</Grid> </Grid>
......
...@@ -13,10 +13,8 @@ import config from 'configs/app'; ...@@ -13,10 +13,8 @@ import config from 'configs/app';
import rightArrowIcon from 'icons/arrows/east.svg'; import rightArrowIcon from 'icons/arrows/east.svg';
import getValueWithUnit from 'lib/getValueWithUnit'; import getValueWithUnit from 'lib/getValueWithUnit';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import TxStatus from 'ui/shared/TxStatus'; import TxStatus from 'ui/shared/TxStatus';
import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo'; import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo';
...@@ -67,19 +65,14 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { ...@@ -67,19 +65,14 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
) } ) }
</Flex> </Flex>
<Flex alignItems="center" mb={ 3 }> <Flex alignItems="center" mb={ 3 }>
<Address mr={ 2 }> <AddressEntity
<AddressIcon address={ tx.from } isLoading={ isLoading }/> isLoading={ isLoading }
<AddressLink address={ tx.from }
type="address" truncation="constant"
hash={ tx.from.hash } fontSize="sm"
alias={ tx.from.name } fontWeight="500"
fontWeight="500" mr={ 2 }
ml={ 2 } />
truncation="constant"
fontSize="sm"
isLoading={ isLoading }
/>
</Address>
<Icon <Icon
as={ rightArrowIcon } as={ rightArrowIcon }
boxSize={ 6 } boxSize={ 6 }
...@@ -87,19 +80,13 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { ...@@ -87,19 +80,13 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
isLoading={ isLoading } isLoading={ isLoading }
/> />
{ dataTo && ( { dataTo && (
<Address ml={ 2 }> <AddressEntity
<AddressIcon address={ dataTo } isLoading={ isLoading }/> isLoading={ isLoading }
<AddressLink address={ dataTo }
type="address" truncation="constant"
hash={ dataTo.hash } fontSize="sm"
alias={ dataTo.name } fontWeight="500"
fontWeight="500" />
ml={ 2 }
truncation="constant"
fontSize="sm"
isLoading={ isLoading }
/>
</Address>
) } ) }
</Flex> </Flex>
<Skeleton isLoaded={ !isLoading } mb={ 2 } fontSize="sm" w="fit-content"> <Skeleton isLoaded={ !isLoading } mb={ 2 } fontSize="sm" w="fit-content">
......
import { Text } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -9,12 +8,9 @@ import { useAppContext } from 'lib/contexts/app'; ...@@ -9,12 +8,9 @@ import { useAppContext } from 'lib/contexts/app';
import getQueryParamString from 'lib/router/getQueryParamString'; import getQueryParamString from 'lib/router/getQueryParamString';
import ContractVerificationForm from 'ui/contractVerification/ContractVerificationForm'; import ContractVerificationForm from 'ui/contractVerification/ContractVerificationForm';
import { isValidVerificationMethod, sortVerificationMethods } from 'ui/contractVerification/utils'; import { isValidVerificationMethod, sortVerificationMethods } from 'ui/contractVerification/utils';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import ContentLoader from 'ui/shared/ContentLoader'; import ContentLoader from 'ui/shared/ContentLoader';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
import DataFetchAlert from 'ui/shared/DataFetchAlert'; import DataFetchAlert from 'ui/shared/DataFetchAlert';
import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
const ContractVerification = () => { const ContractVerification = () => {
...@@ -100,15 +96,14 @@ const ContractVerification = () => { ...@@ -100,15 +96,14 @@ const ContractVerification = () => {
title="New smart contract verification" title="New smart contract verification"
backLink={ backLink } backLink={ backLink }
/> />
{ hash && ( <AddressEntity
<Address mb={ 12 }> address={{ hash, is_contract: true, implementation_name: null }}
<AddressIcon address={{ hash, is_contract: true, implementation_name: null }} flexShrink={ 0 }/> noLink
<Text fontFamily="heading" ml={ 2 } fontWeight={ 500 } fontSize="lg" w={{ base: '100%', lg: 'auto' }} whiteSpace="nowrap" overflow="hidden"> fontFamily="heading"
<HashStringShortenDynamic hash={ hash }/> fontSize="lg"
</Text> fontWeight={ 500 }
<CopyToClipboard text={ hash }/> mb={ 12 }
</Address> />
) }
{ content } { content }
</> </>
); );
......
...@@ -8,14 +8,11 @@ import type { CsvExportParams } from 'types/client/address'; ...@@ -8,14 +8,11 @@ import type { CsvExportParams } from 'types/client/address';
import type { ResourceName } from 'lib/api/resources'; import type { ResourceName } from 'lib/api/resources';
import useApiQuery from 'lib/api/useApiQuery'; import useApiQuery from 'lib/api/useApiQuery';
import { useAppContext } from 'lib/contexts/app'; import { useAppContext } from 'lib/contexts/app';
import useIsMobile from 'lib/hooks/useIsMobile';
import { nbsp } from 'lib/html-entities'; import { nbsp } from 'lib/html-entities';
import CsvExportForm from 'ui/csvExport/CsvExportForm'; import CsvExportForm from 'ui/csvExport/CsvExportForm';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import ContentLoader from 'ui/shared/ContentLoader'; import ContentLoader from 'ui/shared/ContentLoader';
import DataFetchAlert from 'ui/shared/DataFetchAlert'; import DataFetchAlert from 'ui/shared/DataFetchAlert';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
interface ExportTypeEntity { interface ExportTypeEntity {
...@@ -60,7 +57,6 @@ const isCorrectExportType = (type: string): type is CsvExportParams['type'] => O ...@@ -60,7 +57,6 @@ const isCorrectExportType = (type: string): type is CsvExportParams['type'] => O
const CsvExport = () => { const CsvExport = () => {
const router = useRouter(); const router = useRouter();
const isMobile = useIsMobile();
const appProps = useAppContext(); const appProps = useAppContext();
const addressHash = router.query.address?.toString() || ''; const addressHash = router.query.address?.toString() || '';
...@@ -133,10 +129,10 @@ const CsvExport = () => { ...@@ -133,10 +129,10 @@ const CsvExport = () => {
/> />
<Flex mb={ 10 } whiteSpace="pre-wrap" flexWrap="wrap"> <Flex mb={ 10 } whiteSpace="pre-wrap" flexWrap="wrap">
<span>Export { EXPORT_TYPES[exportType].text } for address </span> <span>Export { EXPORT_TYPES[exportType].text } for address </span>
<Address> <AddressEntity
<AddressIcon address={{ hash: addressHash, is_contract: true, implementation_name: null }}/> address={{ hash: addressHash, is_contract: true, implementation_name: null }}
<AddressLink hash={ addressHash } type="address" ml={ 2 } truncation={ isMobile ? 'constant' : 'dynamic' }/> noCopy
</Address> />
<span>{ nbsp }</span> <span>{ nbsp }</span>
{ filterType && filterValue && <span>with applied filter by { filterType } ({ filterValue }) </span> } { filterType && filterValue && <span>with applied filter by { filterType } ({ filterValue }) </span> }
<span>to CSV file. </span> <span>to CSV file. </span>
......
...@@ -3,16 +3,12 @@ import { useRouter } from 'next/router'; ...@@ -3,16 +3,12 @@ import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
import { useAppContext } from 'lib/contexts/app'; import { useAppContext } from 'lib/contexts/app';
import useIsMobile from 'lib/hooks/useIsMobile'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
import Sol2UmlDiagram from 'ui/sol2uml/Sol2UmlDiagram'; import Sol2UmlDiagram from 'ui/sol2uml/Sol2UmlDiagram';
const Sol2Uml = () => { const Sol2Uml = () => {
const router = useRouter(); const router = useRouter();
const isMobile = useIsMobile();
const appProps = useAppContext(); const appProps = useAppContext();
const addressHash = router.query.address?.toString() || ''; const addressHash = router.query.address?.toString() || '';
...@@ -36,12 +32,11 @@ const Sol2Uml = () => { ...@@ -36,12 +32,11 @@ const Sol2Uml = () => {
title="Solidity UML diagram" title="Solidity UML diagram"
backLink={ backLink } backLink={ backLink }
/> />
<Flex mb={ 10 }> <Flex mb={ 10 } flexWrap="wrap" columnGap={ 3 }>
<span>For contract</span> <span>For contract</span>
<Address ml={ 3 }> <AddressEntity
<AddressIcon address={{ hash: addressHash, is_contract: true, implementation_name: null }}/> address={{ hash: addressHash, is_contract: true, implementation_name: null }}
<AddressLink hash={ addressHash } type="address" ml={ 2 } truncation={ isMobile ? 'constant' : 'dynamic' }/> />
</Address>
</Flex> </Flex>
<Sol2UmlDiagram addressHash={ addressHash }/> <Sol2UmlDiagram addressHash={ addressHash }/>
</> </>
......
...@@ -11,9 +11,7 @@ import dayjs from 'lib/date/dayjs'; ...@@ -11,9 +11,7 @@ import dayjs from 'lib/date/dayjs';
import highlightText from 'lib/highlightText'; import highlightText from 'lib/highlightText';
import * as mixpanel from 'lib/mixpanel/index'; import * as mixpanel from 'lib/mixpanel/index';
import { saveToRecentKeywords } from 'lib/recentSearchKeywords'; import { saveToRecentKeywords } from 'lib/recentSearchKeywords';
import Address from 'ui/shared/address/Address'; import * as AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import * as BlockEntity from 'ui/shared/entities/block/BlockEntity'; import * as BlockEntity from 'ui/shared/entities/block/BlockEntity';
import * as TxEntity from 'ui/shared/entities/tx/TxEntity'; import * as TxEntity from 'ui/shared/entities/tx/TxEntity';
import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic'; import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
...@@ -76,14 +74,31 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -76,14 +74,31 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => {
case 'contract': case 'contract':
case 'address': { case 'address': {
const shouldHighlightHash = data.address.toLowerCase() === searchTerm.toLowerCase(); const shouldHighlightHash = data.address.toLowerCase() === searchTerm.toLowerCase();
const address = {
hash: data.address,
is_contract: data.type === 'contract',
is_verified: data.is_smart_contract_verified,
name: null,
implementation_name: null,
};
return ( return (
<Address> <AddressEntity.Container>
<AddressIcon address={{ hash: data.address, is_contract: data.type === 'contract', implementation_name: null }} mr={ 2 } flexShrink={ 0 }/> <AddressEntity.Icon address={ address }/>
<Box as={ shouldHighlightHash ? 'mark' : 'span' } display="block" whiteSpace="nowrap" overflow="hidden"> <AddressEntity.Link
<AddressLink type="address" hash={ data.address } fontWeight={ 700 } display="block" w="100%" onClick={ handleLinkClick }/> address={ address }
</Box> onClick={ handleLinkClick }
{ data.is_smart_contract_verified && <Icon as={ iconSuccess } color="green.500" ml={ 1 }/> } >
</Address> <AddressEntity.Content
asProp={ shouldHighlightHash ? 'mark' : 'span' }
address={ address }
fontSize="sm"
lineHeight={ 5 }
fontWeight={ 700 }
/>
</AddressEntity.Link>
<AddressEntity.Copy address={ address }/>
</AddressEntity.Container>
); );
} }
......
...@@ -11,9 +11,7 @@ import dayjs from 'lib/date/dayjs'; ...@@ -11,9 +11,7 @@ import dayjs from 'lib/date/dayjs';
import highlightText from 'lib/highlightText'; import highlightText from 'lib/highlightText';
import * as mixpanel from 'lib/mixpanel/index'; import * as mixpanel from 'lib/mixpanel/index';
import { saveToRecentKeywords } from 'lib/recentSearchKeywords'; import { saveToRecentKeywords } from 'lib/recentSearchKeywords';
import Address from 'ui/shared/address/Address'; import * as AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import * as BlockEntity from 'ui/shared/entities/block/BlockEntity'; import * as BlockEntity from 'ui/shared/entities/block/BlockEntity';
import * as TxEntity from 'ui/shared/entities/tx/TxEntity'; import * as TxEntity from 'ui/shared/entities/tx/TxEntity';
import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic'; import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
...@@ -95,25 +93,33 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -95,25 +93,33 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
case 'address': { case 'address': {
if (data.name) { if (data.name) {
const shouldHighlightHash = data.address.toLowerCase() === searchTerm.toLowerCase(); const shouldHighlightHash = data.address.toLowerCase() === searchTerm.toLowerCase();
const address = {
hash: data.address,
is_contract: data.type === 'contract',
is_verified: data.is_smart_contract_verified,
name: null,
implementation_name: null,
};
return ( return (
<> <>
<Td fontSize="sm"> <Td fontSize="sm">
<Flex alignItems="center" overflow="hidden"> <AddressEntity.Container>
<AddressIcon address={{ hash: data.address, is_contract: data.type === 'contract', implementation_name: null }} mr={ 2 } flexShrink={ 0 }/> <AddressEntity.Icon address={ address }/>
<LinkInternal <AddressEntity.Link
href={ route({ pathname: '/address/[hash]', query: { hash: data.address } }) } address={ address }
fontWeight={ 700 }
overflow="hidden"
whiteSpace="nowrap"
onClick={ handleLinkClick } onClick={ handleLinkClick }
> >
<Box as={ shouldHighlightHash ? 'mark' : 'span' } display="block"> <AddressEntity.Content
<HashStringShortenDynamic hash={ data.address }/> asProp={ shouldHighlightHash ? 'mark' : 'span' }
</Box> address={ address }
</LinkInternal> fontSize="sm"
{ data.is_smart_contract_verified && <Icon as={ iconSuccess } color="green.500" ml={ 1 }/> } lineHeight={ 5 }
</Flex> fontWeight={ 700 }
/>
</AddressEntity.Link>
<AddressEntity.Copy address={ address }/>
</AddressEntity.Container>
</Td> </Td>
<Td colSpan={ 2 } fontSize="sm" verticalAlign="middle"> <Td colSpan={ 2 } fontSize="sm" verticalAlign="middle">
<span dangerouslySetInnerHTML={{ __html: shouldHighlightHash ? data.name : highlightText(data.name, searchTerm) }}/> <span dangerouslySetInnerHTML={{ __html: shouldHighlightHash ? data.name : highlightText(data.name, searchTerm) }}/>
...@@ -122,15 +128,32 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -122,15 +128,32 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
); );
} }
const address = {
hash: data.address,
is_contract: data.type === 'contract',
is_verified: data.is_smart_contract_verified,
name: null,
implementation_name: null,
};
return ( return (
<Td colSpan={ 3 } fontSize="sm"> <Td colSpan={ 3 } fontSize="sm">
<Address> <AddressEntity.Container>
<AddressIcon address={{ hash: data.address, is_contract: data.type === 'contract', implementation_name: null }} mr={ 2 } flexShrink={ 0 }/> <AddressEntity.Icon address={ address }/>
<mark> <AddressEntity.Link
<AddressLink hash={ data.address } type="address" fontWeight={ 700 } onClick={ handleLinkClick }/> address={ address }
</mark> onClick={ handleLinkClick }
{ data.is_smart_contract_verified && <Icon as={ iconSuccess } color="green.500" ml={ 1 }/> } >
</Address> <AddressEntity.Content
asProp="mark"
address={ address }
fontSize="sm"
lineHeight={ 5 }
fontWeight={ 700 }
/>
</AddressEntity.Link>
<AddressEntity.Copy address={ address }/>
</AddressEntity.Container>
</Td> </Td>
); );
} }
......
...@@ -14,6 +14,7 @@ interface Props { ...@@ -14,6 +14,7 @@ interface Props {
isLoading?: boolean; isLoading?: boolean;
} }
// TODO @tom2drum remove this component
const AddressSnippet = ({ address, subtitle, isLoading }: Props) => { const AddressSnippet = ({ address, subtitle, isLoading }: Props) => {
return ( return (
<Box maxW="100%"> <Box maxW="100%">
......
...@@ -6,12 +6,9 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; ...@@ -6,12 +6,9 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import eastArrowIcon from 'icons/arrows/east.svg'; import eastArrowIcon from 'icons/arrows/east.svg';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import Tag from 'ui/shared/chakra/Tag'; import Tag from 'ui/shared/chakra/Tag';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import InOutTag from 'ui/shared/InOutTag'; import InOutTag from 'ui/shared/InOutTag';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
...@@ -80,11 +77,14 @@ const TokenTransferListItem = ({ ...@@ -80,11 +77,14 @@ const TokenTransferListItem = ({
</Flex> </Flex>
) } ) }
<Flex w="100%" columnGap={ 3 }> <Flex w="100%" columnGap={ 3 }>
<Address width={ addressWidth } flexShrink={ 0 }> <AddressEntity
<AddressIcon address={ from } isLoading={ isLoading }/> address={ from }
<AddressLink type="address" ml={ 2 } fontWeight="500" hash={ from.hash } isDisabled={ baseAddress === from.hash } isLoading={ isLoading }/> isLoading={ isLoading }
{ baseAddress !== from.hash && <CopyToClipboard text={ from.hash } isLoading={ isLoading }/> } noLink={ baseAddress === from.hash }
</Address> noCopy={ baseAddress === from.hash }
flexShrink={ 0 }
width={ addressWidth }
/>
{ baseAddress ? ( { baseAddress ? (
<InOutTag <InOutTag
isIn={ baseAddress === to.hash } isIn={ baseAddress === to.hash }
...@@ -97,11 +97,14 @@ const TokenTransferListItem = ({ ...@@ -97,11 +97,14 @@ const TokenTransferListItem = ({
) : ) :
<Icon as={ eastArrowIcon } boxSize={ 6 } color="gray.500" isLoading={ isLoading } flexShrink={ 0 }/> <Icon as={ eastArrowIcon } boxSize={ 6 } color="gray.500" isLoading={ isLoading } flexShrink={ 0 }/>
} }
<Address width={ addressWidth } flexShrink={ 0 }> <AddressEntity
<AddressIcon address={ to } isLoading={ isLoading }/> address={ to }
<AddressLink type="address" ml={ 2 } fontWeight="500" hash={ to.hash } isDisabled={ baseAddress === to.hash } isLoading={ isLoading }/> isLoading={ isLoading }
{ baseAddress !== to.hash && <CopyToClipboard text={ to.hash } isLoading={ isLoading }/> } noLink={ baseAddress === to.hash }
</Address> noCopy={ baseAddress === to.hash }
flexShrink={ 0 }
width={ addressWidth }
/>
</Flex> </Flex>
{ value && ( { value && (
<Flex columnGap={ 2 } w="100%"> <Flex columnGap={ 2 } w="100%">
......
...@@ -5,11 +5,8 @@ import React from 'react'; ...@@ -5,11 +5,8 @@ import React from 'react';
import type { TokenTransfer } from 'types/api/tokenTransfer'; import type { TokenTransfer } from 'types/api/tokenTransfer';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Tag from 'ui/shared/chakra/Tag'; import Tag from 'ui/shared/chakra/Tag';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import InOutTag from 'ui/shared/InOutTag'; import InOutTag from 'ui/shared/InOutTag';
import TokenSnippet from 'ui/shared/TokenSnippet/TokenSnippet'; import TokenSnippet from 'ui/shared/TokenSnippet/TokenSnippet';
...@@ -75,19 +72,14 @@ const TokenTransferTableItem = ({ ...@@ -75,19 +72,14 @@ const TokenTransferTableItem = ({
</Td> </Td>
) } ) }
<Td> <Td>
<Address display="inline-flex" maxW="100%" my="3px"> <AddressEntity
<AddressIcon address={ from } isLoading={ isLoading }/> address={ from }
<AddressLink isLoading={ isLoading }
type="address" ml={ 2 } my="5px"
fontWeight="500" noLink={ baseAddress === from.hash }
hash={ from.hash } noCopy={ baseAddress === from.hash }
alias={ from.name } flexGrow={ 1 }
flexGrow={ 1 } />
isDisabled={ baseAddress === from.hash }
isLoading={ isLoading }
/>
{ baseAddress !== from.hash && <CopyToClipboard text={ from.hash } isLoading={ isLoading }/> }
</Address>
</Td> </Td>
{ baseAddress && ( { baseAddress && (
<Td px={ 0 }> <Td px={ 0 }>
...@@ -103,20 +95,14 @@ const TokenTransferTableItem = ({ ...@@ -103,20 +95,14 @@ const TokenTransferTableItem = ({
</Td> </Td>
) } ) }
<Td> <Td>
<Address display="inline-flex" maxW="100%" my="3px"> <AddressEntity
<AddressIcon address={ to } isLoading={ isLoading }/> address={ to }
<AddressLink isLoading={ isLoading }
type="address" my="5px"
ml={ 2 } noLink={ baseAddress === to.hash }
fontWeight="500" noCopy={ baseAddress === to.hash }
hash={ to.hash } flexGrow={ 1 }
alias={ to.name } />
flexGrow={ 1 }
isDisabled={ baseAddress === to.hash }
isLoading={ isLoading }
/>
{ baseAddress !== to.hash && <CopyToClipboard text={ to.hash } isLoading={ isLoading }/> }
</Address>
</Td> </Td>
<Td isNumeric verticalAlign="top"> <Td isNumeric verticalAlign="top">
<Skeleton isLoaded={ !isLoading } display="inline-block" my="7px"> <Skeleton isLoaded={ !isLoading } display="inline-block" my="7px">
......
...@@ -6,6 +6,7 @@ interface Props { ...@@ -6,6 +6,7 @@ interface Props {
children: React.ReactNode; children: React.ReactNode;
} }
// TODO @tom2drum delete this component
/** /**
* @deprecated use `ui/shared/entities/address` instead * @deprecated use `ui/shared/entities/address` instead
*/ */
......
...@@ -29,11 +29,15 @@ const Link = chakra((props: LinkProps) => { ...@@ -29,11 +29,15 @@ const Link = chakra((props: LinkProps) => {
); );
}); });
type IconProps = Pick<EntityProps, 'address' | 'isLoading' | 'iconSize'> & { type IconProps = Pick<EntityProps, 'address' | 'isLoading' | 'iconSize' | 'noIcon'> & {
asProp?: As; asProp?: As;
}; };
const Icon = (props: IconProps) => { const Icon = (props: IconProps) => {
if (props.noIcon) {
return null;
}
const styles = { const styles = {
...getIconProps(props.iconSize), ...getIconProps(props.iconSize),
marginRight: 2, marginRight: 2,
...@@ -46,19 +50,27 @@ const Icon = (props: IconProps) => { ...@@ -46,19 +50,27 @@ const Icon = (props: IconProps) => {
if (props.address.is_contract) { if (props.address.is_contract) {
if (props.address.is_verified) { if (props.address.is_verified) {
return ( return (
<EntityBase.Icon <Tooltip label="Verified contract">
{ ...props } <span>
asProp={ iconContractVerified } <EntityBase.Icon
color="green.500" { ...props }
/> asProp={ iconContractVerified }
color="green.500"
/>
</span>
</Tooltip>
); );
} }
return ( return (
<EntityBase.Icon <Tooltip label="Contract">
{ ...props } <span>
asProp={ iconContract } <EntityBase.Icon
/> { ...props }
asProp={ iconContract }
/>
</span>
</Tooltip>
); );
} }
......
import { chakra } from '@chakra-ui/react'; import { chakra } from '@chakra-ui/react';
import _omit from 'lodash/omit';
import React from 'react'; import React from 'react';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
...@@ -11,8 +10,6 @@ interface Props extends AddressEntity.EntityProps { ...@@ -11,8 +10,6 @@ interface Props extends AddressEntity.EntityProps {
} }
const AddressEntityWithTokenFilter = (props: Props) => { const AddressEntityWithTokenFilter = (props: Props) => {
const linkProps = _omit(props, [ 'className' ]);
const partsProps = _omit(props, [ 'className', 'onClick' ]);
const defaultHref = route({ const defaultHref = route({
pathname: '/address/[hash]', pathname: '/address/[hash]',
query: { query: {
...@@ -25,15 +22,7 @@ const AddressEntityWithTokenFilter = (props: Props) => { ...@@ -25,15 +22,7 @@ const AddressEntityWithTokenFilter = (props: Props) => {
}); });
return ( return (
<AddressEntity.Container className={ props.className }> <AddressEntity.default { ...props } href={ props.href ?? defaultHref }/>
<AddressEntity.Icon { ...partsProps }/>
<AddressEntity.Link
{ ...linkProps }
href={ props.href ?? defaultHref }
>
<AddressEntity.Content { ...partsProps }/>
</AddressEntity.Link>
</AddressEntity.Container>
); );
}; };
......
...@@ -26,6 +26,7 @@ export interface EntityBaseProps { ...@@ -26,6 +26,7 @@ export interface EntityBaseProps {
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void; onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
query?: Record<string, string>; query?: Record<string, string>;
tailLength?: number; tailLength?: number;
target?: React.HTMLAttributeAnchorTarget;
truncation?: Truncation; truncation?: Truncation;
} }
......
...@@ -4,10 +4,7 @@ import React from 'react'; ...@@ -4,10 +4,7 @@ import React from 'react';
import type { TokenHolder, TokenInfo } from 'types/api/token'; import type { TokenHolder, TokenInfo } from 'types/api/token';
import Address from 'ui/shared/address/Address'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
import Utilization from 'ui/shared/Utilization/Utilization'; import Utilization from 'ui/shared/Utilization/Utilization';
...@@ -22,19 +19,12 @@ const TokenHoldersListItem = ({ holder, token, isLoading }: Props) => { ...@@ -22,19 +19,12 @@ const TokenHoldersListItem = ({ holder, token, isLoading }: Props) => {
return ( return (
<ListItemMobile rowGap={ 3 }> <ListItemMobile rowGap={ 3 }>
<Address display="inline-flex" maxW="100%"> <AddressEntity
<AddressIcon address={ holder.address } isLoading={ isLoading }/> address={ holder.address }
<AddressLink isLoading={ isLoading }
type="address" fontWeight="700"
ml={ 2 } maxW="100%"
fontWeight="700" />
hash={ holder.address.hash }
alias={ holder.address.name }
flexGrow={ 1 }
isLoading={ isLoading }
/>
<CopyToClipboard text={ holder.address.hash } isLoading={ isLoading }/>
</Address>
<Flex justifyContent="space-between" alignItems="center" width="100%"> <Flex justifyContent="space-between" alignItems="center" width="100%">
<Skeleton isLoaded={ !isLoading } display="inline-block" width="100%"> <Skeleton isLoaded={ !isLoading } display="inline-block" width="100%">
<Box as="span" wordBreak="break-word" mr={ 6 }> <Box as="span" wordBreak="break-word" mr={ 6 }>
......
...@@ -4,10 +4,7 @@ import React from 'react'; ...@@ -4,10 +4,7 @@ import React from 'react';
import type { TokenHolder, TokenInfo } from 'types/api/token'; import type { TokenHolder, TokenInfo } from 'types/api/token';
import Address from 'ui/shared/address/Address'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
import Utilization from 'ui/shared/Utilization/Utilization'; import Utilization from 'ui/shared/Utilization/Utilization';
type Props = { type Props = {
...@@ -22,20 +19,12 @@ const TokenTransferTableItem = ({ holder, token, isLoading }: Props) => { ...@@ -22,20 +19,12 @@ const TokenTransferTableItem = ({ holder, token, isLoading }: Props) => {
return ( return (
<Tr> <Tr>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<Address display="inline-flex" maxW="100%"> <AddressEntity
<AddressIcon address={ holder.address } isLoading={ isLoading }/> address={ holder.address }
<AddressLink isLoading={ isLoading }
type="address" flexGrow={ 1 }
ml={ 2 } fontWeight="700"
fontWeight="700" />
hash={ holder.address.hash }
alias={ holder.address.name }
flexGrow={ 1 }
isLoading={ isLoading }
truncation="constant"
/>
<CopyToClipboard text={ holder.address.hash } isLoading={ isLoading }/>
</Address>
</Td> </Td>
<Td verticalAlign="middle" isNumeric> <Td verticalAlign="middle" isNumeric>
<Skeleton isLoaded={ !isLoading } display="inline-block" wordBreak="break-word"> <Skeleton isLoaded={ !isLoading } display="inline-block" wordBreak="break-word">
......
...@@ -6,12 +6,9 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; ...@@ -6,12 +6,9 @@ import type { TokenTransfer } from 'types/api/tokenTransfer';
import eastArrowIcon from 'icons/arrows/east.svg'; import eastArrowIcon from 'icons/arrows/east.svg';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import Tag from 'ui/shared/chakra/Tag'; import Tag from 'ui/shared/chakra/Tag';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntityWithTokenFilter from 'ui/shared/entities/address/AddressEntityWithTokenFilter';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
import TokenTransferNft from 'ui/shared/TokenTransfer/TokenTransferNft'; import TokenTransferNft from 'ui/shared/TokenTransfer/TokenTransferNft';
...@@ -59,17 +56,21 @@ const TokenTransferListItem = ({ ...@@ -59,17 +56,21 @@ const TokenTransferListItem = ({
</Flex> </Flex>
{ method && <Tag isLoading={ isLoading }>{ method }</Tag> } { method && <Tag isLoading={ isLoading }>{ method }</Tag> }
<Flex w="100%" columnGap={ 3 }> <Flex w="100%" columnGap={ 3 }>
<Address width="50%"> <AddressEntityWithTokenFilter
<AddressIcon address={ from } isLoading={ isLoading }/> address={ from }
<AddressLink ml={ 2 } fontWeight="500" hash={ from.hash } type="address_token" tokenHash={ token.address } isLoading={ isLoading }/> isLoading={ isLoading }
<CopyToClipboard text={ from.hash } isLoading={ isLoading }/> tokenHash={ token.address }
</Address> width="50%"
fontWeight="500"
/>
<Icon as={ eastArrowIcon } boxSize={ 6 } color="gray.500" isLoading={ isLoading }/> <Icon as={ eastArrowIcon } boxSize={ 6 } color="gray.500" isLoading={ isLoading }/>
<Address width="50%"> <AddressEntityWithTokenFilter
<AddressIcon address={ to } isLoading={ isLoading }/> address={ to }
<AddressLink ml={ 2 } fontWeight="500" hash={ to.hash } type="address_token" tokenHash={ token.address } isLoading={ isLoading }/> isLoading={ isLoading }
<CopyToClipboard text={ to.hash } isLoading={ isLoading }/> tokenHash={ token.address }
</Address> width="50%"
fontWeight="500"
/>
</Flex> </Flex>
{ value && (token.type === 'ERC-20' || token.type === 'ERC-1155') && ( { value && (token.type === 'ERC-20' || token.type === 'ERC-1155') && (
<Flex columnGap={ 2 } w="100%"> <Flex columnGap={ 2 } w="100%">
......
...@@ -9,11 +9,9 @@ import iconCheck from 'icons/check.svg'; ...@@ -9,11 +9,9 @@ import iconCheck from 'icons/check.svg';
import iconCross from 'icons/cross.svg'; import iconCross from 'icons/cross.svg';
import iconSuccess from 'icons/status/success.svg'; import iconSuccess from 'icons/status/success.svg';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import CopyToClipboard from 'ui/shared/CopyToClipboard';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import HashStringShorten from 'ui/shared/HashStringShorten'; import HashStringShorten from 'ui/shared/HashStringShorten';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
...@@ -29,14 +27,18 @@ const VerifiedContractsListItem = ({ data, isLoading }: Props) => { ...@@ -29,14 +27,18 @@ const VerifiedContractsListItem = ({ data, isLoading }: Props) => {
return ( return (
<ListItemMobile rowGap={ 3 }> <ListItemMobile rowGap={ 3 }>
<Address columnGap={ 2 } overflow="hidden" w="100%"> <Flex w="100%">
<AddressIcon address={ data.address } isLoading={ isLoading }/> <AddressEntity
<AddressLink hash={ data.address.hash } type="address" alias={ data.address.name } isLoading={ isLoading } query={{ tab: 'contract' }}/> isLoading={ isLoading }
address={ data.address }
query={{ tab: 'contract' }}
noCopy
/>
<Skeleton isLoaded={ !isLoading } color="text_secondary" ml="auto"> <Skeleton isLoaded={ !isLoading } color="text_secondary" ml="auto">
<HashStringShorten hash={ data.address.hash } isTooltipDisabled/> <HashStringShorten hash={ data.address.hash } isTooltipDisabled/>
</Skeleton> </Skeleton>
<CopyToClipboard text={ data.address.hash } ml={ -1 } isLoading={ isLoading }/> <CopyToClipboard text={ data.address.hash } isLoading={ isLoading }/>
</Address> </Flex>
<Flex columnGap={ 3 }> <Flex columnGap={ 3 }>
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Balance { config.chain.currency.symbol }</Skeleton> <Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Balance { config.chain.currency.symbol }</Skeleton>
<Skeleton isLoaded={ !isLoading } color="text_secondary"> <Skeleton isLoaded={ !isLoading } color="text_secondary">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment