From 3377f1a48f24d6d9899ddcfb21bb34a5cf1e082f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 5 Mar 2026 08:16:57 +0000 Subject: [PATCH 1/2] [SDK] Add screen prop to useWalletDetailsModal for direct navigation to export screen Co-authored-by: Yash --- .changeset/wallet-details-export-screen.md | 5 +++ .../react/web/ui/ConnectWallet/Details.tsx | 32 +++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .changeset/wallet-details-export-screen.md diff --git a/.changeset/wallet-details-export-screen.md b/.changeset/wallet-details-export-screen.md new file mode 100644 index 00000000000..23f1aedda43 --- /dev/null +++ b/.changeset/wallet-details-export-screen.md @@ -0,0 +1,5 @@ +--- +"thirdweb": minor +--- + +Add `screen` prop to `useWalletDetailsModal` to allow opening the modal directly at a specific screen. Use `screen: "export"` to open directly at the Export Private Key screen. diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx index aa2f2121292..3e4b3916b6c 100644 --- a/packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx +++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx @@ -383,8 +383,11 @@ export function DetailsModal(props: { connectOptions: DetailsModalConnectOptions | undefined; assetTabs?: AssetTabs[]; showBalanceInFiat?: SupportedFiatCurrency; + initialScreen?: WalletDetailsModalScreen; }) { - const [screen, setScreen] = useState("main"); + const [screen, setScreen] = useState( + props.initialScreen || "main", + ); const { disconnect } = useDisconnect(); const [isOpen, setIsOpen] = useState(true); @@ -887,7 +890,7 @@ export function DetailsModal(props: { supportedTokens={props.supportedTokens} /> ); - } else if (screen === "private-key") { + } else if (screen === "private-key" || screen === "export") { content = ( void; + + /** + * The initial screen to show when the modal opens. + * + * @defaultValue "main" + * + * @example + * ```tsx + * // Open directly to the Export Private Key screen + * detailsModal.open({ + * client, + * screen: "export" + * }); + * ``` + */ + screen?: WalletDetailsModalScreen; }; /** @@ -1750,6 +1769,14 @@ export type UseWalletDetailsModalOptions = { * } * ``` * + * ### Open directly to Export Private Key screen + * ```tsx + * detailsModal.open({ + * client, + * screen: "export" + * }); + * ``` + * * ### Callback for when the modal is closed * ```tsx * detailsModal.open({ @@ -1800,6 +1827,7 @@ export function useWalletDetailsModal() { showTestnetFaucet: props.showTestnetFaucet, }} displayBalanceToken={props.displayBalanceToken} + initialScreen={props.screen} locale={locale} onDisconnect={(info) => { props.onDisconnect?.(info); From d31e33c91378d8963809b68a9a0bda67397e835a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 5 Mar 2026 17:32:50 +0000 Subject: [PATCH 2/2] [SDK] Update changeset to patch version Co-authored-by: Yash --- .changeset/wallet-details-export-screen.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wallet-details-export-screen.md b/.changeset/wallet-details-export-screen.md index 23f1aedda43..df2baaf00a1 100644 --- a/.changeset/wallet-details-export-screen.md +++ b/.changeset/wallet-details-export-screen.md @@ -1,5 +1,5 @@ --- -"thirdweb": minor +"thirdweb": patch --- Add `screen` prop to `useWalletDetailsModal` to allow opening the modal directly at a specific screen. Use `screen: "export"` to open directly at the Export Private Key screen.