From fb875c67a2fec1b425fdf109fcce4ced22ef9013 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Wed, 15 Oct 2025 07:59:52 +1300 Subject: [PATCH] Fix Coinbase wallet transaction desktop popup for mobile QR login --- .changeset/sixty-bobcats-add.md | 5 +++++ .../thirdweb/src/wallets/coinbase/coinbase-web.ts | 12 +++++++++++- packages/thirdweb/src/x402/fetchWithPayment.ts | 4 +++- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .changeset/sixty-bobcats-add.md diff --git a/.changeset/sixty-bobcats-add.md b/.changeset/sixty-bobcats-add.md new file mode 100644 index 00000000000..d306e7e9ae5 --- /dev/null +++ b/.changeset/sixty-bobcats-add.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Fix cb wallet transaction desktop popup when logged in via mobile QR code diff --git a/packages/thirdweb/src/wallets/coinbase/coinbase-web.ts b/packages/thirdweb/src/wallets/coinbase/coinbase-web.ts index bb9c9e15ccb..f1b248f1d20 100644 --- a/packages/thirdweb/src/wallets/coinbase/coinbase-web.ts +++ b/packages/thirdweb/src/wallets/coinbase/coinbase-web.ts @@ -188,7 +188,17 @@ function createAccount({ onTransactionRequested: async () => { // make sure to show the coinbase popup BEFORE doing any transaction preprocessing // otherwise the popup might get blocked in safari - await showCoinbasePopup(provider); + // but only if using cb smart wallet (web based) + if (window.localStorage) { + // this is the local storage key for the signer type in the cb web sdk + // value can be "scw" (web) or "walletlink" (mobile wallet) + const signerType = window.localStorage.getItem( + "-CBWSDK:SignerConfigurator:SignerType", + ); + if (signerType === "scw") { + await showCoinbasePopup(provider); + } + } }, async sendTransaction(tx: SendTransactionOption) { const transactionHash = (await provider.request({ diff --git a/packages/thirdweb/src/x402/fetchWithPayment.ts b/packages/thirdweb/src/x402/fetchWithPayment.ts index 19d3dab57da..1cb7abc4561 100644 --- a/packages/thirdweb/src/x402/fetchWithPayment.ts +++ b/packages/thirdweb/src/x402/fetchWithPayment.ts @@ -82,6 +82,7 @@ export function wrapFetchWithPayment( parsedPaymentRequirements, chain.id, "exact", + error, ); if (!selectedPaymentRequirements) { @@ -141,10 +142,11 @@ function defaultPaymentRequirementsSelector( paymentRequirements: RequestedPaymentRequirements[], chainId: number, scheme: "exact", + error?: string, ) { if (!paymentRequirements.length) { throw new Error( - "No valid payment requirements found in server 402 response", + `No valid payment requirements found in server 402 response. ${error}`, ); } const currentWalletNetwork = ChainIdToNetwork[chainId] || `eip155:${chainId}`;