From 60a457d862bbec941daa1beb9ed3ff7d03e3c261 Mon Sep 17 00:00:00 2001 From: isstuev Date: Thu, 24 Oct 2024 13:27:08 +0200 Subject: [PATCH] add more robust addresses --- types/api/address.ts | 7 ++++--- types/api/contract.ts | 1 + types/api/search.ts | 4 ++++ types/api/token.ts | 1 + ui/address/AddressDetails.tsx | 8 ++++++-- ui/address/contract/alerts/ContractDetailsAlerts.tsx | 2 +- ui/searchResults/SearchResultListItem.tsx | 9 ++++++--- ui/searchResults/SearchResultTableItem.tsx | 9 ++++++--- .../SearchBarSuggest/SearchBarSuggestAddress.tsx | 2 +- .../SearchBarSuggest/SearchBarSuggestDomain.tsx | 2 +- .../searchBar/SearchBarSuggest/SearchBarSuggestLabel.tsx | 2 +- .../searchBar/SearchBarSuggest/SearchBarSuggestToken.tsx | 2 +- ui/tokenInstance/details/TokenInstanceCreatorAddress.tsx | 3 +++ ui/tokens/TokensListItem.tsx | 3 ++- ui/tokens/TokensTableItem.tsx | 4 ++++ 15 files changed, 42 insertions(+), 17 deletions(-) diff --git a/types/api/address.ts b/types/api/address.ts index 3d38e65d86..9d316f81c3 100644 --- a/types/api/address.ts +++ b/types/api/address.ts @@ -11,6 +11,7 @@ export interface Address extends UserTags { block_number_balance_updated_at: number | null; coin_balance: string | null; creator_address_hash: string | null; + creator_filecoin_robust_address?: string | null; creation_tx_hash: string | null; exchange_rate: string | null; ens_domain_name: string | null; @@ -271,9 +272,9 @@ export type AddressEpochRewardsItem = { } export type AddressFilecoinParams = { - actor_type: FilecoinActorType; - id: string; - robust: string; + actor_type?: FilecoinActorType; + id?: string | null; + robust?: string | null; } export type FilecoinActorType = diff --git a/types/api/contract.ts b/types/api/contract.ts index f1e937d866..8ae7cbd9d5 100644 --- a/types/api/contract.ts +++ b/types/api/contract.ts @@ -67,6 +67,7 @@ export interface SmartContract { remappings?: Array; }; verified_twin_address_hash: string | null; + verified_twin_filecoin_robust_address?: string | null; proxy_type: SmartContractProxyType | null; language: string | null; license_type: SmartContractLicenseType | null; diff --git a/types/api/search.ts b/types/api/search.ts index 7d738e7cbd..7572c60060 100644 --- a/types/api/search.ts +++ b/types/api/search.ts @@ -15,6 +15,7 @@ export interface SearchResultToken { total_supply: string | null; is_verified_via_admin_panel: boolean; is_smart_contract_verified: boolean; + filecoin_robust_address?: string | null; } export interface SearchResultAddressOrContract { @@ -23,6 +24,7 @@ export interface SearchResultAddressOrContract { address: string; is_smart_contract_verified: boolean; certified?: true; + filecoin_robust_address?: string | null; url?: string; // not used by the frontend, we build the url ourselves ens_info?: { address_hash: string; @@ -36,6 +38,7 @@ export interface SearchResultDomain { type: 'ens_domain'; name: string | null; address: string; + filecoin_robust_address?: string | null; is_smart_contract_verified: boolean; url?: string; // not used by the frontend, we build the url ourselves ens_info: { @@ -49,6 +52,7 @@ export interface SearchResultDomain { export interface SearchResultLabel { type: 'label'; address: string; + filecoin_robust_address?: string | null; name: string; is_smart_contract_verified: boolean; url?: string; // not used by the frontend, we build the url ourselves diff --git a/types/api/token.ts b/types/api/token.ts index 58d4e484fb..c321667b57 100644 --- a/types/api/token.ts +++ b/types/api/token.ts @@ -20,6 +20,7 @@ export interface TokenInfo { bridge_type?: string | null; origin_chain_id?: string | null; foreign_address?: string | null; + filecoin_robust_address?: string | null; } export interface TokenCounters { diff --git a/ui/address/AddressDetails.tsx b/ui/address/AddressDetails.tsx index 47d0a7dec3..5d56228eda 100644 --- a/ui/address/AddressDetails.tsx +++ b/ui/address/AddressDetails.tsx @@ -67,6 +67,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { has_token_transfers: true, has_validated_blocks: false, filecoin: undefined, + creator_filecoin_robust_address: null, + creator_address_hash: null, }), [ addressHash ]); // error handling (except 404 codes) @@ -87,6 +89,8 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { return null; } + const creatorAddressHash = data.creator_address_hash; + return ( <> { addressQuery.isDegradedData && } @@ -140,7 +144,7 @@ const AddressDetails = ({ addressQuery, scrollRef }: Props) => { - { data.is_contract && data.creation_tx_hash && data.creator_address_hash && ( + { data.is_contract && data.creation_tx_hash && (creatorAddressHash) && ( <> { diff --git a/ui/address/contract/alerts/ContractDetailsAlerts.tsx b/ui/address/contract/alerts/ContractDetailsAlerts.tsx index ed040c94a1..cf71876d79 100644 --- a/ui/address/contract/alerts/ContractDetailsAlerts.tsx +++ b/ui/address/contract/alerts/ContractDetailsAlerts.tsx @@ -72,7 +72,7 @@ const ContractDetailsAlerts = ({ data, isLoading, addressHash, channel }: Props) Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB { const shouldHighlightHash = ADDRESS_REGEXP.test(searchTerm); const address = { hash: data.address, + filecoin: { + robust: data.filecoin_robust_address, + }, is_contract: data.type === 'contract', is_verified: data.is_smart_contract_verified, name: null, @@ -288,7 +291,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { - + { data.is_smart_contract_verified && } @@ -333,7 +336,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { return ( - + { data.is_smart_contract_verified && } @@ -384,7 +387,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading }: Props) => { return ( - + { data.ens_info.names_count > 1 ? diff --git a/ui/searchResults/SearchResultTableItem.tsx b/ui/searchResults/SearchResultTableItem.tsx index ae24e3e7d2..5b13563aca 100644 --- a/ui/searchResults/SearchResultTableItem.tsx +++ b/ui/searchResults/SearchResultTableItem.tsx @@ -77,7 +77,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { - + { data.is_smart_contract_verified && } @@ -100,6 +100,9 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { const addressName = data.name || data.ens_info?.name; const address = { hash: data.address, + filecoin: { + robust: data.filecoin_robust_address, + }, is_contract: data.type === 'contract', is_verified: data.is_smart_contract_verified, name: null, @@ -174,7 +177,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { - + { data.is_smart_contract_verified && } @@ -392,7 +395,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading }: Props) => { - + { data.is_smart_contract_verified && } diff --git a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestAddress.tsx b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestAddress.tsx index ef22025c2e..4304e095de 100644 --- a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestAddress.tsx +++ b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestAddress.tsx @@ -52,7 +52,7 @@ const SearchBarSuggestAddress = ({ data, isMobile, searchTerm }: Props) => { { data.certified && } ); - const addressEl = ; + const addressEl = ; if (isMobile) { return ( diff --git a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestDomain.tsx b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestDomain.tsx index 2ec60ccc8d..37b2de65b1 100644 --- a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestDomain.tsx +++ b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestDomain.tsx @@ -34,7 +34,7 @@ const SearchBarSuggestDomain = ({ data, isMobile, searchTerm }: Props) => { whiteSpace="nowrap" variant="secondary" > - + ); diff --git a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestLabel.tsx b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestLabel.tsx index 1e1ffcadb9..dbb98005b4 100644 --- a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestLabel.tsx +++ b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestLabel.tsx @@ -33,7 +33,7 @@ const SearchBarSuggestLabel = ({ data, isMobile, searchTerm }: Props) => { whiteSpace="nowrap" variant="secondary" > - + ); diff --git a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestToken.tsx b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestToken.tsx index 67e31f239c..78d23f9f78 100644 --- a/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestToken.tsx +++ b/ui/snippets/searchBar/SearchBarSuggest/SearchBarSuggestToken.tsx @@ -30,7 +30,7 @@ const SearchBarSuggestToken = ({ data, isMobile, searchTerm }: Props) => { const address = ( - + ); diff --git a/ui/tokenInstance/details/TokenInstanceCreatorAddress.tsx b/ui/tokenInstance/details/TokenInstanceCreatorAddress.tsx index bab4c00800..276fe95010 100644 --- a/ui/tokenInstance/details/TokenInstanceCreatorAddress.tsx +++ b/ui/tokenInstance/details/TokenInstanceCreatorAddress.tsx @@ -28,6 +28,9 @@ const TokenInstanceCreatorAddress = ({ hash }: Props) => { const creatorAddress = { hash: addressQuery.data.creator_address_hash, + filecoin: { + robust: addressQuery.data.creator_filecoin_robust_address, + }, is_contract: false, implementations: null, }; diff --git a/ui/tokens/TokensListItem.tsx b/ui/tokens/TokensListItem.tsx index b0cbfdd352..9ddfa612ba 100644 --- a/ui/tokens/TokensListItem.tsx +++ b/ui/tokens/TokensListItem.tsx @@ -32,6 +32,7 @@ const TokensTableItem = ({ const { address, + filecoin_robust_address: filecoinRobustAddress, exchange_rate: exchangeRate, type, holders, @@ -70,7 +71,7 @@ const TokensTableItem = ({