File tree Expand file tree Collapse file tree 3 files changed +23
-17
lines changed
packages/thirdweb/src/react/web/ui/Bridge Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Do not require connecting wallet in ` BuyWidget ` if ` receiverAddress ` is set
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ import { PaymentSelection } from "./payment-selection/PaymentSelection.js";
3939import { SuccessScreen } from "./payment-success/SuccessScreen.js" ;
4040import { QuoteLoader } from "./QuoteLoader.js" ;
4141import { StepRunner } from "./StepRunner.js" ;
42- import { useActiveWalletInfo } from "./swap-widget/hooks.js" ;
4342import type { PaymentMethod , RequiredParams } from "./types.js" ;
4443
4544export type BuyOrOnrampPrepareResult = Extract <
@@ -432,7 +431,6 @@ function BridgeWidgetContent(
432431 > ,
433432) {
434433 const [ screen , setScreen ] = useState < BuyWidgetScreen > ( { id : "1:buy-ui" } ) ;
435- const activeWalletInfo = useActiveWalletInfo ( ) ;
436434
437435 const handleError = useCallback (
438436 ( error : Error , quote : BridgePrepareResult | undefined ) => {
@@ -478,7 +476,7 @@ function BridgeWidgetContent(
478476 } ;
479477 } ) ;
480478
481- if ( screen . id === "1:buy-ui" || ! activeWalletInfo ) {
479+ if ( screen . id === "1:buy-ui" ) {
482480 return (
483481 < FundWallet
484482 theme = { props . theme }
Original file line number Diff line number Diff line change @@ -167,6 +167,9 @@ export function FundWallet(props: FundWalletProps) {
167167 const actionLabel = isReceiverDifferentFromActiveWallet ? "Pay" : "Buy" ;
168168 const isMobile = useIsMobile ( ) ;
169169
170+ // if no receiver address is set - wallet must be connected because the user's wallet is the receiver
171+ const showConnectButton = ! props . receiverAddress && ! activeWalletInfo ;
172+
170173 return (
171174 < WithHeader
172175 client = { props . client }
@@ -283,7 +286,20 @@ export function FundWallet(props: FundWalletProps) {
283286 ) }
284287
285288 { /* Continue Button */ }
286- { activeWalletInfo ? (
289+ { showConnectButton ? (
290+ < ConnectButton
291+ client = { props . client }
292+ connectButton = { {
293+ label : props . buttonLabel || actionLabel ,
294+ style : {
295+ width : "100%" ,
296+ borderRadius : radius . full ,
297+ } ,
298+ } }
299+ theme = { theme }
300+ { ...props . connectOptions }
301+ />
302+ ) : (
287303 < Button
288304 disabled = { ! receiver }
289305 fullWidth
@@ -316,19 +332,6 @@ export function FundWallet(props: FundWalletProps) {
316332 >
317333 { props . buttonLabel || actionLabel }
318334 </ Button >
319- ) : (
320- < ConnectButton
321- client = { props . client }
322- connectButton = { {
323- label : props . buttonLabel || actionLabel ,
324- style : {
325- width : "100%" ,
326- borderRadius : radius . full ,
327- } ,
328- } }
329- theme = { theme }
330- { ...props . connectOptions }
331- />
332335 ) }
333336
334337 { props . showThirdwebBranding ? (
You can’t perform that action at this time.
0 commit comments