-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
145 changed files
with
5,324 additions
and
4,010 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Template for NextJS environment variables. | ||
|
||
# For local development, copy this file, rename it to .env.local, and fill in the values. | ||
# When deploying live, you'll need to store the vars in Vercel/System config. | ||
|
||
# If not set, we provide default values (check `scaffold.config.ts`) so developers can start prototyping out of the box, | ||
# but we recommend getting your own API Keys for Production Apps. | ||
|
||
# To access the values stored in this env file you can use: process.env.VARIABLENAME | ||
# You'll need to prefix the variables names with NEXT_PUBLIC_ if you want to access them on the client side. | ||
# More info: https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables | ||
NEXT_PUBLIC_ALCHEMY_API_KEY= | ||
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
{ | ||
"endOfLine": "auto" | ||
} | ||
], | ||
"@next/next/no-page-custom-font": ["off"] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { BackButton } from "./BackButton"; | ||
import { ContractTabs } from "./ContractTabs"; | ||
import { Address, Balance } from "~~/components/scaffold-eth"; | ||
|
||
export const AddressComponent = ({ | ||
address, | ||
contractData, | ||
}: { | ||
address: string; | ||
contractData: { bytecode: string; assembly: string } | null; | ||
}) => { | ||
return ( | ||
<div className="m-10 mb-20"> | ||
<div className="flex justify-start mb-5"> | ||
<BackButton /> | ||
</div> | ||
<div className="col-span-5 grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-10"> | ||
<div className="col-span-1 flex flex-col"> | ||
<div className="bg-base-100 border-base-300 border shadow-md shadow-secondary rounded-3xl px-6 lg:px-8 mb-6 space-y-1 py-4 overflow-x-auto"> | ||
<div className="flex"> | ||
<div className="flex flex-col gap-1"> | ||
<Address address={address} format="long" onlyEnsOrAddress /> | ||
<div className="flex gap-1 items-center"> | ||
<span className="font-bold text-sm">Balance:</span> | ||
<Balance address={address} className="text" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<ContractTabs address={address} contractData={contractData} /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
|
||
export const BackButton = () => { | ||
const router = useRouter(); | ||
return ( | ||
<button className="btn btn-sm btn-primary" onClick={() => router.back()}> | ||
Back | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
"use client"; | ||
|
||
import { useEffect, useState } from "react"; | ||
import { AddressCodeTab } from "./AddressCodeTab"; | ||
import { AddressLogsTab } from "./AddressLogsTab"; | ||
import { AddressStorageTab } from "./AddressStorageTab"; | ||
import { PaginationButton } from "./PaginationButton"; | ||
import { TransactionsTable } from "./TransactionsTable"; | ||
import { createPublicClient, http } from "viem"; | ||
import { hardhat } from "viem/chains"; | ||
import { useFetchBlocks } from "~~/hooks/scaffold-eth"; | ||
|
||
type AddressCodeTabProps = { | ||
bytecode: string; | ||
assembly: string; | ||
}; | ||
|
||
type PageProps = { | ||
address: string; | ||
contractData: AddressCodeTabProps | null; | ||
}; | ||
|
||
const publicClient = createPublicClient({ | ||
chain: hardhat, | ||
transport: http(), | ||
}); | ||
|
||
export const ContractTabs = ({ address, contractData }: PageProps) => { | ||
const { blocks, transactionReceipts, currentPage, totalBlocks, setCurrentPage } = useFetchBlocks(); | ||
const [activeTab, setActiveTab] = useState("transactions"); | ||
const [isContract, setIsContract] = useState(false); | ||
|
||
useEffect(() => { | ||
const checkIsContract = async () => { | ||
const contractCode = await publicClient.getBytecode({ address: address }); | ||
setIsContract(contractCode !== undefined && contractCode !== "0x"); | ||
}; | ||
|
||
checkIsContract(); | ||
}, [address]); | ||
|
||
const filteredBlocks = blocks.filter(block => | ||
block.transactions.some(tx => { | ||
if (typeof tx === "string") { | ||
return false; | ||
} | ||
return tx.from.toLowerCase() === address.toLowerCase() || tx.to?.toLowerCase() === address.toLowerCase(); | ||
}), | ||
); | ||
|
||
return ( | ||
<> | ||
{isContract && ( | ||
<div className="tabs tabs-lifted w-min"> | ||
<button | ||
className={`tab ${activeTab === "transactions" ? "tab-active" : ""}`} | ||
onClick={() => setActiveTab("transactions")} | ||
> | ||
Transactions | ||
</button> | ||
<button className={`tab ${activeTab === "code" ? "tab-active" : ""}`} onClick={() => setActiveTab("code")}> | ||
Code | ||
</button> | ||
<button | ||
className={`tab ${activeTab === "storage" ? "tab-active" : ""}`} | ||
onClick={() => setActiveTab("storage")} | ||
> | ||
Storage | ||
</button> | ||
<button className={`tab ${activeTab === "logs" ? "tab-active" : ""}`} onClick={() => setActiveTab("logs")}> | ||
Logs | ||
</button> | ||
</div> | ||
)} | ||
{activeTab === "transactions" && ( | ||
<div className="pt-4"> | ||
<TransactionsTable blocks={filteredBlocks} transactionReceipts={transactionReceipts} /> | ||
<PaginationButton | ||
currentPage={currentPage} | ||
totalItems={Number(totalBlocks)} | ||
setCurrentPage={setCurrentPage} | ||
/> | ||
</div> | ||
)} | ||
{activeTab === "code" && contractData && ( | ||
<AddressCodeTab bytecode={contractData.bytecode} assembly={contractData.assembly} /> | ||
)} | ||
{activeTab === "storage" && <AddressStorageTab address={address} />} | ||
{activeTab === "logs" && <AddressLogsTab address={address} />} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 14 additions & 13 deletions
27
ui/components/blockexplorer/SearchBar.tsx → ...p/blockexplorer/_components/SearchBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...ponents/blockexplorer/TransactionHash.tsx → ...kexplorer/_components/TransactionHash.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.