Skip to content

Commit

Permalink
feat: returning empty address for account without recente transactions (
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigobranas authored Sep 18, 2024
1 parent 6c950b2 commit 548cf9a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,32 @@ const SearchResultDropdown = forwardRef<HTMLDivElement, SearchDropdownProps>(
)}
</Link>
</Dropdown.Item>
<Dropdown.Separator />
<Dropdown.Label>Recent Transactions</Dropdown.Label>
{searchResult.account.transactions?.map((transaction) => {
return (
<Dropdown.Item
key={transaction?.id}
className={classes.dropdownItem()}
>
<Link
as={NextLink}
href={Routes.txSimple(transaction?.id!)}
onClick={onSelectItem}
>
{shortAddress(transaction?.id || '', trimL, trimR)}
</Link>
</Dropdown.Item>
);
})}
{!!searchResult.account.transactions?.length && (
<>
<Dropdown.Separator />
<Dropdown.Label>Recent Transactions</Dropdown.Label>
{searchResult.account.transactions?.map((transaction) => {
return (
<Dropdown.Item
key={transaction?.id}
className={classes.dropdownItem()}
>
<Link
as={NextLink}
href={Routes.txSimple(transaction?.id!)}
onClick={onSelectItem}
>
{shortAddress(
transaction?.id || '',
trimL,
trimR,
)}
</Link>
</Dropdown.Item>
);
})}
</>
)}
</>
)}
{searchResult?.block && (
Expand Down
9 changes: 9 additions & 0 deletions packages/graphql/src/graphql/resolvers/SearchResolver.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -67,5 +68,13 @@ export class SearchResolver {
},
};
}
if (isB256(address)) {
return {
account: {
address,
transactions: [],
},
};
}
}
}

0 comments on commit 548cf9a

Please sign in to comment.