Skip to content

Commit 03ce881

Browse files
committed
fix: Engine wallet selector dropdown (#5347)
https://linear.app/thirdweb/issue/INFRA-409/fix-engine-wallet-dropdown-bug-in-dashboard <!-- start pr-codex --> ## PR-Codex overview This PR focuses on enhancing the backend wallet management by refining wallet type options and improving the user interface for wallet actions. It introduces restrictions on importing smart backend wallets and updates the icons in the wallet management table. ### Detailed summary - Added a comment to disallow importing smart backend wallets. - Filtered `EngineBackendWalletOptions` to exclude keys starting with "smart:". - Replaced `Trash2Icon` with `PencilIcon` for the edit action in the `BackendWalletsTable`. - Updated logic for checking wallet configuration to simplify conditions. - Improved `onValueChange` handler in `CreateBackendWalletButton`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 2d99708 commit 03ce881

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/overview/components/backend-wallets-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { TWTable } from "components/shared/TWTable";
3131
import { useTrack } from "hooks/analytics/useTrack";
3232
import { useTxNotifications } from "hooks/useTxNotifications";
3333
import { useActiveChainAsDashboardChain } from "lib/v5-adapter";
34-
import { DownloadIcon, Trash2Icon, UploadIcon } from "lucide-react";
34+
import { DownloadIcon, PencilIcon, UploadIcon } from "lucide-react";
3535
import QRCode from "qrcode";
3636
import { useState } from "react";
3737
import { useForm } from "react-hook-form";
@@ -164,7 +164,7 @@ export const BackendWalletsTable: React.FC<BackendWalletsTableProps> = ({
164164
isFetched={isFetched}
165165
onMenuClick={[
166166
{
167-
icon: <Trash2Icon className="size-4" />,
167+
icon: <PencilIcon className="size-4" />,
168168
text: "Edit",
169169
onClick: (wallet) => {
170170
setSelectedBackendWallet(wallet);

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/overview/components/create-backend-wallet-button.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ export const CreateBackendWalletButton: React.FC<
108108
);
109109
}
110110

111-
const isAwsKmsConfigured = !!walletConfig.awsAccessKeyId;
112-
const isGcpKmsConfigured = !!walletConfig.gcpKmsKeyRingId;
113-
114111
const isNotConfigured =
115112
(["aws-kms", "smart:aws-kms"].includes(walletType) &&
116-
!isAwsKmsConfigured) ||
117-
(["gcp-kms", "smart:gcp-kms"].includes(walletType) && !isGcpKmsConfigured);
113+
!walletConfig.awsAccessKeyId) ||
114+
(["gcp-kms", "smart:gcp-kms"].includes(walletType) &&
115+
!walletConfig.gcpKmsKeyRingId);
118116

119117
return (
120118
<>
@@ -145,10 +143,9 @@ export const CreateBackendWalletButton: React.FC<
145143
tooltip={null}
146144
>
147145
<Select
148-
onValueChange={(value) => {
149-
form.reset();
150-
form.setValue("type", value as EngineBackendWalletType);
151-
}}
146+
onValueChange={(value) =>
147+
form.setValue("type", value as EngineBackendWalletType)
148+
}
152149
value={form.watch("type")}
153150
>
154151
<SelectTrigger>
@@ -177,8 +174,7 @@ export const CreateBackendWalletButton: React.FC<
177174
</FormDescription>
178175
</FormFieldSetup>
179176

180-
{(walletType === "aws-kms" && !isAwsKmsConfigured) ||
181-
(walletType === "gcp-kms" && !isGcpKmsConfigured) ? (
177+
{isNotConfigured ? (
182178
// Warning if not configured
183179
<Alert variant="warning">
184180
<CircleAlertIcon className="size-5" />

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(instance)/[engineId]/overview/components/import-backend-wallet-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ export const ImportBackendWalletButton: React.FC<
112112
invariant(selectedOption, "Selected a valid backend wallet type.");
113113

114114
// List all wallet types only if Engine is updated to support it.
115+
// Disallow importing smart backend wallets.
115116
const walletTypeOptions = supportsMultipleWalletTypes
116-
? EngineBackendWalletOptions
117+
? EngineBackendWalletOptions.filter(({ key }) => !key.startsWith("smart:"))
117118
: [selectedOption];
118119

119120
const isAwsKmsConfigured = !!walletConfig.awsAccessKeyId;

0 commit comments

Comments
 (0)