Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove Goerli + Format #405

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 1 addition & 5 deletions src/__snapshots__/storybook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ exports[`Storyshots Explorer/Warnings Network Warning 1`] = `
<strong>
Sepolia
</strong>
or
<strong>
Goerli
</strong>
test networks instead.
test network instead.
</div>
<button
className="network-warning-button"
Expand Down
2 changes: 1 addition & 1 deletion src/components/warning/NetworkWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const NetworkWarning: React.FC<NetworkWarningProps> = ({ onClose }) => (
</div>
<div className="network-warning-description">
Blockchain transactions in this network have a cost and real consequences. We recommend you use the{' '}
<strong>Sepolia</strong> or <strong>Goerli</strong> test networks instead.
<strong>Sepolia</strong> test network instead.
</div>
<button className="network-warning-button" onClick={onClose}>
Expand Down
10 changes: 3 additions & 7 deletions src/eth/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const CONNECTION_TIMEOUT_IN_MILLIS = 10 * SECONDS_IN_MILLIS

export const chainIdRpc = new Map<number, string>([
[1, 'wss://rpc.decentraland.org/mainnet'],
[5, 'wss://rpc.decentraland.org/goerli'],
[11155111, 'wss://rpc.decentraland.org/sepolia']
])

Expand Down Expand Up @@ -43,10 +42,7 @@ export async function getEthereumProvider(
}

export async function restoreConnection(): Promise<ConnectionResponse | null> {
return await Promise.race([
connection.tryPreviousConnection().catch(() => null),
delay(CONNECTION_TIMEOUT_IN_MILLIS)
])
return await Promise.race([connection.tryPreviousConnection().catch(() => null), delay(CONNECTION_TIMEOUT_IN_MILLIS)])
}

export async function disconnect(): Promise<void> {
Expand Down Expand Up @@ -77,7 +73,7 @@ export async function switchToChainId(wantedChainId: ChainId, providerChainId: C
}

function delay(millis: number): Promise<null> {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => resolve(null), millis)
})
}
}
39 changes: 21 additions & 18 deletions src/kernel-loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ import { resolveUrlFromUrn } from '@dcl/urn-resolver'
import { defaultWebsiteErrorTracker, defaultKernelErrorTracker, track } from '../utils/tracking'
import { injectVersions } from '../utils/rolloutVersions'
import { KernelError, KernelResult } from '@dcl/kernel-interface'
import { ENV, NETWORK, withOrigin, ensureOrigin, CATALYST, RENDERER_TYPE, SHOW_WALLET_SELECTOR } from '../integration/url'
import {
ENV,
NETWORK,
withOrigin,
ensureOrigin,
CATALYST,
RENDERER_TYPE,
SHOW_WALLET_SELECTOR
} from '../integration/url'
import { isElectron, launchDesktopApp } from '../integration/desktop'
import { isMobile, setAsRecentlyLoggedIn } from '../integration/browser'
import { FeatureFlags, isFeatureVariantEnabled } from '../state/selectors'

function getWantedChainId() {
let chainId: ChainId

switch(NETWORK) {
case 'goerli':
chainId = ChainId.ETHEREUM_GOERLI
break
switch (NETWORK) {
case 'sepolia':
chainId = ChainId.ETHEREUM_SEPOLIA
break
Expand All @@ -58,7 +63,7 @@ export async function authenticate(providerType: ProviderType | null) {
extra: {
providerType,
providerChainId: providerChainId,
wantedChainId: wantedChainId,
wantedChainId: wantedChainId
}
})
)
Expand Down Expand Up @@ -111,7 +116,8 @@ export async function authenticate(providerType: ProviderType | null) {
err &&
typeof err === 'object' &&
typeof (err as Error)?.message == 'string' &&
((err as Error)?.message.includes('Already processing eth_requestAccounts.') || (err as Error)?.message.includes('Please wait.'))
((err as Error)?.message.includes('Already processing eth_requestAccounts.') ||
(err as Error)?.message.includes('Please wait.'))
) {
// https://github.com/decentraland/explorer-website/issues/46
store.dispatch(
Expand Down Expand Up @@ -221,14 +227,14 @@ async function initKernel() {

const kernel = await injectKernel({
kernelOptions: {
baseUrl: await resolveBaseUrl(globalThis.EXPLORER_BASE_URL || `https://cdn.decentraland.org/@dcl/explorer/latest`),
baseUrl: await resolveBaseUrl(
globalThis.EXPLORER_BASE_URL || `https://cdn.decentraland.org/@dcl/explorer/latest`
),
configurations: {}
},
rendererOptions: {
container,
baseUrl: await resolveBaseUrl(
globalThis.EXPLORER_BASE_URL || `https://cdn.decentraland.org/@dcl/explorer/latest`
)
baseUrl: await resolveBaseUrl(globalThis.EXPLORER_BASE_URL || `https://cdn.decentraland.org/@dcl/explorer/latest`)
}
})

Expand Down Expand Up @@ -323,10 +329,7 @@ async function initLogin(kernel: KernelResult) {
}
}

if (
isFeatureVariantEnabled(store.getState(), FeatureFlags.SeamlessLogin) &&
!SHOW_WALLET_SELECTOR
) {
if (isFeatureVariantEnabled(store.getState(), FeatureFlags.SeamlessLogin) && !SHOW_WALLET_SELECTOR) {
track('seamless_login')
authenticate(null).catch(defaultWebsiteErrorTracker)
return
Expand All @@ -335,10 +338,10 @@ async function initLogin(kernel: KernelResult) {
}

export function startKernel() {
if (NETWORK && NETWORK !== 'mainnet' && NETWORK !== 'goerli' && NETWORK !== 'sepolia') {
if (NETWORK && NETWORK !== 'mainnet' && NETWORK !== 'sepolia') {
store.dispatch(
setKernelError({
error: new Error(`Invalid NETWORK url param, valid options are 'mainnet', 'goerli' and 'sepolia'`),
error: new Error(`Invalid NETWORK url param, valid options are 'mainnet' and 'sepolia'`),
code: ErrorType.FATAL
})
)
Expand All @@ -349,7 +352,7 @@ export function startKernel() {
store.dispatch(
setKernelError({
error: new Error(
`The "ENV" URL parameter is no longer supported. Please use NETWORK=goerli or NETWORK=sepolia in the cases where ENV=zone was used`
`The "ENV" URL parameter is no longer supported. Please use NETWORK=sepolia in the cases where ENV=zone was used`
),
code: ErrorType.FATAL
})
Expand Down