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/orange-rockets-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Force redirect to phantom app on mobile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export function RightSection(props: {
<div
className={cn(
"relative flex min-h-[300px] grow justify-center rounded-lg",
previewTab === "modal" && "scale-75 lg:scale-100",
previewTab !== "code" && "items-center",
)}
>
Expand Down
3 changes: 3 additions & 0 deletions packages/thirdweb/scripts/wallets/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const deepLinkSupportedWalletsRecord: Record<
"io.metamask": {
mobile: "https://metamask.app.link/dapp/",
},
"app.phantom": {
mobile: "https://phantom.app/ul/browse/",
},
};

type Wallet = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ export function AnyWalletConnectUI(props: {
);
}

if (
const shouldDeeplink =
walletInfo.data.deepLink &&
!isInstalled &&
(wallet as Wallet<DeepLinkSupportedWalletIds>).getConfig()
?.preferDeepLink &&
isMobile()
) {
isMobile() &&
((wallet as Wallet<DeepLinkSupportedWalletIds>).getConfig()
?.preferDeepLink ||
wallet.id === "app.phantom"); // always deeplink phantom on mobile, does not support remote connection

if (walletInfo.data.deepLink?.mobile && shouldDeeplink) {
return (
<DeepLinkConnectUI
wallet={props.wallet as Wallet<InjectedSupportedWalletIds>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export const DeepLinkConnectUI = (props: {
onBack?: () => void;
client: ThirdwebClient;
}) => {
const link = encodeURIComponent(window.location.toString());
const deeplink = `${props.deepLinkPrefix}${link}?ref=${link}`;
return (
<Container animate="fadein">
<Container p="lg">
Expand All @@ -38,14 +40,7 @@ export const DeepLinkConnectUI = (props: {
</Container>

<Container p="lg">
<ButtonLink
fullWidth
variant="accent"
href={`${props.deepLinkPrefix}${window.location
.toString()
.replace("https://", "")}`}
gap="xs"
>
<ButtonLink fullWidth variant="accent" href={deeplink} gap="xs">
Continue in {props.walletInfo.name}
<ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
</ButtonLink>
Expand Down
Loading
Loading