diff --git a/src/api/hooks/useGetSearchResults.ts b/src/api/hooks/useGetSearchResults.ts index 5ba8e0ae..72b4ef6e 100644 --- a/src/api/hooks/useGetSearchResults.ts +++ b/src/api/hooks/useGetSearchResults.ts @@ -16,6 +16,7 @@ import { } from "../../pages/utils"; import {getAddressFromName} from "./useGetANS"; import {sendToGTM} from "./useGoogleTagManager"; +import {objectCoreAddress} from "../../constants"; export type SearchResult = { label: string; @@ -90,11 +91,19 @@ export default function useGetSearchResults(input: string) { {address: searchText}, state.network_value, ) - .then((): SearchResult => { - return { - label: `Object ${searchText}`, - to: `/object/${searchText}`, - }; + .then((resources): SearchResult | undefined => { + let hasObjectCore = false; + resources.forEach((resource) => { + if (resource.type === objectCoreAddress) { + hasObjectCore = true; + } + }); + if (hasObjectCore) { + return { + label: `Object ${searchText}`, + to: `/object/${searchText}`, + }; + } }) .catch(() => { return null; diff --git a/src/constants.tsx b/src/constants.tsx index e7fc43bd..fe4de70c 100644 --- a/src/constants.tsx +++ b/src/constants.tsx @@ -80,3 +80,8 @@ export const WHILTELISTED_TESTNET_DELEGATION_NODES = import.meta.env .REACT_APP_WHILTELISTED_TESTNET_DELEGATION_NODES ? import.meta.env.REACT_APP_WHILTELISTED_TESTNET_DELEGATION_NODES.split(",") : null; + +/** + * Core Address + */ +export const objectCoreAddress = "0x1::object::ObjectCore";