Skip to content

Commit 2f22df7

Browse files
handle access keys
1 parent e2b0933 commit 2f22df7

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { THIRDWEB_ENGINE_CLOUD_URL } from "@/constants/env";
1212
import { useThirdwebClient } from "@/constants/thirdweb.client";
1313
import { zodResolver } from "@hookform/resolvers/zod";
1414
import { useMutation } from "@tanstack/react-query";
15-
import { ChevronDown, Loader2 } from "lucide-react";
15+
import { ChevronDown, Loader2, LockIcon } from "lucide-react";
1616
import { useState } from "react";
1717
import { useForm } from "react-hook-form";
1818
import { toast } from "sonner";
@@ -138,9 +138,9 @@ export function SendTestTransaction(props: {
138138
onSubmit={form.handleSubmit(onSubmit)}
139139
className="space-y-4 px-3 pb-3"
140140
>
141-
<p className="text-sm text-warning-text">
142-
🔐 This action requires a project secret key and a vault access
143-
token.
141+
<p className="flex items-center gap-2 text-sm text-warning-text">
142+
<LockIcon className="h-4 w-4" /> This action requires a project
143+
secret key and a vault access token.
144144
</p>
145145
{/* Responsive container */}
146146
<div className="flex flex-col gap-2 md:flex-row md:items-end md:gap-2">
@@ -217,6 +217,7 @@ export function SendTestTransaction(props: {
217217
<div className="flex flex-1 flex-col gap-2">
218218
<p className="text-sm">Network</p>
219219
<SingleNetworkSelector
220+
client={thirdwebClient}
220221
chainId={form.watch("chainId")}
221222
onChange={(chainId) => {
222223
form.setValue("chainId", chainId);

apps/dashboard/src/app/team/[team_slug]/[project_slug]/engine/server-wallets/components/list-access-tokens.client.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
revokeAccessToken,
1616
} from "@thirdweb-dev/vault-sdk";
1717
import { createVaultClient } from "@thirdweb-dev/vault-sdk";
18-
import { Loader2, Trash2 } from "lucide-react";
18+
import { Loader2, LockIcon, Trash2 } from "lucide-react";
1919
import { useState } from "react";
2020
import { toast } from "sonner";
2121
import { CopyTextButton } from "../../../../../../../@/components/ui/CopyTextButton";
@@ -30,6 +30,7 @@ import {
3030
CheckboxWithLabel,
3131
} from "../../../../../../../@/components/ui/checkbox";
3232
import { THIRDWEB_VAULT_URL } from "../../../../../../../@/constants/env";
33+
import { toDateTimeLocal } from "../../../../../../../utils/date-utils";
3334
import {
3435
SERVER_WALLET_ACCESS_TOKEN_PURPOSE,
3536
SERVER_WALLET_MANAGEMENT_ACCESS_TOKEN_PURPOSE,
@@ -230,7 +231,7 @@ export default function ListAccessTokensButton(props: {
230231
toast.error(error.message);
231232
},
232233
onSuccess: (data) => {
233-
setNewAccessToken(data.userAccessToken.id);
234+
setNewAccessToken(data.userAccessToken.accessToken);
234235
listAccessTokensQuery.refetch();
235236
},
236237
});
@@ -303,11 +304,7 @@ export default function ListAccessTokensButton(props: {
303304
t.metadata?.purpose?.toString() !==
304305
SERVER_WALLET_MANAGEMENT_ACCESS_TOKEN_PURPOSE,
305306
)
306-
.map((t) => ({
307-
key: t.metadata?.purpose?.toString() ?? t.id,
308-
id: t.id,
309-
policies: t.policies || [],
310-
})),
307+
.filter((t) => !t.revokedAt),
311308
};
312309
// Return stub data for now
313310
},
@@ -379,11 +376,14 @@ export default function ListAccessTokensButton(props: {
379376
</div>
380377
<div className="flex justify-end gap-3 border-t bg-card px-6 py-4">
381378
<Button
382-
onClick={handleCloseModal}
379+
onClick={() => {
380+
setNewAccessToken(null);
381+
setKeysConfirmed(false);
382+
}}
383383
disabled={!keysConfirmed}
384384
variant={"primary"}
385385
>
386-
Close
386+
Go Back
387387
</Button>
388388
</div>
389389
</div>
@@ -400,15 +400,26 @@ export default function ListAccessTokensButton(props: {
400400
<div className="flex flex-col gap-2">
401401
{listAccessTokensQuery.data.accessTokens.map((token) => (
402402
<div key={token.id} className="flex gap-2">
403-
<div className="flex-1 justify-between rounded-lg border border-border bg-background px-3 py-3 font-mono text-xs">
404-
<h4 className="pb-4 font-bold">{token.key}</h4>
403+
<div className="flex flex-1 flex-col justify-between gap-4 rounded-lg border border-border bg-background px-3 py-3 text-xs">
404+
<h4 className="font-bold">
405+
{token.metadata?.purpose ||
406+
"Unnamed Access Token"}
407+
</h4>
405408
<div className="flex flex-row flex-wrap gap-2">
406409
{token.policies.map((policy) => (
407-
<Badge key={policy.type} variant={"outline"}>
410+
<Badge
411+
key={policy.type}
412+
variant={"outline"}
413+
className="font-mono"
414+
>
408415
{policy.type}
409416
</Badge>
410417
))}
411418
</div>
419+
<p className="text-muted-foreground text-xs">
420+
Created on:{" "}
421+
{toDateTimeLocal(new Date(token.createdAt))}
422+
</p>
412423
</div>
413424
<Button
414425
variant="destructive"
@@ -463,8 +474,9 @@ export default function ListAccessTokensButton(props: {
463474
) : (
464475
<div className="px-6 pb-6">
465476
<div className="flex flex-col gap-4">
466-
<p className="text-sm text-warning-text">
467-
🔐 This action requires your Vault admin key.
477+
<p className="flex items-center gap-2 text-sm text-warning-text">
478+
<LockIcon className="h-4 w-4" /> This action requires your
479+
Vault admin key.
468480
</p>
469481
<Input
470482
type="password"

apps/dashboard/src/app/team/[team_slug]/[project_slug]/engine/server-wallets/components/rotate-admin-key.client.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
createVaultClient,
2020
rotateServiceAccount,
2121
} from "@thirdweb-dev/vault-sdk";
22-
import { Loader2, RefreshCcwIcon } from "lucide-react";
22+
import { Loader2, LockIcon, RefreshCcwIcon } from "lucide-react";
2323
import { useState } from "react";
2424
import { toast } from "sonner";
2525
import { THIRDWEB_VAULT_URL } from "../../../../../../../@/constants/env";
@@ -191,8 +191,9 @@ export default function RotateAdminKeyButton() {
191191
</DialogHeader>
192192
<div className="px-6 pb-6">
193193
<div className="flex flex-col gap-4">
194-
<p className="text-sm text-warning-text">
195-
🔐 This action requires your Vault rotation code.
194+
<p className="flex items-center gap-2 text-sm text-warning-text">
195+
<LockIcon className="h-4 w-4" /> This action requires your
196+
Vault rotation code.
196197
</p>
197198
<Input
198199
type="password"

apps/dashboard/src/components/buttons/MismatchButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ const MismatchNotice: React.FC<{
473473
</p>
474474

475475
<p className="text-muted-foreground">
476-
🔐 This action requires you to connect to the{" "}
476+
This action requires you to connect to the{" "}
477477
<span className="font-semibold capitalize">
478478
{txChain?.name || `Chain ID #${txChainId}`}
479479
</span>{" "}

0 commit comments

Comments
 (0)