Skip to content

Commit 60edce4

Browse files
[SDK] fix: Improve WalletConnect mobile connection handling (#6042)
1 parent 20c0dca commit 60edce4

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.changeset/nervous-frogs-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix prompting for generic WC connection on mobile

apps/playground-web/src/components/sign-in/hooks.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"use client";
2-
32
import {
43
useActiveAccount,
54
useActiveWallet,
@@ -39,7 +38,9 @@ export function HooksPreview() {
3938
</>
4039
) : (
4140
<Button variant="default" onClick={connect}>
42-
Connect with Metamask
41+
{connectMutation.isConnecting
42+
? "Connecting..."
43+
: "Connect with Metamask"}
4344
</Button>
4445
)}
4546
</div>

packages/thirdweb/src/wallets/wallet-connect/controller.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ export async function connectWC(
9393
let { onDisplayUri } = wcOptions || {};
9494

9595
// use default sessionHandler unless onDisplayUri is explicitly provided
96-
if (!onDisplayUri && sessionHandler && walletId !== "walletConnect") {
96+
if (!onDisplayUri && sessionHandler) {
9797
const walletInfo = await getWalletInfo(walletId);
9898
const deeplinkHandler = (uri: string) => {
9999
const appUrl = walletInfo.mobile.native || walletInfo.mobile.universal;
100100
if (!appUrl) {
101-
throw new Error("No app url found for wallet connect to redirect to.");
101+
// generic wc uri
102+
sessionHandler(uri);
103+
return;
102104
}
103105
const fullUrl = formatWalletConnectUrl(appUrl, uri).redirect;
104106
sessionHandler(fullUrl);

0 commit comments

Comments
 (0)