Skip to content

Commit 93f0132

Browse files
feat(dashboard): add default account factories table
1 parent 6b04d75 commit 93f0132

File tree

1 file changed

+92
-4
lines changed
  • apps/dashboard/src/components/smart-wallets/AccountFactories

1 file changed

+92
-4
lines changed

apps/dashboard/src/components/smart-wallets/AccountFactories/index.tsx

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
"use client";
22

3+
import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
34
import { Button } from "@/components/ui/button";
45
import { TrackedLinkTW } from "@/components/ui/tracked-link";
56
import { useThirdwebClient } from "@/constants/thirdweb.client";
67
import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser";
78
import { useMultiChainRegContractList } from "@3rdweb-sdk/react/hooks/useRegistry";
89
import { useQuery } from "@tanstack/react-query";
10+
import { createColumnHelper } from "@tanstack/react-table";
911
import { PlusIcon } from "lucide-react";
1012
import { defineChain, getContract } from "thirdweb";
1113
import { getCompilerMetadata } from "thirdweb/contract";
14+
import {
15+
DEFAULT_ACCOUNT_FACTORY_V0_6,
16+
DEFAULT_ACCOUNT_FACTORY_V0_7,
17+
} from "thirdweb/wallets/smart";
18+
import { TWTable } from "../../shared/TWTable";
1219
import { FactoryContracts } from "./factory-contracts";
1320

1421
function useFactories() {
@@ -54,13 +61,58 @@ export const AccountFactories: React.FC<AccountFactoriesProps> = ({
5461
const factories = useFactories();
5562
return (
5663
<div className="flex flex-col gap-4">
57-
<div className="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-8">
64+
{/* Default factories */}
65+
<div className="flex flex-col gap-2">
66+
<h3 className="font-semibold text-lg">Default Account Factories</h3>
5867
<p className="text-muted-foreground text-sm">
59-
Click an account factory contract to view analytics and accounts
60-
created.
68+
Ready to use account factories that are pre-deployed on each chain.{" "}
69+
<a
70+
href="https://playground.thirdweb.com/connect/account-abstraction/connect"
71+
className="text-link-foreground"
72+
target="_blank"
73+
rel="noreferrer"
74+
>
75+
Learn how to use these in your apps.
76+
</a>
6177
</p>
78+
</div>
79+
<TWTable
80+
title="default account factories"
81+
data={[
82+
{
83+
name: "AccountFactory (v0.6)",
84+
address: DEFAULT_ACCOUNT_FACTORY_V0_6,
85+
entrypointVersion: "0.6",
86+
},
87+
{
88+
name: "AccountFactory (v0.7)",
89+
address: DEFAULT_ACCOUNT_FACTORY_V0_7,
90+
entrypointVersion: "0.7",
91+
},
92+
]}
93+
columns={columns}
94+
isPending={false}
95+
isFetched={true}
96+
/>
6297

63-
<Button variant="outline" asChild size="sm">
98+
{/* Your factories */}
99+
<div className="mt-8 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-8">
100+
<div className="flex flex-col gap-2">
101+
<h3 className="font-semibold text-lg">Your Account Factories</h3>
102+
<p className="text-muted-foreground text-sm">
103+
Deploy your own account factories to create smart wallets.{" "}
104+
<a
105+
href="https://portal.thirdweb.com/connect/account-abstraction/factories"
106+
className="text-link-foreground"
107+
target="_blank"
108+
rel="noreferrer"
109+
>
110+
Learn more.
111+
</a>
112+
</p>
113+
</div>
114+
115+
<Button variant="default" asChild size="sm">
64116
<TrackedLinkTW
65117
category={trackingCategory}
66118
label="create-factory"
@@ -81,3 +133,39 @@ export const AccountFactories: React.FC<AccountFactoriesProps> = ({
81133
</div>
82134
);
83135
};
136+
137+
type DefaultFactory = {
138+
name: string;
139+
address: string;
140+
entrypointVersion: string;
141+
};
142+
143+
const columnHelper = createColumnHelper<DefaultFactory>();
144+
145+
const columns = [
146+
columnHelper.accessor((row) => row.name, {
147+
header: "Name",
148+
cell: (cell) => cell.row.original.name,
149+
}),
150+
columnHelper.accessor((row) => row.name, {
151+
header: "Network",
152+
cell: () => "All networks",
153+
}),
154+
columnHelper.accessor("address", {
155+
header: "Contract address",
156+
cell: (cell) => (
157+
<CopyAddressButton
158+
address={cell.getValue()}
159+
copyIconPosition="left"
160+
variant="ghost"
161+
className="-translate-x-2"
162+
/>
163+
),
164+
}),
165+
columnHelper.accessor((row) => row, {
166+
header: "Entrypoint Version",
167+
cell: (cell) => {
168+
return cell.row.original.entrypointVersion;
169+
},
170+
}),
171+
];

0 commit comments

Comments
 (0)