-
Notifications
You must be signed in to change notification settings - Fork 23
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
14 changed files
with
606 additions
and
284 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,57 +1,33 @@ | ||
"use client"; | ||
|
||
import { useTransaction } from "@/providers/TransactionProvider"; | ||
import { Badge, Box, Button, Flex, Link, Separator, Text } from "@radix-ui/themes"; | ||
import { Log } from "viem"; | ||
import { Button, Flex, Callout } from "@radix-ui/themes"; | ||
import { useMe } from "@/providers/MeProvider"; | ||
import { ArrowRightIcon } from "@radix-ui/react-icons"; | ||
import LogoAnimatedLight from "../LogoAnimatedLight"; | ||
|
||
export default function History() { | ||
const { loading, txs, getLastTxs, unwatchLogs } = useTransaction(); | ||
|
||
if (loading) | ||
return ( | ||
<Text style={{ marginTop: "2rem", marginBottom: "4rem" }}> | ||
Fetching latest transactions... | ||
</Text> | ||
); | ||
const { me } = useMe(); | ||
|
||
return ( | ||
<Flex direction="column" style={{ marginTop: "2rem", marginBottom: "4rem" }}> | ||
<Flex direction="row" gap="2" justify="between"> | ||
<Text size="6" weight="bold"> | ||
History | ||
</Text> | ||
</Flex> | ||
<Separator my="3" size="4" color="gray" /> | ||
|
||
<Flex direction="column" gap="2"> | ||
{!loading && | ||
Array.isArray(txs) && | ||
txs.map((tx: Log) => { | ||
return ( | ||
<Box key={tx?.blockNumber}> | ||
<Flex direction="row" gap="1" justify="between"> | ||
<Text size="2"> | ||
<Link | ||
href={`https://goerli.basescan.org/tx/${tx.transactionHash}`} | ||
target="_blank" | ||
> | ||
{tx?.transactionHash?.toString().slice(0, 4)}... | ||
{tx?.transactionHash?.toString().slice(-4)} | ||
</Link> | ||
</Text> | ||
<Text size="1"> | ||
{(tx as unknown as { args: { status: boolean } }).args.status} | ||
</Text> | ||
{(tx as unknown as { args: { success: boolean } })?.args.success ? ( | ||
<Badge color="green">Complete</Badge> | ||
) : ( | ||
<Badge color="red">Failed</Badge> | ||
)} | ||
</Flex> | ||
</Box> | ||
); | ||
})} | ||
<Callout.Root style={{ marginTop: "var(--space-4)" }}> | ||
<LogoAnimatedLight style={{ width: "60%", marginBottom: ".5rem" }} /> | ||
<Callout.Text> | ||
You smart contract wallet is deployed during the first transaction that you make. You can | ||
still receive tokens and ETH on your smart contract wallet address in the meantime. | ||
</Callout.Text> | ||
<Flex direction="row" gap="1" justify="between"> | ||
<Button | ||
size="2" | ||
variant="outline" | ||
style={{ marginTop: ".3rem" }} | ||
onClick={() => { | ||
window.open(`https://sepolia.etherscan.io/address/${me?.account}`, "_blank"); | ||
}} | ||
> | ||
Browse history on etherscan | ||
<ArrowRightIcon /> | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
</Callout.Root> | ||
); | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.