Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bumpy-shoes-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix BuyWidget autoconnect not working when receiverAddress prop is set
16 changes: 16 additions & 0 deletions packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import type { CompletedStatusResult } from "../../../core/hooks/useStepExecutor.js";
import type { SupportedTokens } from "../../../core/utils/defaultTokens.js";
import { webWindowAdapter } from "../../adapters/WindowAdapter.js";
import { AutoConnect } from "../AutoConnect/AutoConnect.js";
import connectLocaleEn from "../ConnectWallet/locale/en.js";
import { EmbedContainer } from "../ConnectWallet/Modal/ConnectEmbed.js";
import { DynamicHeight } from "../components/DynamicHeight.js";
Expand Down Expand Up @@ -359,6 +360,21 @@
className={props.className}
style={props.style}
>
{props.connectOptions?.autoConnect !== false && (
<AutoConnect
client={props.client}
wallets={props.connectOptions?.wallets}
timeout={
typeof props.connectOptions?.autoConnect === "object"
? props.connectOptions?.autoConnect?.timeout
: undefined

Check warning on line 370 in packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx#L363-L370

Added lines #L363 - L370 were not covered by tests
}
appMetadata={props.connectOptions?.appMetadata}
accountAbstraction={props.connectOptions?.accountAbstraction}
chain={props.connectOptions?.chain}
/>

Check warning on line 375 in packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx#L372-L375

Added lines #L372 - L375 were not covered by tests
)}

<BridgeWidgetContent
{...props}
theme={props.theme || "dark"}
Expand Down
1 change: 1 addition & 0 deletions packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
}}
theme={theme}
{...props.connectOptions}
autoConnect={false}

Check warning on line 301 in packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx#L301

Added line #L301 was not covered by tests
/>
) : (
<Button
Expand Down
14 changes: 14 additions & 0 deletions packages/thirdweb/src/stories/BuyWidget.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ export function LargeAmount() {
);
}

export function NoAutoConnect() {
return (
<Variant
client={storyClient}
chain={ethereum}
tokenAddress="0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
amount="150000"
connectOptions={{
autoConnect: false,
}}
/>
);
}

function Variant(props: BuyWidgetProps) {
return (
<div
Expand Down
Loading