From df3f3c73a7fbe572754e39031f238b69c616fdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20=C3=81lvarez=20de=20la=20Cruz?= Date: Mon, 12 Aug 2024 16:27:01 +0200 Subject: [PATCH] fix(explorer): genesis addresses with objects not showing up in search (#1653) * fix(explorer): genesis addresses with objects not showing up in search * refactor: search for owned objects only if no tx blocks found * refactor: make the owned objects request tiny --- apps/explorer/src/hooks/useSearch.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/explorer/src/hooks/useSearch.ts b/apps/explorer/src/hooks/useSearch.ts index c9ec3a6bd6f..b77683cc876 100644 --- a/apps/explorer/src/hooks/useSearch.ts +++ b/apps/explorer/src/hooks/useSearch.ts @@ -98,7 +98,15 @@ const getResultsForAddress = async ( }), ]); - if (!from.data?.length && !to.data?.length) return null; + // Note: we need to query owned objects separately + // because genesis addresses might not be involved in any transaction yet. + let ownedObjects = []; + if (!from.data?.length && !to.data?.length) { + const response = await client.getOwnedObjects({ owner: normalized, limit: 1 }); + ownedObjects = response.data; + } + + if (!from.data?.length && !to.data?.length && !ownedObjects?.length) return null; return [ {