Support is_smart_contract_address in search results (#3250)
@@ -27,6 +27,7 @@ export const token1: SearchResultToken = {
|
||||
exchange_rate: null,
|
||||
is_verified_via_admin_panel: true,
|
||||
is_smart_contract_verified: true,
|
||||
is_smart_contract_address: true,
|
||||
reputation: 'ok',
|
||||
};
|
||||
|
||||
@@ -43,6 +44,7 @@ export const token2: SearchResultToken = {
|
||||
exchange_rate: '1.11',
|
||||
is_verified_via_admin_panel: false,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
reputation: 'ok',
|
||||
};
|
||||
|
||||
@@ -77,6 +79,7 @@ export const address1: SearchResultAddressOrContract = {
|
||||
name: null,
|
||||
type: 'address' as const,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
|
||||
};
|
||||
|
||||
@@ -85,6 +88,7 @@ export const address2: SearchResultAddressOrContract = {
|
||||
name: null,
|
||||
type: 'address' as const,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131b',
|
||||
ens_info: {
|
||||
address_hash: '0x1234567890123456789012345678901234567890',
|
||||
@@ -99,6 +103,7 @@ export const contract1: SearchResultAddressOrContract = {
|
||||
name: 'Unknown contract in this network',
|
||||
type: 'contract' as const,
|
||||
is_smart_contract_verified: true,
|
||||
is_smart_contract_address: true,
|
||||
url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
|
||||
};
|
||||
|
||||
@@ -108,6 +113,7 @@ export const contract2: SearchResultAddressOrContract = {
|
||||
type: 'contract' as const,
|
||||
is_smart_contract_verified: true,
|
||||
certified: true,
|
||||
is_smart_contract_address: true,
|
||||
url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
|
||||
};
|
||||
|
||||
@@ -116,6 +122,7 @@ export const label1: SearchResultLabel = {
|
||||
name: 'utko',
|
||||
type: 'label' as const,
|
||||
is_smart_contract_verified: true,
|
||||
is_smart_contract_address: true,
|
||||
url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
|
||||
};
|
||||
|
||||
@@ -148,6 +155,7 @@ export const domain1: SearchResultDomain = {
|
||||
names_count: 1,
|
||||
},
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
name: null,
|
||||
type: 'ens_domain',
|
||||
url: '/address/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
|
||||
|
||||
@@ -12,6 +12,7 @@ export const SEARCH_RESULT_ITEM: SearchResultItem = {
|
||||
icon_url: null,
|
||||
is_verified_via_admin_panel: false,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
exchange_rate: '1.11',
|
||||
total_supply: null,
|
||||
token_type: 'ERC-20',
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface SearchResultToken {
|
||||
total_supply: string | null;
|
||||
is_verified_via_admin_panel: boolean;
|
||||
is_smart_contract_verified: boolean;
|
||||
is_smart_contract_address: boolean;
|
||||
filecoin_robust_address?: string | null;
|
||||
certified?: boolean;
|
||||
reputation: TokenReputation | null;
|
||||
@@ -50,6 +51,7 @@ interface SearchResultAddressData {
|
||||
name: string | null;
|
||||
address_hash: string;
|
||||
is_smart_contract_verified: boolean;
|
||||
is_smart_contract_address: boolean;
|
||||
certified?: true;
|
||||
filecoin_robust_address?: string | null;
|
||||
url?: string; // not used by the frontend, we build the url ourselves
|
||||
@@ -102,6 +104,7 @@ export interface SearchResultLabel {
|
||||
filecoin_robust_address?: string | null;
|
||||
name: string;
|
||||
is_smart_contract_verified: boolean;
|
||||
is_smart_contract_address: boolean;
|
||||
url?: string; // not used by the frontend, we build the url ourselves
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ export interface QuickSearchResultToken {
|
||||
address_hash: string;
|
||||
icon_url: string | null;
|
||||
is_smart_contract_verified: boolean;
|
||||
is_smart_contract_address: boolean;
|
||||
chain_id: string;
|
||||
reputation: null;
|
||||
total_supply: string | null;
|
||||
|
||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
@@ -100,7 +100,7 @@ const SearchResultListItem = ({ data, searchTerm, isLoading, addressFormat }: Pr
|
||||
filecoin: {
|
||||
robust: data.filecoin_robust_address,
|
||||
},
|
||||
is_contract: data.type === 'contract',
|
||||
is_contract: data.type === 'contract' || data.is_smart_contract_address,
|
||||
is_verified: data.is_smart_contract_verified,
|
||||
name: null,
|
||||
implementations: null,
|
||||
|
||||
@@ -120,7 +120,7 @@ const SearchResultTableItem = ({ data, searchTerm, isLoading, addressFormat }: P
|
||||
filecoin: {
|
||||
robust: data.filecoin_robust_address,
|
||||
},
|
||||
is_contract: data.type === 'contract',
|
||||
is_contract: data.type === 'contract' || data.is_smart_contract_address,
|
||||
is_verified: data.is_smart_contract_verified,
|
||||
name: null,
|
||||
implementations: null,
|
||||
|
||||
@@ -26,7 +26,7 @@ const SearchBarSuggestAddress = ({ data, isMobile, searchTerm, addressFormat }:
|
||||
if ('chain_infos' in data) {
|
||||
return contract.isContract(data);
|
||||
}
|
||||
return data.type === 'contract';
|
||||
return data.type === 'contract' || data.is_smart_contract_address;
|
||||
})();
|
||||
|
||||
const isVerified = (() => {
|
||||
|
||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@@ -66,6 +66,7 @@ export default function useSearchMultichain({ searchTerm, enabled }: Props) {
|
||||
symbol: item.symbol ?? '',
|
||||
icon_url: item.icon_url ?? null,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
// As of now, there can be only one chain in the object
|
||||
chain_id: Object.keys(item.chain_infos)[0],
|
||||
reputation: null,
|
||||
|
||||
@@ -311,6 +311,7 @@ describe('useSearchWithClusters', () => {
|
||||
name: 'test-cluster',
|
||||
address_hash: '0x1234567890123456789012345678901234567890',
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
cluster_info: {
|
||||
cluster_id: 'cluster-123',
|
||||
name: 'test-cluster',
|
||||
@@ -348,6 +349,7 @@ describe('useSearchWithClusters', () => {
|
||||
name: 'simple-cluster',
|
||||
address_hash: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
cluster_info: {
|
||||
cluster_id: 'simple-cluster',
|
||||
name: 'simple-cluster',
|
||||
@@ -385,6 +387,7 @@ describe('useSearchWithClusters', () => {
|
||||
name: 'test',
|
||||
address_hash: '0x123',
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
cluster_info: {
|
||||
cluster_id: 'test',
|
||||
name: 'test',
|
||||
@@ -458,7 +461,7 @@ describe('useSearchWithClusters', () => {
|
||||
describe('fallback to regular search', () => {
|
||||
it('should return regular search results for non-cluster queries', () => {
|
||||
const regularSearchData = [
|
||||
{ type: 'address', address_hash: '0x123', is_smart_contract_verified: true },
|
||||
{ type: 'address', address_hash: '0x123', is_smart_contract_verified: true, is_smart_contract_address: true },
|
||||
];
|
||||
|
||||
mockUseQuickSearchQuery.mockReturnValue({
|
||||
|
||||
@@ -40,6 +40,7 @@ function transformClusterToSearchResult(cluster: {
|
||||
name: cluster.name,
|
||||
address_hash: ownerAddress,
|
||||
is_smart_contract_verified: false,
|
||||
is_smart_contract_address: false,
|
||||
cluster_info: {
|
||||
cluster_id: cluster.clusterId || cluster.name,
|
||||
name: cluster.name,
|
||||
|
||||