Skip to content

Commit 8ea8f66

Browse files
addressed feedback
1 parent b20e941 commit 8ea8f66

File tree

6 files changed

+133
-119
lines changed

6 files changed

+133
-119
lines changed
Lines changed: 23 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"use client";
22
import type { Project } from "@/api/projects";
3-
import { CopyTextButton } from "@/components/ui/CopyTextButton";
43
import { type Step, StepsCard } from "components/dashboard/StepsCard";
54
import Link from "next/link";
65
import { useMemo, useState } from "react";
76
import { Button } from "../../../../../../../@/components/ui/button";
8-
import { maskSecret } from "../lib/vault.client";
97
import CreateServerWallet from "../server-wallets/components/create-server-wallet.client";
108
import type { Wallet } from "../server-wallets/wallet-table/types";
119
import CreateVaultAccountButton from "../vault/components/create-vault-account.client";
@@ -26,7 +24,7 @@ export const EngineChecklist: React.FC<Props> = (props) => {
2624
steps.push({
2725
title: "Create a Vault Admin Account",
2826
description:
29-
"Your Vault admin account will be used to create server wallets and manage access tokens.",
27+
"Vault is thirdweb's key management system. It allows you to create secure server wallets and manage access tokens.",
3028
children: (
3129
<CreateVaultAccountStep
3230
project={props.project}
@@ -39,7 +37,7 @@ export const EngineChecklist: React.FC<Props> = (props) => {
3937
steps.push({
4038
title: "Create a Server Wallet",
4139
description:
42-
"Your server wallet will be used to send transactions to Engine.",
40+
"Server wallets are smart wallets, they don't require any gas funds to send transactions.",
4341
children: (
4442
<CreateServerWalletStep
4543
project={props.project}
@@ -52,37 +50,17 @@ export const EngineChecklist: React.FC<Props> = (props) => {
5250
});
5351
steps.push({
5452
title: "Send a Test Transaction",
55-
description: "Send a test transaction to see Engine in action.",
53+
description:
54+
"Engine handles gas fees, and is designed for scale, speed and security. Send a test transaction to see it in action",
5655
children: (
57-
<>
58-
<div className="w-full py-4">
59-
{userAccessToken && (
60-
<div className="flex flex-col gap-2 ">
61-
<CopyTextButton
62-
textToCopy={userAccessToken}
63-
className="!h-auto w-full justify-between bg-background px-3 py-3 font-mono text-xs"
64-
textToShow={maskSecret(userAccessToken)}
65-
copyIconPosition="right"
66-
tooltip="Copy Vault Access Token"
67-
/>
68-
<p className="text-muted-foreground text-xs">
69-
This is the access token you just created. You need it to
70-
authorize every wallet action. You can create more access
71-
tokens with your admin key. Each access token can be scoped
72-
and permissioned with flexible policies. You can copy this one
73-
now to send a test transaction.
74-
</p>
75-
</div>
76-
)}
77-
</div>
78-
<SendTestTransaction
79-
wallets={props.wallets}
80-
project={props.project}
81-
/>
82-
</>
56+
<SendTestTransaction
57+
wallets={props.wallets}
58+
project={props.project}
59+
userAccessToken={userAccessToken}
60+
/>
8361
),
8462
completed: props.hasTransactions,
85-
showIncompleteChildren: true,
63+
showIncompleteChildren: false,
8664
showCompletedChildren: false,
8765
});
8866
return steps;
@@ -108,26 +86,14 @@ function CreateVaultAccountStep(props: {
10886
onUserAccessTokenCreated: (userAccessToken: string) => void;
10987
}) {
11088
return (
111-
<div className="mt-4 flex flex-col rounded-md border bg-background p-4">
112-
<p className="font-medium text-primary-foreground text-sm">
113-
Let's get you set up with Vault.
114-
</p>
115-
<div className="h-2" />
116-
<p className="text-muted-foreground text-sm">
117-
To use Engine, you will need to manage one or more server wallets.
118-
Server wallets are secured and accessed through Vault, thirdweb's key
119-
management system.
120-
</p>
121-
<div className="h-6" />
122-
<div className="flex flex-row justify-end gap-4">
123-
<Link href="https://portal.thirdweb.com/engine/vault" target="_blank">
124-
<Button variant="outline">Learn more about Vault</Button>
125-
</Link>
126-
<CreateVaultAccountButton
127-
project={props.project}
128-
onUserAccessTokenCreated={props.onUserAccessTokenCreated}
129-
/>
130-
</div>
89+
<div className="mt-4 flex flex-row gap-4">
90+
<CreateVaultAccountButton
91+
project={props.project}
92+
onUserAccessTokenCreated={props.onUserAccessTokenCreated}
93+
/>
94+
<Link href="https://portal.thirdweb.com/engine/vault" target="_blank">
95+
<Button variant="outline">Learn more about Vault</Button>
96+
</Link>
13197
</div>
13298
);
13399
}
@@ -137,22 +103,11 @@ function CreateServerWalletStep(props: {
137103
managementAccessToken: string | undefined;
138104
}) {
139105
return (
140-
<div className="mt-4 flex flex-col rounded-md border bg-background p-4">
141-
<p className="font-medium text-primary-foreground text-sm">
142-
Now, let's create a server wallet.
143-
</p>
144-
<div className="h-2" />
145-
<p className="text-muted-foreground text-sm">
146-
Server wallets are smart wallets, they don't require any gas funds to
147-
send transactions.
148-
</p>
149-
<div className="h-6" />
150-
<div className="flex flex-row justify-end gap-4">
151-
<CreateServerWallet
152-
project={props.project}
153-
managementAccessToken={props.managementAccessToken}
154-
/>
155-
</div>
106+
<div className="mt-4 flex flex-row gap-4">
107+
<CreateServerWallet
108+
project={props.project}
109+
managementAccessToken={props.managementAccessToken}
110+
/>
156111
</div>
157112
);
158113
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/analytics/send-test-tx.client.tsx

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import { Loader2, LockIcon } from "lucide-react";
2020
import { useState } from "react";
2121
import { useForm } from "react-hook-form";
2222
import { toast } from "sonner";
23+
import {
24+
arbitrumSepolia,
25+
baseSepolia,
26+
optimismSepolia,
27+
sepolia,
28+
} from "thirdweb/chains";
2329
import { shortenAddress } from "thirdweb/utils";
2430
import * as z from "zod";
2531
import type { Wallet } from "../server-wallets/wallet-table/types";
@@ -35,6 +41,7 @@ type FormValues = z.infer<typeof formSchema>;
3541
export function SendTestTransaction(props: {
3642
wallets?: Wallet[];
3743
project: Project;
44+
userAccessToken?: string;
3845
expanded?: boolean;
3946
}) {
4047
const thirdwebClient = useThirdwebClient();
@@ -45,7 +52,7 @@ export function SendTestTransaction(props: {
4552
const form = useForm<FormValues>({
4653
resolver: zodResolver(formSchema),
4754
defaultValues: {
48-
accessToken: "",
55+
accessToken: props.userAccessToken ?? "",
4956
walletIndex: "0",
5057
chainId: 84532,
5158
},
@@ -120,19 +127,10 @@ export function SendTestTransaction(props: {
120127

121128
return (
122129
<div className="mt-3 w-full rounded-md border bg-background p-6">
123-
<p className="font-medium text-foreground text-sm">
124-
Engine is designed to scale, gas-free, fast, and secure. <br />
125-
</p>
126-
<div className="h-2" />
127-
<p className="text-muted-foreground text-sm">
128-
Fire up many test transactions and watch the table below to see how it
129-
performs!
130-
</p>
131-
<div className="h-4" />
132130
<form onSubmit={form.handleSubmit(onSubmit)}>
133131
<p className="flex items-center gap-2 text-sm text-warning-text">
134-
<LockIcon className="h-4 w-4" /> This action requires your vault
135-
access token.
132+
<LockIcon className="h-4 w-4" />
133+
Every wallet action requires your Vault access token.
136134
</p>
137135
<div className="h-4" />
138136
{/* Responsive container */}
@@ -142,12 +140,21 @@ export function SendTestTransaction(props: {
142140
<p className="text-sm">Vault Access Token</p>
143141
<Input
144142
id="access-token"
145-
type="password"
143+
type={props.userAccessToken ? "text" : "password"}
146144
placeholder="vt_act_1234....ABCD"
147145
{...form.register("accessToken")}
148146
disabled={isLoading}
149147
className="text-xs"
150148
/>
149+
{props.userAccessToken && (
150+
<div className="flex flex-col gap-2 ">
151+
<p className="text-muted-foreground text-xs">
152+
This is the project-wide access token you just created. You
153+
can create more access tokens using your admin key, with
154+
granular scopes and permissions.
155+
</p>
156+
</div>
157+
)}
151158
</div>
152159
</div>
153160
</div>
@@ -205,6 +212,32 @@ export function SendTestTransaction(props: {
205212
<p className="text-sm">Network</p>
206213
<SingleNetworkSelector
207214
className="bg-background"
215+
chainIds={[
216+
baseSepolia.id,
217+
optimismSepolia.id,
218+
arbitrumSepolia.id,
219+
sepolia.id,
220+
1301,
221+
1946,
222+
1993,
223+
919,
224+
6342,
225+
10143,
226+
44787,
227+
80002,
228+
80069,
229+
98985,
230+
128123,
231+
167009,
232+
168587773,
233+
37714555429,
234+
1952959480,
235+
97,
236+
296,
237+
1740,
238+
4202,
239+
10200,
240+
]}
208241
client={thirdwebClient}
209242
chainId={form.watch("chainId")}
210243
onChange={(chainId) => {
@@ -216,20 +249,9 @@ export function SendTestTransaction(props: {
216249
</div>
217250
<div className="h-6" />
218251
<div className="flex flex-col gap-2 md:flex-row md:justify-end md:gap-2">
219-
{hasSentTx && (
220-
<Button
221-
variant="outline"
222-
className="w-full md:w-auto"
223-
onClick={() => {
224-
router.refresh();
225-
}}
226-
>
227-
Complete Setup
228-
</Button>
229-
)}
230252
<Button
231253
type="submit"
232-
variant="primary"
254+
variant={hasSentTx ? "secondary" : "primary"}
233255
disabled={isLoading || !form.formState.isValid}
234256
className="w-full min-w-[200px] md:w-auto"
235257
>
@@ -242,6 +264,17 @@ export function SendTestTransaction(props: {
242264
<>{hasSentTx ? "Send More Transactions" : "Send Transaction"}</>
243265
)}
244266
</Button>
267+
{hasSentTx && (
268+
<Button
269+
variant="primary"
270+
className="w-full md:w-auto"
271+
onClick={() => {
272+
router.refresh();
273+
}}
274+
>
275+
Complete Setup
276+
</Button>
277+
)}
245278
</div>
246279
</form>
247280
</div>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/explorer/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default function TransactionsExplorerPage() {
99
<ApiReferenceReact
1010
configuration={{
1111
url: `${THIRDWEB_ENGINE_CLOUD_URL}/openapi`,
12+
hideModels: true,
1213
servers: [
1314
{
1415
url: THIRDWEB_ENGINE_CLOUD_URL,

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/server-wallets/components/create-server-wallet.client.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input";
1212
import { useDashboardRouter } from "@/lib/DashboardRouter";
1313
import { useMutation } from "@tanstack/react-query";
1414
import { createEoa } from "@thirdweb-dev/vault-sdk";
15-
import { Loader2 } from "lucide-react";
15+
import { Loader2, WalletIcon } from "lucide-react";
1616
import { useState } from "react";
1717
import { toast } from "sonner";
1818
import { initVaultClient } from "../../lib/vault.client";
@@ -90,7 +90,16 @@ export default function CreateServerWallet(props: {
9090
}
9191
className="flex flex-row items-center gap-2"
9292
>
93-
{props.managementAccessToken ? "Create Server Wallet" : "Get Started"}
93+
{isLoading ? (
94+
<Loader2 className="animate-spin" />
95+
) : (
96+
<WalletIcon className="size-4" />
97+
)}
98+
{props.managementAccessToken
99+
? isLoading
100+
? "Creating..."
101+
: "Create Server Wallet"
102+
: "Get Started"}
94103
</Button>
95104

96105
<Dialog open={modalOpen} onOpenChange={setModalOpen}>

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/vault/components/create-vault-account.client.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useDashboardRouter } from "@/lib/DashboardRouter";
1515
import { cn } from "@/lib/utils";
1616
import { useMutation } from "@tanstack/react-query";
1717
import { createServiceAccount } from "@thirdweb-dev/vault-sdk";
18-
import { Loader2, LockIcon } from "lucide-react";
18+
import { CheckIcon, DownloadIcon, Loader2, LockIcon } from "lucide-react";
1919
import { useState } from "react";
2020
import { toast } from "sonner";
2121
import {
@@ -132,14 +132,6 @@ export default function CreateVaultAccountButton(props: {
132132
router.refresh();
133133
};
134134

135-
const handlePrimaryButton = () => {
136-
if (!keysDownloaded) {
137-
handleDownloadKeys();
138-
return;
139-
}
140-
handleCloseModal();
141-
};
142-
143135
const isLoading = initialiseProjectWithVaultMutation.isPending;
144136

145137
return (
@@ -244,6 +236,22 @@ export default function CreateVaultAccountButton(props: {
244236
as they provide access to your server wallets.
245237
</AlertDescription>
246238
<div className="h-4" />
239+
<div className="flex items-center gap-2">
240+
<Button
241+
variant="link"
242+
onClick={handleDownloadKeys}
243+
className="flex h-auto items-center gap-2 p-0 text-sm text-success-text"
244+
>
245+
<DownloadIcon className="size-4" />
246+
{keysDownloaded ? "Keys Downloaded" : "Download Keys"}
247+
</Button>
248+
{keysDownloaded && (
249+
<span className="text-success-text text-xs">
250+
<CheckIcon className="size-4" />
251+
</span>
252+
)}
253+
</div>
254+
<div className="h-4" />
247255
<CheckboxWithLabel className="text-foreground">
248256
<Checkbox
249257
checked={keysConfirmed}
@@ -256,11 +264,11 @@ export default function CreateVaultAccountButton(props: {
256264

257265
<div className="flex justify-end gap-3 border-t bg-card px-6 py-4">
258266
<Button
259-
onClick={handlePrimaryButton}
260-
disabled={keysDownloaded && !keysConfirmed}
267+
onClick={handleCloseModal}
268+
disabled={!keysConfirmed}
261269
variant={"primary"}
262270
>
263-
{keysDownloaded ? "Close" : "Download Keys"}
271+
Close
264272
</Button>
265273
</div>
266274
</div>

0 commit comments

Comments
 (0)