@@ -129,7 +129,7 @@ let _provider: ProviderInterface | undefined;
129129 * @internal
130130 */
131131export async function getCoinbaseWebProvider (
132- options ?: CreateWalletArgs < typeof COINBASE > [ 1 ] ,
132+ options ?: CreateWalletArgs < typeof COINBASE > [ 1 ]
133133) : Promise < ProviderInterface > {
134134 if ( ! _provider ) {
135135 let CoinbaseWalletSDK : unknown = ( await import ( "@coinbase/wallet-sdk" ) )
@@ -169,7 +169,7 @@ export async function getCoinbaseWebProvider(
169169 * @returns True if the wallet is a Coinbase SDK wallet, false otherwise.
170170 */
171171export function isCoinbaseSDKWallet (
172- wallet : Wallet ,
172+ wallet : Wallet
173173) : wallet is Wallet < typeof COINBASE > {
174174 return wallet . id === COINBASE ;
175175}
@@ -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 ( {
@@ -249,7 +259,7 @@ function createAccount({
249259 }
250260
251261 const { domain, message, primaryType } = parseTypedData (
252- typedData ,
262+ typedData
253263 ) as ox__TypedData . Definition ;
254264
255265 const types = {
@@ -281,7 +291,7 @@ function createAccount({
281291 try {
282292 const { callParams, chain } = await toProviderCallParams (
283293 options ,
284- account ,
294+ account
285295 ) ;
286296 const callId = await provider . request ( {
287297 method : "wallet_sendCalls" ,
@@ -294,7 +304,7 @@ function createAccount({
294304 } catch ( error ) {
295305 if ( / u n s u p p o r t | n o t s u p p o r t / i. test ( ( error as Error ) . message ) ) {
296306 throw new Error (
297- `${ COINBASE } errored calling wallet_sendCalls, with error: ${ error instanceof Error ? error . message : stringify ( error ) } ` ,
307+ `${ COINBASE } errored calling wallet_sendCalls, with error: ${ error instanceof Error ? error . message : stringify ( error ) } `
298308 ) ;
299309 }
300310 throw error ;
@@ -310,7 +320,7 @@ function createAccount({
310320 } catch ( error ) {
311321 if ( / u n s u p p o r t | n o t s u p p o r t / i. test ( ( error as Error ) . message ) ) {
312322 throw new Error (
313- `${ COINBASE } does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.` ,
323+ `${ COINBASE } does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`
314324 ) ;
315325 }
316326 throw error ;
@@ -345,7 +355,7 @@ function onConnect(
345355 chain : Chain ,
346356 provider : ProviderInterface ,
347357 emitter : WalletEmitter < typeof COINBASE > ,
348- client : ThirdwebClient ,
358+ client : ThirdwebClient
349359) : [ Account , Chain , DisconnectFn , SwitchChainFn ] {
350360 const account = createAccount ( { address, client, provider } ) ;
351361
@@ -399,7 +409,7 @@ function onConnect(
399409export async function connectCoinbaseWalletSDK (
400410 options : WalletConnectionOption < typeof COINBASE > ,
401411 emitter : WalletEmitter < typeof COINBASE > ,
402- provider : ProviderInterface ,
412+ provider : ProviderInterface
403413) : Promise < ReturnType < typeof onConnect > > {
404414 const accounts = ( await provider . request ( {
405415 method : "eth_requestAccounts" ,
@@ -435,7 +445,7 @@ export async function connectCoinbaseWalletSDK(
435445export async function autoConnectCoinbaseWalletSDK (
436446 options : WalletConnectionOption < typeof COINBASE > ,
437447 emitter : WalletEmitter < typeof COINBASE > ,
438- provider : ProviderInterface ,
448+ provider : ProviderInterface
439449) : Promise < ReturnType < typeof onConnect > > {
440450 // connected accounts
441451 const addresses = ( await provider . request ( {
@@ -462,7 +472,7 @@ export async function autoConnectCoinbaseWalletSDK(
462472
463473async function switchChainCoinbaseWalletSDK (
464474 provider : ProviderInterface ,
465- chain : Chain ,
475+ chain : Chain
466476) {
467477 const chainIdHex = numberToHex ( chain . id ) ;
468478
0 commit comments