Commit fef3aa38 authored by isstuev's avatar isstuev

add more robust addresses

parent 89af39c6
...@@ -11,6 +11,7 @@ export interface Address extends UserTags { ...@@ -11,6 +11,7 @@ export interface Address extends UserTags {
block_number_balance_updated_at: number | null; block_number_balance_updated_at: number | null;
coin_balance: string | null; coin_balance: string | null;
creator_address_hash: string | null; creator_address_hash: string | null;
creator_filecoin_robust_address?: string | null;
creation_tx_hash: string | null; creation_tx_hash: string | null;
exchange_rate: string | null; exchange_rate: string | null;
ens_domain_name: string | null; ens_domain_name: string | null;
...@@ -271,9 +272,9 @@ export type AddressEpochRewardsItem = { ...@@ -271,9 +272,9 @@ export type AddressEpochRewardsItem = {
} }
export type AddressFilecoinParams = { export type AddressFilecoinParams = {
actor_type: FilecoinActorType; actor_type?: FilecoinActorType;
id: string; id?: string | null;
robust: string; robust?: string | null;
} }
export type FilecoinActorType = export type FilecoinActorType =
......
...@@ -67,6 +67,7 @@ export interface SmartContract { ...@@ -67,6 +67,7 @@ export interface SmartContract {
remappings?: Array<string>; remappings?: Array<string>;
}; };
verified_twin_address_hash: string | null; verified_twin_address_hash: string | null;
verified_twin_filecoin_robust_address?: string | null;
proxy_type: SmartContractProxyType | null; proxy_type: SmartContractProxyType | null;
language: string | null; language: string | null;
license_type: SmartContractLicenseType | null; license_type: SmartContractLicenseType | null;
......
...@@ -15,6 +15,7 @@ export interface SearchResultToken { ...@@ -15,6 +15,7 @@ export interface SearchResultToken {
total_supply: string | null; total_supply: string | null;
is_verified_via_admin_panel: boolean; is_verified_via_admin_panel: boolean;
is_smart_contract_verified: boolean; is_smart_contract_verified: boolean;
filecoin_robust_address?: string | null;
} }
export interface SearchResultAddressOrContract { export interface SearchResultAddressOrContract {
...@@ -23,6 +24,7 @@ export interface SearchResultAddressOrContract { ...@@ -23,6 +24,7 @@ export interface SearchResultAddressOrContract {
address: string; address: string;
is_smart_contract_verified: boolean; is_smart_contract_verified: boolean;
certified?: true; certified?: true;
filecoin_robust_address?: string | null;
url?: string; // not used by the frontend, we build the url ourselves url?: string; // not used by the frontend, we build the url ourselves
ens_info?: { ens_info?: {
address_hash: string; address_hash: string;
...@@ -36,6 +38,7 @@ export interface SearchResultDomain { ...@@ -36,6 +38,7 @@ export interface SearchResultDomain {
type: 'ens_domain'; type: 'ens_domain';
name: string | null; name: string | null;
address: string; address: string;
filecoin_robust_address?: string | null;
is_smart_contract_verified: boolean; is_smart_contract_verified: boolean;
url?: string; // not used by the frontend, we build the url ourselves url?: string; // not used by the frontend, we build the url ourselves
ens_info: { ens_info: {
...@@ -49,6 +52,7 @@ export interface SearchResultDomain { ...@@ -49,6 +52,7 @@ export interface SearchResultDomain {
export interface SearchResultLabel { export interface SearchResultLabel {
type: 'label'; type: 'label';
address: string; address: string;
filecoin_robust_address?: string | null;
name: string; name: string;
is_smart_contract_verified: boolean; is_smart_contract_verified: boolean;
url?: string; // not used by the frontend, we build the url ourselves url?: string; // not used by the frontend, we build the url ourselves
......
...@@ -20,6 +20,7 @@ export interface TokenInfo<T extends TokenType = TokenType> { ...@@ -20,6 +20,7 @@ export interface TokenInfo<T extends TokenType = TokenType> {
bridge_type?: string | null; bridge_type?: string | null;
origin_chain_id?: string | null; origin_chain_id?: string | null;
foreign_address?: string | null; foreign_address?: string | null;
filecoin_robust_address?: string | null;
} }
export interface TokenCounters { export interface TokenCounters {
......
...@@ -67,6 +67,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { ...@@ -67,6 +67,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
has_token_transfers: true, has_token_transfers: true,
has_validated_blocks: false, has_validated_blocks: false,
filecoin: undefined, filecoin: undefined,
creator_filecoin_robust_address: null,
creator_address_hash: null,
}), [ addressHash ]); }), [ addressHash ]);
// error handling (except 404 codes) // error handling (except 404 codes)
...@@ -87,6 +89,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { ...@@ -87,6 +89,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
return null; return null;
} }
const creatorAddressHash = data.creator_address_hash;
return ( return (
<> <>
{ addressQuery.isDegradedData && <ServiceDegradationWarning isLoading={ addressQuery.isPlaceholderData } mb={ 6 }/> } { addressQuery.isDegradedData && <ServiceDegradationWarning isLoading={ addressQuery.isPlaceholderData } mb={ 6 }/> }
...@@ -140,7 +144,7 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { ...@@ -140,7 +144,7 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
<AddressNameInfo data={ data } isLoading={ addressQuery.isPlaceholderData }/> <AddressNameInfo data={ data } isLoading={ addressQuery.isPlaceholderData }/>
{ data.is_contract && data.creation_tx_hash && data.creator_address_hash && ( { data.is_contract && data.creation_tx_hash && (creatorAddressHash) && (
<> <>
<DetailsInfoItem.Label <DetailsInfoItem.Label
hint="Transaction and address of creation" hint="Transaction and address of creation"
...@@ -150,7 +154,7 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { ...@@ -150,7 +154,7 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => {
</DetailsInfoItem.Label> </DetailsInfoItem.Label>
<DetailsInfoItem.Value> <DetailsInfoItem.Value>
<AddressEntity <AddressEntity
address={{ hash: data.creator_address_hash }} address={{ hash: creatorAddressHash, filecoin: { robust: data.creator_filecoin_robust_address } }}
truncation="constant" truncation="constant"
noIcon noIcon
/> />
......
...@@ -72,7 +72,7 @@ const ContractDetailsAlerts = ({ data, isLoading, addressHash, channel }: Props) ...@@ -72,7 +72,7 @@ const ContractDetailsAlerts = ({ data, isLoading, addressHash, channel }: Props)
<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>
<AddressEntity <AddressEntity
address={{ hash: data.verified_twin_address_hash, is_contract: true }} address={{ hash: data.verified_twin_address_hash, filecoin: { robust: data.verified_twin_filecoin_robust_address }, is_contract: true }}
truncation="constant" truncation="constant"
fontSize="sm" fontSize="sm"
fontWeight="500" fontWeight="500"
......
...@@ -80,6 +80,9 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -80,6 +80,9 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => {
const shouldHighlightHash = ADDRESS_REGEXP.test(searchTerm); const shouldHighlightHash = ADDRESS_REGEXP.test(searchTerm);
const address = { const address = {
hash: data.address, hash: data.address,
filecoin: {
robust: data.filecoin_robust_address,
},
is_contract: data.type === 'contract', is_contract: data.type === 'contract',
is_verified: data.is_smart_contract_verified, is_verified: data.is_smart_contract_verified,
name: null, name: null,
...@@ -288,7 +291,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -288,7 +291,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => {
<Grid templateColumns={ templateCols } alignItems="center" gap={ 2 }> <Grid templateColumns={ templateCols } alignItems="center" gap={ 2 }>
<Skeleton isLoaded={ !isLoading } overflow="hidden" display="flex" alignItems="center"> <Skeleton isLoaded={ !isLoading } overflow="hidden" display="flex" alignItems="center">
<Text whiteSpace="nowrap" overflow="hidden"> <Text whiteSpace="nowrap" overflow="hidden">
<HashStringShortenDynamic hash={ data.address } isTooltipDisabled/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address } isTooltipDisabled/>
</Text> </Text>
{ data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> } { data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> }
</Skeleton> </Skeleton>
...@@ -333,7 +336,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -333,7 +336,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => {
return ( return (
<Flex alignItems="center"> <Flex alignItems="center">
<Box overflow="hidden"> <Box overflow="hidden">
<HashStringShortenDynamic hash={ data.address }/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address }/>
</Box> </Box>
{ data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> } { data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> }
</Flex> </Flex>
...@@ -384,7 +387,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -384,7 +387,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => {
return ( return (
<Flex alignItems="center" gap={ 3 }> <Flex alignItems="center" gap={ 3 }>
<Box overflow="hidden"> <Box overflow="hidden">
<HashStringShortenDynamic hash={ data.address }/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address }/>
</Box> </Box>
{ {
data.ens_info.names_count > 1 ? data.ens_info.names_count > 1 ?
......
...@@ -77,7 +77,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -77,7 +77,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
<Td fontSize="sm" verticalAlign="middle"> <Td fontSize="sm" verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } whiteSpace="nowrap" overflow="hidden" display="flex" alignItems="center"> <Skeleton isLoaded={ !isLoading } whiteSpace="nowrap" overflow="hidden" display="flex" alignItems="center">
<Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }> <Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }>
<HashStringShortenDynamic hash={ data.address }/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address }/>
</Box> </Box>
{ data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> } { data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> }
</Skeleton> </Skeleton>
...@@ -100,6 +100,9 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -100,6 +100,9 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
const addressName = data.name || data.ens_info?.name; const addressName = data.name || data.ens_info?.name;
const address = { const address = {
hash: data.address, hash: data.address,
filecoin: {
robust: data.filecoin_robust_address,
},
is_contract: data.type === 'contract', is_contract: data.type === 'contract',
is_verified: data.is_smart_contract_verified, is_verified: data.is_smart_contract_verified,
name: null, name: null,
...@@ -174,7 +177,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -174,7 +177,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
<Td fontSize="sm" verticalAlign="middle"> <Td fontSize="sm" verticalAlign="middle">
<Flex alignItems="center" overflow="hidden"> <Flex alignItems="center" overflow="hidden">
<Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }> <Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }>
<HashStringShortenDynamic hash={ data.address }/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address }/>
</Box> </Box>
{ data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> } { data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> }
</Flex> </Flex>
...@@ -392,7 +395,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { ...@@ -392,7 +395,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => {
<Td> <Td>
<Flex alignItems="center" overflow="hidden"> <Flex alignItems="center" overflow="hidden">
<Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }> <Box overflow="hidden" whiteSpace="nowrap" w={ data.is_smart_contract_verified ? 'calc(100%-28px)' : 'unset' }>
<HashStringShortenDynamic hash={ data.address }/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address }/>
</Box> </Box>
{ data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> } { data.is_smart_contract_verified && <IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 } flexShrink={ 0 }/> }
</Flex> </Flex>
......
...@@ -52,7 +52,7 @@ const SearchBarSuggestAddress = ({ data, isMobile, searchTerm }: Props) => { ...@@ -52,7 +52,7 @@ const SearchBarSuggestAddress = ({ data, isMobile, searchTerm }: Props) => {
{ data.certified && <ContractCertifiedLabel boxSize={ 5 } iconSize={ 5 } ml={ 1 }/> } { data.certified && <ContractCertifiedLabel boxSize={ 5 } iconSize={ 5 } ml={ 1 }/> }
</Flex> </Flex>
); );
const addressEl = <HashStringShortenDynamic hash={ data.address } isTooltipDisabled/>; const addressEl = <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address } isTooltipDisabled/>;
if (isMobile) { if (isMobile) {
return ( return (
......
...@@ -34,7 +34,7 @@ const SearchBarSuggestDomain = ({ data, isMobile, searchTerm }: Props) => { ...@@ -34,7 +34,7 @@ const SearchBarSuggestDomain = ({ data, isMobile, searchTerm }: Props) => {
whiteSpace="nowrap" whiteSpace="nowrap"
variant="secondary" variant="secondary"
> >
<HashStringShortenDynamic hash={ data.address } isTooltipDisabled/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address } isTooltipDisabled/>
</Text> </Text>
); );
......
...@@ -33,7 +33,7 @@ const SearchBarSuggestLabel = ({ data, isMobile, searchTerm }: Props) => { ...@@ -33,7 +33,7 @@ const SearchBarSuggestLabel = ({ data, isMobile, searchTerm }: Props) => {
whiteSpace="nowrap" whiteSpace="nowrap"
variant="secondary" variant="secondary"
> >
<HashStringShortenDynamic hash={ data.address } isTooltipDisabled/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address } isTooltipDisabled/>
</Text> </Text>
); );
......
...@@ -30,7 +30,7 @@ const SearchBarSuggestToken = ({ data, isMobile, searchTerm }: Props) => { ...@@ -30,7 +30,7 @@ const SearchBarSuggestToken = ({ data, isMobile, searchTerm }: Props) => {
const address = ( const address = (
<Text variant="secondary" whiteSpace="nowrap" overflow="hidden"> <Text variant="secondary" whiteSpace="nowrap" overflow="hidden">
<HashStringShortenDynamic hash={ data.address } isTooltipDisabled/> <HashStringShortenDynamic hash={ data.filecoin_robust_address || data.address } isTooltipDisabled/>
</Text> </Text>
); );
......
...@@ -28,6 +28,9 @@ const TokenInstanceCreatorAddress = ({ hash }: Props) => { ...@@ -28,6 +28,9 @@ const TokenInstanceCreatorAddress = ({ hash }: Props) => {
const creatorAddress = { const creatorAddress = {
hash: addressQuery.data.creator_address_hash, hash: addressQuery.data.creator_address_hash,
filecoin: {
robust: addressQuery.data.creator_filecoin_robust_address,
},
is_contract: false, is_contract: false,
implementations: null, implementations: null,
}; };
......
...@@ -32,6 +32,7 @@ const TokensTableItem = ({ ...@@ -32,6 +32,7 @@ const TokensTableItem = ({
const { const {
address, address,
filecoin_robust_address: filecoinRobustAddress,
exchange_rate: exchangeRate, exchange_rate: exchangeRate,
type, type,
holders, holders,
...@@ -70,7 +71,7 @@ const TokensTableItem = ({ ...@@ -70,7 +71,7 @@ const TokensTableItem = ({
</Grid> </Grid>
<Flex justifyContent="space-between" alignItems="center" width="150px" ml={ 7 } mt={ -2 }> <Flex justifyContent="space-between" alignItems="center" width="150px" ml={ 7 } mt={ -2 }>
<AddressEntity <AddressEntity
address={{ hash: address }} address={{ hash: address, filecoin: { robust: filecoinRobustAddress } }}
isLoading={ isLoading } isLoading={ isLoading }
truncation="constant" truncation="constant"
noIcon noIcon
......
...@@ -32,6 +32,7 @@ const TokensTableItem = ({ ...@@ -32,6 +32,7 @@ const TokensTableItem = ({
const { const {
address, address,
filecoin_robust_address: filecoinRobustAddress,
exchange_rate: exchangeRate, exchange_rate: exchangeRate,
type, type,
holders, holders,
...@@ -45,6 +46,9 @@ const TokensTableItem = ({ ...@@ -45,6 +46,9 @@ const TokensTableItem = ({
const tokenAddress: AddressEntityProps['address'] = { const tokenAddress: AddressEntityProps['address'] = {
hash: address, hash: address,
filecoin: {
robust: filecoinRobustAddress,
},
name: '', name: '',
is_contract: true, is_contract: true,
is_verified: false, is_verified: false,
......
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