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 support #80

Merged
merged 4 commits into from
Jan 9, 2025
Merged
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
2 changes: 0 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
NEXT_PUBLIC_INFURA_KEY=

NEXT_PUBLIC_ETHEREUM_RPC_URL=
NEXT_PUBLIC_GOERLI_RPC_URL=
NEXT_PUBLIC_SEPOLIA_RPC_URL=

NEXT_PUBLIC_ARBITRUM_RPC_URL=
NEXT_PUBLIC_ARBITRUM_GOERLI_RPC_URL=
NEXT_PUBLIC_ARBITRUM_NOVA_RPC_URL=
NEXT_PUBLIC_ARBITRUM_SEPOLIA_RPC_URL=

Expand Down
9 changes: 2 additions & 7 deletions src/app/recover-funds/[address]/RecoverFundsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@arbitrum/sdk';
import { Inbox__factory } from '@arbitrum/sdk/dist/lib/abi/factories/Inbox__factory';
import { getBaseFee } from '@arbitrum/sdk/dist/lib/utils/lib';
import { goerli, mainnet, sepolia, useNetwork, useSigner } from 'wagmi';
import { mainnet, sepolia, useNetwork, useSigner } from 'wagmi';
import { getProviderFromChainId, getTargetChainId } from '@/utils';
import { BigNumber } from 'ethers';
import { ChainId } from '@/utils/network';
Expand All @@ -21,7 +21,6 @@ function getL1ChainIdFromL2ChainId(l2ChainId: number | undefined) {

return {
[ChainId.ArbitrumOne]: ChainId.Mainnet,
[ChainId.ArbitrumGoerli]: ChainId.Goerli,
[ChainId.ArbitrumSepolia]: ChainId.Sepolia,
}[l2ChainId];
}
Expand Down Expand Up @@ -158,11 +157,7 @@ function RecoverFundsButton({

if (!signer) return null;

if (
chain?.id !== mainnet.id &&
chain?.id !== goerli.id &&
chain?.id !== sepolia.id
) {
if (chain?.id !== mainnet.id && chain?.id !== sepolia.id) {
return (
<div>Unknown L1 chain id. This chain is not supported by this tool</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/recover-funds/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default function Layout({ children }: LayoutProps) {
<h2>
Tool to recover funds that are locked in an aliased L2 address.
<br />
Connect to either Ethereum mainnet, Goerli or Sepolia to start the
recovery process.
Connect to either Ethereum mainnet or Sepolia to start the recovery
process.
</h2>
</header>

Expand Down
2 changes: 2 additions & 0 deletions src/app/retryables-tracker-all/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Suspense } from 'react';
import PendingRetryables from '../retryables-tracker/[address]/PendingRetryables';

export const dynamic = 'force-dynamic';

const Page = async () => {
return (
<>
Expand Down
2 changes: 2 additions & 0 deletions src/app/retryables-tracker/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Link from 'next/link';
import { Suspense } from 'react';
import PendingRetryables from './PendingRetryables';

export const dynamic = 'force-dynamic';

const Page = async ({ params }: { params: { address: string } }) => {
const { address } = params;

Expand Down
12 changes: 1 addition & 11 deletions src/components/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { WagmiConfig, createClient, configureChains, Chain } from 'wagmi';
import {
mainnet,
arbitrum,
arbitrumGoerli,
goerli,
localhost,
sepolia as sepoliaDefault,
} from 'wagmi/chains';
Expand Down Expand Up @@ -76,15 +74,7 @@ export const arbitrumSepolia: Chain = {
};

const { provider, chains } = configureChains(
[
mainnet,
goerli,
sepolia,
arbitrum,
arbitrumGoerli,
arbitrumSepolia,
localhost,
],
[mainnet, sepolia, arbitrum, arbitrumSepolia, localhost],
[
publicProvider(),
jsonRpcProvider({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getL2ToL1Messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getL2ToL1Messages = async (
const l2Provider = new JsonRpcProvider(rpcURL);

// TODO
const l1ChainID = l2Network.partnerChainID as 1 | 5;
const l1ChainID = l2Network.partnerChainID as 1 | 11155111;
const l1Provider = new JsonRpcProvider(supportedL1Networks[l1ChainID]);
try {
await l1Provider.getBlockNumber();
Expand Down
2 changes: 0 additions & 2 deletions src/utils/getTargetChainId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ export const getTargetChainId = (chainID: number | undefined) => {
return (
{
[ChainId.Mainnet]: ChainId.ArbitrumOne,
[ChainId.Goerli]: ChainId.ArbitrumGoerli,
[ChainId.Sepolia]: ChainId.ArbitrumSepolia,
[ChainId.ArbitrumOne]: ChainId.ArbitrumOne,
[ChainId.ArbitrumGoerli]: ChainId.ArbitrumGoerli,
[ChainId.ArbitrumSepolia]: ChainId.ArbitrumSepolia,
}[chainID] || defaultTargetChainId
);
Expand Down
16 changes: 0 additions & 16 deletions src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,32 @@ if (typeof INFURA_KEY === 'undefined') {

// L1
const MAINNET_INFURA_RPC_URL = `https://mainnet.infura.io/v3/${INFURA_KEY}`;
const GOERLI_INFURA_RPC_URL = `https://goerli.infura.io/v3/${INFURA_KEY}`;
const SEPOLIA_INFURA_RPC_URL = `https://sepolia.infura.io/v3/${INFURA_KEY}`;
// L2
const ARBITRUM_INFURA_RPC_URL = `https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`;
const ARBITRUM_GOERLI_INFURA_RPC_URL = `https://arbitrum-goerli.infura.io/v3/${INFURA_KEY}`;
const ARBITRUM_SEPOLIA_INFURA_RPC_URL = `https://arbitrum-sepolia.infura.io/v3/${INFURA_KEY}`;
const LOCAL_GETH_RPC_URL = `http://localhost:8545`;

export enum ChainId {
// L1
Mainnet = 1,
// L1 Testnets
Goerli = 5,
Sepolia = 11155111,
Local = 1337,
// L2
ArbitrumOne = 42161,
ArbitrumNova = 42170,
// L2 Testnets
ArbitrumGoerli = 421613,
ArbitrumLocal = 412346,
ArbitrumSepolia = 421614,
}

export const mapChainIdToName: Record<string, string> = {
[ChainId.Mainnet]: 'Ethereum',
[ChainId.Goerli]: 'Goerli',
[ChainId.Sepolia]: 'Sepolia',
[ChainId.Local]: 'Local',
[ChainId.ArbitrumOne]: 'Arbitrum One',
[ChainId.ArbitrumNova]: 'Arbitrum Nova',
[ChainId.ArbitrumGoerli]: 'Arbitrum Goerli',
[ChainId.ArbitrumLocal]: 'Arbitrum Local',
[ChainId.ArbitrumSepolia]: 'Arbitrum Sepolia',
};
Expand All @@ -54,10 +48,6 @@ export const rpcURLs: RpcMap = {
fallback: MAINNET_INFURA_RPC_URL,
}),
// L1 Testnets
[ChainId.Goerli]: loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_GOERLI_RPC_URL,
fallback: GOERLI_INFURA_RPC_URL,
}),
[ChainId.Sepolia]: loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_SEPOLIA_RPC_URL,
fallback: SEPOLIA_INFURA_RPC_URL,
Expand All @@ -72,10 +62,6 @@ export const rpcURLs: RpcMap = {
fallback: 'https://nova.arbitrum.io/rpc',
}),
// L2 Testnets
[ChainId.ArbitrumGoerli]: loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_ARBITRUM_GOERLI_RPC_URL,
fallback: ARBITRUM_GOERLI_INFURA_RPC_URL,
}),
[ChainId.ArbitrumSepolia]: loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_ARBITRUM_SEPOLIA_RPC_URL,
fallback: ARBITRUM_SEPOLIA_INFURA_RPC_URL,
Expand All @@ -93,15 +79,13 @@ export const rpcURLs: RpcMap = {

export const supportedL1Networks: Partial<RpcMap> = {
[ChainId.Mainnet]: rpcURLs[ChainId.Mainnet],
[ChainId.Goerli]: rpcURLs[ChainId.Goerli],
[ChainId.Sepolia]: rpcURLs[ChainId.Sepolia],
...(isE2e ? { [ChainId.Local]: rpcURLs[ChainId.Local] } : {}),
};

export const supportedL2Networks: Partial<RpcMap> = {
[ChainId.ArbitrumOne]: rpcURLs[ChainId.ArbitrumOne],
[ChainId.ArbitrumNova]: rpcURLs[ChainId.ArbitrumNova],
[ChainId.ArbitrumGoerli]: rpcURLs[ChainId.ArbitrumGoerli],
[ChainId.ArbitrumSepolia]: rpcURLs[ChainId.ArbitrumSepolia],
...(isE2e ? { [ChainId.ArbitrumLocal]: rpcURLs[ChainId.ArbitrumLocal] } : {}),
};
Expand Down
4 changes: 2 additions & 2 deletions tests/support/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Cypress.Keyboard.defaults({
});

before(() => {
// connect to goerli to avoid connecting to localhost twice and failing
cy.setupMetamask(Cypress.env('PRIVATE_KEY'), 'goerli');
// connect to sepolia to avoid connecting to localhost twice and failing
cy.setupMetamask(Cypress.env('PRIVATE_KEY'), 'sepolia');
});
Loading