From 49824ce29e4c6f0a5f2b34a847d6d0fa68ebbd09 Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 22 Oct 2025 22:19:49 +0000 Subject: [PATCH] [MNY-286] SDK: Do not require connecting wallet in BuyWidget if receiverAddress is set (#8296) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on modifying the `BuyWidget` component to allow users to bypass wallet connection if a `receiverAddress` is provided. It updates the logic for displaying connection prompts based on the presence of this address. ### Detailed summary - Updated `BuyWidget` to not require wallet connection if `receiverAddress` is set. - Removed `activeWalletInfo` dependency from the condition for displaying the `FundWallet`. - Introduced `showConnectButton` variable to determine if the connect button should be shown. - Simplified the rendering logic for the connect button in `FundWallet`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/light-signs-send.md | 5 +++ .../src/react/web/ui/Bridge/BuyWidget.tsx | 4 +-- .../src/react/web/ui/Bridge/FundWallet.tsx | 31 ++++++++++--------- 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 .changeset/light-signs-send.md diff --git a/.changeset/light-signs-send.md b/.changeset/light-signs-send.md new file mode 100644 index 00000000000..3636a1f118a --- /dev/null +++ b/.changeset/light-signs-send.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Do not require connecting wallet in `BuyWidget` if `receiverAddress` is set diff --git a/packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx b/packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx index ef1441d65e2..f79eece83cf 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx @@ -39,7 +39,6 @@ import { PaymentSelection } from "./payment-selection/PaymentSelection.js"; import { SuccessScreen } from "./payment-success/SuccessScreen.js"; import { QuoteLoader } from "./QuoteLoader.js"; import { StepRunner } from "./StepRunner.js"; -import { useActiveWalletInfo } from "./swap-widget/hooks.js"; import type { PaymentMethod, RequiredParams } from "./types.js"; export type BuyOrOnrampPrepareResult = Extract< @@ -432,7 +431,6 @@ function BridgeWidgetContent( >, ) { const [screen, setScreen] = useState({ id: "1:buy-ui" }); - const activeWalletInfo = useActiveWalletInfo(); const handleError = useCallback( (error: Error, quote: BridgePrepareResult | undefined) => { @@ -478,7 +476,7 @@ function BridgeWidgetContent( }; }); - if (screen.id === "1:buy-ui" || !activeWalletInfo) { + if (screen.id === "1:buy-ui") { return ( + ) : ( - ) : ( - )} {props.showThirdwebBranding ? (