Skip to content

Commit 0bd5944

Browse files
bayulaksana479andrewklau
authored andcommitted
feat(frontend): block list & details, txn list
1 parent 98327b7 commit 0bd5944

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1784
-643
lines changed

apps/api/src/sql/queries/accounts/txns/txns.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ FROM
5858
AND ar.receipt_included_in_block_timestamp <= ts.block_timestamp + 300000000000 -- 5m in ns
5959
AND r.included_in_block_timestamp >= ts.block_timestamp
6060
AND r.included_in_block_timestamp <= ts.block_timestamp + 300000000000 -- 5m in ns
61-
AND r.originated_from_transaction_hash = ts.converted_into_receipt_id
61+
AND r.receipt_id = ts.converted_into_receipt_id
6262
) aa ON TRUE
6363
LEFT JOIN LATERAL (
6464
SELECT

apps/api/src/sql/queries/txns/count.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SELECT
2-
COUNT(block_timestamp)
2+
COUNT(block_timestamp),
3+
'0' AS cost
34
FROM
45
transactions
56
WHERE

apps/api/src/sql/queries/txns/txn.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ FROM
4848
'args',
4949
args,
5050
'rlp_hash',
51-
rlp_hash
51+
nep518_rlp_hash
5252
)
5353
ORDER BY
5454
index_in_action_receipt

apps/api/src/sql/queries/txns/txns.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ FROM
103103
FROM
104104
txns_selected t
105105
)
106-
AND r.originated_from_transaction_hash = ts.converted_into_receipt_id
106+
AND r.receipt_id = ts.converted_into_receipt_id
107107
) aa ON TRUE
108108
LEFT JOIN LATERAL (
109109
SELECT
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Overview } from '@/components/blocks/overview';
2+
import { ErrorSuspense } from '@/components/error-suspense';
3+
import { fetchBlock } from '@/data/blocks';
4+
5+
type Props = PageProps<'/[lang]/blocks/[block]'>;
6+
7+
const BlockPage = async ({ params }: Props) => {
8+
const { block } = await params;
9+
const blockPromise = fetchBlock(block);
10+
11+
return (
12+
<div className="flex flex-col gap-4">
13+
<ErrorSuspense fallback={<Overview loading />}>
14+
<Overview blockPromise={blockPromise} />
15+
</ErrorSuspense>
16+
</div>
17+
);
18+
};
19+
20+
export default BlockPage;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { notFound } from 'next/navigation';
2+
3+
import { getDictionary, hasLocale } from '@/locales/dictionaries';
4+
import { LocaleProvider } from '@/providers/locale';
5+
6+
type Props = LayoutProps<'/[lang]/blocks'>;
7+
8+
const BlocksLayout = async ({ children, params }: Props) => {
9+
const { lang } = await params;
10+
11+
if (!hasLocale(lang)) notFound();
12+
13+
const dictionary = await getDictionary(lang, ['blocks']);
14+
15+
return (
16+
<LocaleProvider dictionary={dictionary} locale={lang}>
17+
<main className="flex flex-1 flex-col pt-6 pb-10">
18+
<div className="container mx-auto px-4">{children}</div>
19+
</main>
20+
</LocaleProvider>
21+
);
22+
};
23+
24+
export default BlocksLayout;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Blocks } from '@/components/blocks';
2+
import { ErrorSuspense } from '@/components/error-suspense';
3+
import { fetchBlockCount, fetchBlocks } from '@/data/blocks';
4+
5+
type Props = PageProps<'/[lang]/blocks'>;
6+
7+
const BlocksPage = async ({ searchParams }: Props) => {
8+
const filters = await searchParams;
9+
const blocksPromise = fetchBlocks(filters);
10+
const blockCountPromise = fetchBlockCount();
11+
12+
return (
13+
<ErrorSuspense fallback={<Blocks loading />}>
14+
<Blocks
15+
blockCountPromise={blockCountPromise}
16+
blocksPromise={blocksPromise}
17+
/>
18+
</ErrorSuspense>
19+
);
20+
};
21+
22+
export default BlocksPage;

apps/frontend/src/app/[lang]/txns/[txn]/layout.tsx

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,43 @@
1-
import { notFound } from 'next/navigation';
2-
31
import { ActiveLink } from '@/components/link';
42
import { TabLink } from '@/components/tab-links';
53
import { TabLinks } from '@/components/tab-links';
6-
import { getDictionary, hasLocale } from '@/locales/dictionaries';
7-
import { LocaleProvider } from '@/providers/locale';
84
import { ScrollArea, ScrollBar } from '@/ui/scroll-area';
95

106
type Props = LayoutProps<'/[lang]/txns/[txn]'>;
117

128
const TxnLayout = async ({ children, params }: Props) => {
13-
const { lang, txn } = await params;
14-
15-
if (!hasLocale(lang)) notFound();
16-
17-
const dictionary = await getDictionary(lang, ['txns']);
9+
const { txn } = await params;
1810

1911
return (
20-
<LocaleProvider dictionary={dictionary} locale={lang}>
21-
<main className="flex flex-1 flex-col pt-6 pb-10">
22-
<div className="container mx-auto px-4">
23-
<ScrollArea className="mb-3 w-full whitespace-nowrap">
24-
<TabLinks>
25-
<TabLink asChild>
26-
<ActiveLink href={`/txns/${txn}`}>Overview</ActiveLink>
27-
</TabLink>
28-
<TabLink asChild>
29-
<ActiveLink href={`/txns/${txn}/execution`}>
30-
Execution Plan
31-
</ActiveLink>
32-
</TabLink>
33-
<TabLink asChild>
34-
<ActiveLink href={`/txns/${txn}/enhanced`}>
35-
Enhanced Plan
36-
</ActiveLink>
37-
</TabLink>
38-
<TabLink asChild>
39-
<ActiveLink href={`/txns/${txn}/tree`}>Tree Plan</ActiveLink>
40-
</TabLink>
41-
<TabLink asChild>
42-
<ActiveLink href={`/txns/${txn}/receipts`}>
43-
Receipts Summary
44-
</ActiveLink>
45-
</TabLink>
46-
</TabLinks>
47-
<ScrollBar orientation="horizontal" />
48-
</ScrollArea>
49-
{children}
50-
</div>
51-
</main>
52-
</LocaleProvider>
12+
<div className="container mx-auto px-4">
13+
<ScrollArea className="mb-3 w-full whitespace-nowrap">
14+
<TabLinks>
15+
<TabLink asChild>
16+
<ActiveLink href={`/txns/${txn}`}>Overview</ActiveLink>
17+
</TabLink>
18+
<TabLink asChild>
19+
<ActiveLink href={`/txns/${txn}/execution`}>
20+
Execution Plan
21+
</ActiveLink>
22+
</TabLink>
23+
{/* <TabLink asChild>
24+
<ActiveLink href={`/txns/${txn}/enhanced`}>
25+
Enhanced Plan
26+
</ActiveLink>
27+
</TabLink>
28+
<TabLink asChild>
29+
<ActiveLink href={`/txns/${txn}/tree`}>Tree Plan</ActiveLink>
30+
</TabLink> */}
31+
<TabLink asChild>
32+
<ActiveLink href={`/txns/${txn}/receipts`}>
33+
Receipts Summary
34+
</ActiveLink>
35+
</TabLink>
36+
</TabLinks>
37+
<ScrollBar orientation="horizontal" />
38+
</ScrollArea>
39+
{children}
40+
</div>
5341
);
5442
};
5543

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { ErrorSuspense } from '@/components/error-suspense';
2+
import { ReceiptsSummary } from '@/components/txns/txn/receipts';
3+
import { fetchTxnReceipts } from '@/data/txns';
4+
5+
type Props = PageProps<'/[lang]/txns/[txn]/receipts'>;
6+
7+
const ReceiptsPage = async ({ params }: Props) => {
8+
const { txn } = await params;
9+
const receiptsPromise = fetchTxnReceipts(txn);
10+
11+
return (
12+
<ErrorSuspense fallback={<ReceiptsSummary loading />}>
13+
<ReceiptsSummary receiptsPromise={receiptsPromise} />
14+
</ErrorSuspense>
15+
);
16+
};
17+
18+
export default ReceiptsPage;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { notFound } from 'next/navigation';
2+
3+
import { getDictionary, hasLocale } from '@/locales/dictionaries';
4+
import { LocaleProvider } from '@/providers/locale';
5+
6+
type Props = LayoutProps<'/[lang]/txns'>;
7+
8+
const TxnsLayout = async ({ children, params }: Props) => {
9+
const { lang } = await params;
10+
11+
if (!hasLocale(lang)) notFound();
12+
13+
const dictionary = await getDictionary(lang, ['txns']);
14+
15+
return (
16+
<LocaleProvider dictionary={dictionary} locale={lang}>
17+
<main className="flex flex-1 flex-col pt-6 pb-10">
18+
<div className="container mx-auto px-4">{children}</div>
19+
</main>
20+
</LocaleProvider>
21+
);
22+
};
23+
24+
export default TxnsLayout;

0 commit comments

Comments
 (0)