diff --git a/packages/veraswap-app/src/routeTree.gen.ts b/packages/veraswap-app/src/routeTree.gen.ts index 5e682936..16651eb6 100644 --- a/packages/veraswap-app/src/routeTree.gen.ts +++ b/packages/veraswap-app/src/routeTree.gen.ts @@ -11,10 +11,17 @@ // Import Routes import { Route as rootRoute } from './routes/__root' +import { Route as SmartaccountImport } from './routes/smartaccount' import { Route as IndexImport } from './routes/index' // Create/Update Routes +const SmartaccountRoute = SmartaccountImport.update({ + id: '/smartaccount', + path: '/smartaccount', + getParentRoute: () => rootRoute, +} as any) + const IndexRoute = IndexImport.update({ id: '/', path: '/', @@ -32,6 +39,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof IndexImport parentRoute: typeof rootRoute } + '/smartaccount': { + id: '/smartaccount' + path: '/smartaccount' + fullPath: '/smartaccount' + preLoaderRoute: typeof SmartaccountImport + parentRoute: typeof rootRoute + } } } @@ -39,32 +53,37 @@ declare module '@tanstack/react-router' { export interface FileRoutesByFullPath { '/': typeof IndexRoute + '/smartaccount': typeof SmartaccountRoute } export interface FileRoutesByTo { '/': typeof IndexRoute + '/smartaccount': typeof SmartaccountRoute } export interface FileRoutesById { __root__: typeof rootRoute '/': typeof IndexRoute + '/smartaccount': typeof SmartaccountRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' + fullPaths: '/' | '/smartaccount' fileRoutesByTo: FileRoutesByTo - to: '/' - id: '__root__' | '/' + to: '/' | '/smartaccount' + id: '__root__' | '/' | '/smartaccount' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute + SmartaccountRoute: typeof SmartaccountRoute } const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, + SmartaccountRoute: SmartaccountRoute, } export const routeTree = rootRoute @@ -77,11 +96,15 @@ export const routeTree = rootRoute "__root__": { "filePath": "__root.tsx", "children": [ - "/" + "/", + "/smartaccount" ] }, "/": { "filePath": "index.tsx" + }, + "/smartaccount": { + "filePath": "smartaccount.tsx" } } } diff --git a/packages/veraswap-app/src/routes/smartaccount.tsx b/packages/veraswap-app/src/routes/smartaccount.tsx new file mode 100644 index 00000000..47d9ed43 --- /dev/null +++ b/packages/veraswap-app/src/routes/smartaccount.tsx @@ -0,0 +1,47 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { useAccount } from "wagmi"; +import { useCallback } from "react"; +import { Button } from "@/components/ui/button.js"; + +export const Route = createFileRoute("/smartaccount")({ + component: Component, +}); + +// const relay = privateKeyToAccount("0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"); //anvil 4 + +function Component() { + const account = useAccount(); + // const [authorization, setAuthorization] = useState(null); + + const onEIP7702Click = useCallback(async () => { + console.debug("Viem EIP7702 only works with local accounts for now"); + /* + const walletClient = createWalletClient({ + account: relay, + chain: account.chain, + transport: http(), + }); + + const authorization = await walletClient.signAuthorization({ + account: account as any, + contractAddress: "0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2", + }); + setAuthorization(authorization); + */ + }, []); + + return ( +
+ EOA +
+ {account.address} +
+
+ Kernel Account +
+ {account.address} +
+ +
+ ); +}