11"use client" ;
22
3+ import { CopyAddressButton } from "@/components/ui/CopyAddressButton" ;
34import { Button } from "@/components/ui/button" ;
45import { TrackedLinkTW } from "@/components/ui/tracked-link" ;
56import { useThirdwebClient } from "@/constants/thirdweb.client" ;
67import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser" ;
78import { useMultiChainRegContractList } from "@3rdweb-sdk/react/hooks/useRegistry" ;
89import { useQuery } from "@tanstack/react-query" ;
10+ import { createColumnHelper } from "@tanstack/react-table" ;
911import { PlusIcon } from "lucide-react" ;
1012import { defineChain , getContract } from "thirdweb" ;
1113import { 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" ;
1219import { FactoryContracts } from "./factory-contracts" ;
1320
1421function 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