Skip to content

Commit 8604340

Browse files
committed
Add Solana transactions and wallets tables
1 parent e830109 commit 8604340

File tree

28 files changed

+3752
-1158
lines changed

28 files changed

+3752
-1158
lines changed

.changeset/eleven-mangos-travel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/vault-sdk": patch
3+
---
4+
5+
Fixed bug with listing solana accounts response type
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
"use client";
2+
import { CheckIcon, CopyIcon } from "lucide-react";
3+
import { useMemo } from "react";
4+
import { Button } from "@/components/ui/button";
5+
import {
6+
HoverCard,
7+
HoverCardContent,
8+
HoverCardTrigger,
9+
} from "@/components/ui/hover-card";
10+
import { useClipboard } from "@/hooks/useClipboard";
11+
import { cn } from "@/lib/utils";
12+
13+
export function SolanaAddress(props: {
14+
address: string;
15+
shortenAddress?: boolean;
16+
className?: string;
17+
}) {
18+
const shortenedAddress = useMemo(() => {
19+
return props.shortenAddress !== false
20+
? `${props.address.slice(0, 4)}...${props.address.slice(-4)}`
21+
: props.address;
22+
}, [props.address, props.shortenAddress]);
23+
24+
const lessShortenedAddress = useMemo(() => {
25+
return `${props.address.slice(0, 8)}...${props.address.slice(-8)}`;
26+
}, [props.address]);
27+
28+
const { onCopy, hasCopied } = useClipboard(props.address, 2000);
29+
30+
return (
31+
<HoverCard>
32+
<HoverCardTrigger asChild tabIndex={-1}>
33+
<Button
34+
className={cn(
35+
"flex flex-row items-center gap-2 px-0",
36+
props.className,
37+
)}
38+
onClick={(e) => e.stopPropagation()}
39+
variant="link"
40+
>
41+
<div className="flex size-5 items-center justify-center rounded-full bg-gradient-to-br from-purple-500 to-blue-500" />
42+
<span className="cursor-pointer font-mono text-sm">
43+
{shortenedAddress}
44+
</span>
45+
</Button>
46+
</HoverCardTrigger>
47+
<HoverCardContent
48+
className="w-80 border-border"
49+
onClick={(e) => {
50+
// do not close the hover card when clicking anywhere in the content
51+
e.stopPropagation();
52+
}}
53+
>
54+
<div className="space-y-4">
55+
<div className="flex items-center justify-between">
56+
<h3 className="font-semibold text-lg">Solana Public Key</h3>
57+
<Button
58+
className="flex items-center gap-2"
59+
onClick={onCopy}
60+
size="sm"
61+
variant="outline"
62+
>
63+
{hasCopied ? (
64+
<CheckIcon className="h-4 w-4" />
65+
) : (
66+
<CopyIcon className="h-4 w-4" />
67+
)}
68+
{hasCopied ? "Copied!" : "Copy"}
69+
</Button>
70+
</div>
71+
<p className="break-all rounded bg-muted p-3 text-center font-mono text-xs leading-relaxed">
72+
{lessShortenedAddress}
73+
</p>
74+
<div className="rounded-lg bg-muted/50 p-3">
75+
<p className="text-muted-foreground text-xs leading-relaxed">
76+
Solana public key for blockchain transactions.
77+
</p>
78+
</div>
79+
</div>
80+
</HoverCardContent>
81+
</HoverCard>
82+
);
83+
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/ProjectSidebarLayout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ export function ProjectSidebarLayout(props: {
4848
{
4949
href: `${props.layoutPath}/transactions`,
5050
icon: ArrowLeftRightIcon,
51-
label: "Transactions",
51+
label: (
52+
<span className="flex items-center gap-2">
53+
Transactions <Badge>New</Badge>
54+
</span>
55+
),
5256
},
5357
{
5458
href: `${props.layoutPath}/contracts`,
@@ -81,11 +85,7 @@ export function ProjectSidebarLayout(props: {
8185
{
8286
href: `${props.layoutPath}/tokens`,
8387
icon: TokenIcon,
84-
label: (
85-
<span className="flex items-center gap-2">
86-
Tokens <Badge>New</Badge>
87-
</span>
88-
),
88+
label: "Tokens",
8989
},
9090
],
9191
},

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/analytics-page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ResponsiveSearchParamsProvider } from "responsive-rsc";
22
import type { ThirdwebClient } from "thirdweb";
33
import type { Project } from "@/api/project/projects";
4+
import { UnifiedTransactionsTable } from "../components/transactions-table.client";
45
import type { Wallet } from "../server-wallets/wallet-table/types";
56
import { TransactionAnalyticsFilter } from "./filter";
67
import { TransactionsChartCard } from "./tx-chart/tx-chart";
7-
import { TransactionsTable } from "./tx-table/tx-table";
88

99
export function TransactionsAnalyticsPageContent(props: {
1010
searchParams: {
@@ -34,11 +34,10 @@ export function TransactionsAnalyticsPageContent(props: {
3434
/>
3535
</>
3636
)}
37-
<TransactionsTable
37+
<UnifiedTransactionsTable
3838
client={props.client}
3939
project={props.project}
4040
teamSlug={props.teamSlug}
41-
wallets={props.wallets}
4241
/>
4342
</div>
4443
</ResponsiveSearchParamsProvider>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/analytics/ftux.client.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ import type { Project } from "@/api/project/projects";
55
import { type Step, StepsCard } from "@/components/blocks/StepsCard";
66
import CreateServerWallet from "../server-wallets/components/create-server-wallet.client";
77
import type { Wallet } from "../server-wallets/wallet-table/types";
8+
import type { SolanaWallet } from "../solana-wallets/wallet-table/types";
9+
import { SendTestSolanaTransaction } from "./send-test-solana-tx.client";
810
import { SendTestTransaction } from "./send-test-tx.client";
911

1012
interface Props {
1113
managementAccessToken: string | undefined;
1214
project: Project;
1315
wallets: Wallet[];
16+
solanaWallets: SolanaWallet[];
1417
hasTransactions: boolean;
1518
teamSlug: string;
1619
testTxWithWallet?: string | undefined;
20+
testSolanaTxWithWallet?: string | undefined;
1721
client: ThirdwebClient;
1822
isManagedVault: boolean;
1923
}
@@ -85,6 +89,19 @@ export const EngineChecklist: React.FC<Props> = (props) => {
8589
);
8690
}
8791

92+
if (props.testSolanaTxWithWallet) {
93+
return (
94+
<SendTestSolanaTransaction
95+
isManagedVault={props.isManagedVault}
96+
client={props.client}
97+
project={props.project}
98+
teamSlug={props.teamSlug}
99+
walletId={props.testSolanaTxWithWallet}
100+
wallets={props.solanaWallets}
101+
/>
102+
);
103+
}
104+
88105
if (finalSteps.length === 0 || isComplete) {
89106
return null;
90107
}

0 commit comments

Comments
 (0)