From f05a9512a146fb465a780f90c5b4eb7aa34cab6d Mon Sep 17 00:00:00 2001 From: sugh01 <19183308+sugh01@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:25:55 +0200 Subject: [PATCH] skip cloudfareurl in transports --- e2e/specs/stateful/dnsclaim.spec.ts | 1 - e2e/specs/stateful/moonpay.spec.ts | 1 - src/components/@molecules/FaucetBanner.tsx | 2 +- src/components/TestnetWarning.test.tsx | 8 +++++--- .../pages/profile/[name]/registration/Registration.tsx | 5 ----- .../ExpirySection/hooks/useExpiryDetails.test.ts | 2 +- src/constants/chains.ts | 5 +---- src/constants/resolverAddressData.test.ts | 6 +++--- src/hooks/useAvatarFromRecord.ts | 2 +- src/hooks/useEthPrice.ts | 6 +++--- src/hooks/useFaucet.ts | 2 +- src/utils/SyncProvider/SyncDroppedTransaction.test.tsx | 9 --------- src/utils/SyncProvider/SyncDroppedTransaction.tsx | 2 -- src/utils/query/wagmi.ts | 4 +--- 14 files changed, 17 insertions(+), 38 deletions(-) diff --git a/e2e/specs/stateful/dnsclaim.spec.ts b/e2e/specs/stateful/dnsclaim.spec.ts index 0468a182f..033ad0a88 100644 --- a/e2e/specs/stateful/dnsclaim.spec.ts +++ b/e2e/specs/stateful/dnsclaim.spec.ts @@ -31,7 +31,6 @@ test.describe('Import DNSSEC name', () => { await expect(page.getByTestId('import-next-button')).toBeDisabled() }) - // TODO: this is failing because stateful tests are still on goerli, we should switch to sepolia/holesky test.skip('should not allow the user to proceed if they have not set the correct TXT record - offchain', async ({ page, login, diff --git a/e2e/specs/stateful/moonpay.spec.ts b/e2e/specs/stateful/moonpay.spec.ts index 3f34d71f3..f14c3f1d0 100644 --- a/e2e/specs/stateful/moonpay.spec.ts +++ b/e2e/specs/stateful/moonpay.spec.ts @@ -15,7 +15,6 @@ const makeid = (length: number) => { test.describe.skip('Moonpay registration', () => { test('should open up moonpay flow if selected', async ({ page, login }) => { test.slow() - // cy.changeMetamaskNetwork('goerli') await page.goto(`/${makeid(230)}.eth/register`) await login.connect() diff --git a/src/components/@molecules/FaucetBanner.tsx b/src/components/@molecules/FaucetBanner.tsx index f6f9a3646..d4c4518be 100644 --- a/src/components/@molecules/FaucetBanner.tsx +++ b/src/components/@molecules/FaucetBanner.tsx @@ -72,7 +72,7 @@ const FaucetBanner = () => { closeDialog() }, [chainName, address]) - if ((chainName !== 'goerli' && chainName !== 'sepolia') || !isReady || isLoading || !data) + if ((chainName !== 'holesky' && chainName !== 'sepolia') || !isReady || isLoading || !data) return null const BannerComponent = ( diff --git a/src/components/TestnetWarning.test.tsx b/src/components/TestnetWarning.test.tsx index 294267934..ee64e1531 100644 --- a/src/components/TestnetWarning.test.tsx +++ b/src/components/TestnetWarning.test.tsx @@ -2,7 +2,7 @@ import { mockFunction, render, screen } from '@app/test-utils' import { describe, expect, it, vi } from 'vitest' import { useAccount } from 'wagmi' -import { goerli, mainnet } from 'wagmi/chains' +import { holesky, mainnet } from 'wagmi/chains' import { TestnetWarning } from './TestnetWarning' @@ -12,11 +12,13 @@ const mockUseAccount = mockFunction(useAccount) describe('TestnetWarning', () => { it('renders if testnet is used', async () => { - mockUseAccount.mockReturnValue({ chain: goerli }) + mockUseAccount.mockReturnValue({ chain: holesky }) render() - expect(screen.getByText(`You are viewing the ENS app on ${goerli.name} testnet.`)).toBeVisible() + expect( + screen.getByText(`You are viewing the ENS app on ${holesky.name} testnet.`), + ).toBeVisible() }) it('renders nothing if on mainnet', async () => { mockUseAccount.mockReturnValue({ chain: mainnet }) diff --git a/src/components/pages/profile/[name]/registration/Registration.tsx b/src/components/pages/profile/[name]/registration/Registration.tsx index baf650902..c1dced0d8 100644 --- a/src/components/pages/profile/[name]/registration/Registration.tsx +++ b/src/components/pages/profile/[name]/registration/Registration.tsx @@ -335,11 +335,6 @@ const Registration = ({ nameDetails, isLoading }: Props) => { {t('steps.info.moonpayModalHeader')} - {chainId === 5 && ( - - {`${t('steps.info.moonpayTestCard')}: 4000 0209 5159 5032, 12/2030, 123`} - - )} ({ })) vi.mock('@app/hooks/chain/useChainName', () => ({ - useChainName: () => 'goerli', + useChainName: () => 'holesky', })) beforeEach(() => { diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 3be53d40e..4bb193d91 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -1,5 +1,5 @@ import { holesky } from 'viem/chains' -import { goerli, localhost, mainnet, sepolia } from 'wagmi/chains' +import { localhost, mainnet, sepolia } from 'wagmi/chains' import { addEnsContracts } from '@ensdomains/ensjs' @@ -25,13 +25,11 @@ export const mainnetWithEns = { }, }, } -export const goerliWithEns = addEnsContracts(goerli) export const sepoliaWithEns = addEnsContracts(sepolia) export const holeskyWithEns = addEnsContracts(holesky) export const chainsWithEns = [ mainnetWithEns, - goerliWithEns, sepoliaWithEns, holeskyWithEns, localhostWithEns, @@ -42,7 +40,6 @@ export const getSupportedChainById = (chainId: number | undefined) => export type SupportedChain = | typeof mainnetWithEns - | typeof goerliWithEns | typeof sepoliaWithEns | typeof holeskyWithEns | typeof localhostWithEns diff --git a/src/constants/resolverAddressData.test.ts b/src/constants/resolverAddressData.test.ts index 4e9b21134..36b70aa0e 100644 --- a/src/constants/resolverAddressData.test.ts +++ b/src/constants/resolverAddressData.test.ts @@ -1,7 +1,7 @@ import { getChainContractAddress } from 'viem/utils' import { describe, expect, it } from 'vitest' -import { goerliWithEns, localhostWithEns, mainnetWithEns, sepoliaWithEns } from './chains' +import { holeskyWithEns, localhostWithEns, mainnetWithEns, sepoliaWithEns } from './chains' ;(process.env as any).NODE_ENV = 'development' @@ -12,8 +12,8 @@ it('should have the most recent resolver as the first address', async () => { expect(KNOWN_RESOLVER_DATA['1']![0].address).toEqual( getChainContractAddress({ chain: mainnetWithEns, contract: 'ensPublicResolver' }), ) - expect(KNOWN_RESOLVER_DATA['5']![0].address).toEqual( - getChainContractAddress({ chain: goerliWithEns, contract: 'ensPublicResolver' }), + expect(KNOWN_RESOLVER_DATA['17000']![0].address).toEqual( + getChainContractAddress({ chain: holeskyWithEns, contract: 'ensPublicResolver' }), ) expect(KNOWN_RESOLVER_DATA['11155111']![0].address).toEqual( getChainContractAddress({ chain: sepoliaWithEns, contract: 'ensPublicResolver' }), diff --git a/src/hooks/useAvatarFromRecord.ts b/src/hooks/useAvatarFromRecord.ts index 72c3e6c57..d08180871 100644 --- a/src/hooks/useAvatarFromRecord.ts +++ b/src/hooks/useAvatarFromRecord.ts @@ -6,7 +6,7 @@ const SUPPORTED_PROTOCOL_REGEX = /^(http|https|ar|ipfs|eip155):/ const chainIdToNetwork = (chainId?: string) => { if (chainId === '1') return 'mainnet' - if (chainId === '5') return 'goerli' + if (chainId === '17000') return 'holesky' if (chainId === '11155111') return 'sepolia' return '' } diff --git a/src/hooks/useEthPrice.ts b/src/hooks/useEthPrice.ts index 4fd8cef70..4ffb92957 100644 --- a/src/hooks/useEthPrice.ts +++ b/src/hooks/useEthPrice.ts @@ -1,6 +1,6 @@ import { Address } from 'viem' import { useChainId, useReadContract } from 'wagmi' -import { goerli } from 'wagmi/chains' +import { sepolia } from 'wagmi/chains' import { useAddressRecord } from './ensjs/public/useAddressRecord' @@ -12,10 +12,10 @@ export const useEthPrice = () => { const { data: address_ } = useAddressRecord({ name: ORACLE_ENS, - enabled: chainId !== goerli.id, + enabled: chainId !== sepolia.id, }) - const address = chainId === 5 ? ORACLE_GOERLI : (address_?.value as Address) || undefined + const address = chainId === 11155111 ? ORACLE_GOERLI : (address_?.value as Address) || undefined return useReadContract({ abi: [ diff --git a/src/hooks/useFaucet.ts b/src/hooks/useFaucet.ts index 5c9b782d8..747a63edf 100644 --- a/src/hooks/useFaucet.ts +++ b/src/hooks/useFaucet.ts @@ -98,7 +98,7 @@ const useFaucet = () => { const { data, error, isLoading } = useQuery({ ...preparedOptions, - enabled: !!address && (chainName === 'goerli' || chainName === 'sepolia'), + enabled: !!address && chainName === 'sepolia', }) const mutation = useMutation({ diff --git a/src/utils/SyncProvider/SyncDroppedTransaction.test.tsx b/src/utils/SyncProvider/SyncDroppedTransaction.test.tsx index 007789c31..660b9d20b 100644 --- a/src/utils/SyncProvider/SyncDroppedTransaction.test.tsx +++ b/src/utils/SyncProvider/SyncDroppedTransaction.test.tsx @@ -88,15 +88,6 @@ describe('getAccountHistoryEndpoint', () => { expect(getAccountHistoryEndpoint(address, chainId)).toEqual(expectedEndpoint) }) - it('returns the correct endpoint for goerli', () => { - const address = '0x1234567890123456789012345678901234567890' - const chainId = 5 - const expectedEndpoint = - 'https://etherscan-api-goerli.ens-cf.workers.dev/accountHistory?address=0x1234567890123456789012345678901234567890' - - expect(getAccountHistoryEndpoint(address, chainId)).toEqual(expectedEndpoint) - }) - it('returns an empty string for unknown chainIds', () => { const address = '0x1234567890123456789012345678901234567890' const chainId = 123 diff --git a/src/utils/SyncProvider/SyncDroppedTransaction.tsx b/src/utils/SyncProvider/SyncDroppedTransaction.tsx index dce77c182..c06fc6a0f 100644 --- a/src/utils/SyncProvider/SyncDroppedTransaction.tsx +++ b/src/utils/SyncProvider/SyncDroppedTransaction.tsx @@ -20,8 +20,6 @@ export const getAccountHistoryEndpoint = (address: string, chainId: number) => { switch (chainId) { case 1: return `https://etherscan-api.ens-cf.workers.dev/accountHistory?address=${address}` - case 5: - return `https://etherscan-api-goerli.ens-cf.workers.dev/accountHistory?address=${address}` case 11155111: return `https://etherscan-api-sepolia.ens-cf.workers.dev/accountHistory?address=${address}` default: diff --git a/src/utils/query/wagmi.ts b/src/utils/query/wagmi.ts index e738ded6a..e57035fc8 100644 --- a/src/utils/query/wagmi.ts +++ b/src/utils/query/wagmi.ts @@ -1,11 +1,10 @@ import { createClient, type FallbackTransport, type HttpTransport, type Transport } from 'viem' import { createConfig, createStorage, fallback, http } from 'wagmi' -import { goerli, holesky, localhost, mainnet, sepolia } from 'wagmi/chains' +import { holesky, localhost, mainnet, sepolia } from 'wagmi/chains' import { ccipRequest } from '@ensdomains/ensjs/utils' import { - goerliWithEns, holeskyWithEns, localhostWithEns, mainnetWithEns, @@ -83,7 +82,6 @@ const localStorageWithInvertMiddleware = (): Storage | undefined => { const chains = [ ...(isLocalProvider ? ([localhostWithEns] as const) : ([] as const)), mainnetWithEns, - goerliWithEns, sepoliaWithEns, holeskyWithEns, ] as const