Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to view DS Blocks #13

Merged
merged 9 commits into from
Sep 18, 2023
4 changes: 2 additions & 2 deletions src/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const Header: FC<HeaderProps> = ({sourcifyPresent}) => {
<input
className="w-full rounded-l border-t border-b border-l px-2 py-1 text-sm focus:outline-none"
type="text"
size={60}
placeholder={`Type "/" to search by address / txn hash / block number${
size={80}
placeholder={`Type "/" to search by address / txn hash / block number / # ds block number${
lucac-zilliqa marked this conversation as resolved.
Show resolved Hide resolved
provider?.network.ensAddress ? " / ENS name" : ""
}`}
onChange={handleChange}
Expand Down
9 changes: 9 additions & 0 deletions src/search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@ const doSearch = async (q: string, navigate: NavigateFunction) => {
return;
}

// DS Block number?
if(q.charAt(0) === "#"){
const dsBlockNumber = parseInt(q.substring(1));
if(!isNaN(dsBlockNumber)) {
navigate(`/dsblock/${dsBlockNumber}`);
return;
}
}

// Epoch?
if (q.startsWith("epoch:")) {
const mayBeEpoch = q.substring(6);
Expand Down