Skip to content

Commit

Permalink
fix(explorer): genesis addresses with objects not showing up in search (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
begonaalvarezd authored Aug 12, 2024
1 parent 63480cd commit df3f3c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/explorer/src/hooks/useSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
{
Expand Down

0 comments on commit df3f3c7

Please sign in to comment.