Skip to content

Commit 8280efb

Browse files
[SDK] Fix Coinbase wallet transaction desktop popup for mobile QR login (#8253)
1 parent 5f11ae0 commit 8280efb

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.changeset/sixty-bobcats-add.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 cb wallet transaction desktop popup when logged in via mobile QR code

packages/thirdweb/src/wallets/coinbase/coinbase-web.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,17 @@ function createAccount({
188188
onTransactionRequested: async () => {
189189
// make sure to show the coinbase popup BEFORE doing any transaction preprocessing
190190
// otherwise the popup might get blocked in safari
191-
await showCoinbasePopup(provider);
191+
// but only if using cb smart wallet (web based)
192+
if (window.localStorage) {
193+
// this is the local storage key for the signer type in the cb web sdk
194+
// value can be "scw" (web) or "walletlink" (mobile wallet)
195+
const signerType = window.localStorage.getItem(
196+
"-CBWSDK:SignerConfigurator:SignerType",
197+
);
198+
if (signerType === "scw") {
199+
await showCoinbasePopup(provider);
200+
}
201+
}
192202
},
193203
async sendTransaction(tx: SendTransactionOption) {
194204
const transactionHash = (await provider.request({

packages/thirdweb/src/x402/fetchWithPayment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function wrapFetchWithPayment(
8282
parsedPaymentRequirements,
8383
chain.id,
8484
"exact",
85+
error,
8586
);
8687

8788
if (!selectedPaymentRequirements) {
@@ -141,10 +142,11 @@ function defaultPaymentRequirementsSelector(
141142
paymentRequirements: RequestedPaymentRequirements[],
142143
chainId: number,
143144
scheme: "exact",
145+
error?: string,
144146
) {
145147
if (!paymentRequirements.length) {
146148
throw new Error(
147-
"No valid payment requirements found in server 402 response",
149+
`No valid payment requirements found in server 402 response. ${error}`,
148150
);
149151
}
150152
const currentWalletNetwork = ChainIdToNetwork[chainId] || `eip155:${chainId}`;

0 commit comments

Comments
 (0)