Skip to content

Commit

Permalink
Check for window undefined for nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
tolgahan-arikan committed Dec 4, 2024
1 parent 1de265d commit 90b2db1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions packages/kit/src/config/defaultConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,17 @@ export const getDefaultWaasConnectors = (options: DefaultWaasConnectorOptions):
}

if (options.metaMask !== false) {
wallets.push(
metaMask({
dappMetadata: {
name: appName,
url: window.location.origin,
iconUrl: window.location.origin + '/favicon.ico'
}
})
)
if (typeof window !== 'undefined') {
wallets.push(
metaMask({
dappMetadata: {
name: appName,
url: window.location.origin,
iconUrl: `https://www.google.com/s2/favicons?domain_url=${window.location.origin}`
}
})
)
}
}

if (options.coinbase !== false) {
Expand Down Expand Up @@ -255,15 +257,17 @@ export const getDefaultUniversalConnectors = (options: DefaultUniversalConnector
}

if (options.metaMask !== false) {
wallets.push(
metaMask({
dappMetadata: {
name: appName,
url: window.location.origin,
iconUrl: window.location.origin + '/favicon.ico'
}
})
)
if (typeof window !== 'undefined') {
wallets.push(
metaMask({
dappMetadata: {
name: appName,
url: window.location.origin,
iconUrl: `https://www.google.com/s2/favicons?domain_url=${window.location.origin}`
}
})
)
}
}

if (options.coinbase !== false) {
Expand Down

0 comments on commit 90b2db1

Please sign in to comment.