From 548cf9aa7a3ce8b6f6887ac56a268ca5d8bed142 Mon Sep 17 00:00:00 2001 From: Rodrigo Branas Date: Wed, 18 Sep 2024 13:51:20 -0300 Subject: [PATCH] feat: returning empty address for account without recente transactions (#548) --- .../Core/components/Search/SearchInput.tsx | 44 +++++++++++-------- .../src/graphql/resolvers/SearchResolver.ts | 9 ++++ 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/packages/app-explorer/src/systems/Core/components/Search/SearchInput.tsx b/packages/app-explorer/src/systems/Core/components/Search/SearchInput.tsx index ff097628..9eca828d 100644 --- a/packages/app-explorer/src/systems/Core/components/Search/SearchInput.tsx +++ b/packages/app-explorer/src/systems/Core/components/Search/SearchInput.tsx @@ -105,24 +105,32 @@ const SearchResultDropdown = forwardRef( )} - - Recent Transactions - {searchResult.account.transactions?.map((transaction) => { - return ( - - - {shortAddress(transaction?.id || '', trimL, trimR)} - - - ); - })} + {!!searchResult.account.transactions?.length && ( + <> + + Recent Transactions + {searchResult.account.transactions?.map((transaction) => { + return ( + + + {shortAddress( + transaction?.id || '', + trimL, + trimR, + )} + + + ); + })} + + )} )} {searchResult?.block && ( diff --git a/packages/graphql/src/graphql/resolvers/SearchResolver.ts b/packages/graphql/src/graphql/resolvers/SearchResolver.ts index 9ad6bc70..09d445b3 100644 --- a/packages/graphql/src/graphql/resolvers/SearchResolver.ts +++ b/packages/graphql/src/graphql/resolvers/SearchResolver.ts @@ -1,3 +1,4 @@ +import { isB256 } from 'fuels'; import { Hash256 } from '~/application/vo'; import { TransactionEntity } from '~/domain/Transaction/TransactionEntity'; import BlockDAO from '~/infra/dao/BlockDAO'; @@ -67,5 +68,13 @@ export class SearchResolver { }, }; } + if (isB256(address)) { + return { + account: { + address, + transactions: [], + }, + }; + } } }