Skip to content

Commit

Permalink
skip cloudfareurl in transports
Browse files Browse the repository at this point in the history
  • Loading branch information
sugh01 committed Sep 3, 2024
1 parent e1a85a1 commit f05a951
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 38 deletions.
1 change: 0 additions & 1 deletion e2e/specs/stateful/dnsclaim.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion e2e/specs/stateful/moonpay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/components/@molecules/FaucetBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
8 changes: 5 additions & 3 deletions src/components/TestnetWarning.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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(<TestnetWarning />)

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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,6 @@ const Registration = ({ nameDetails, isLoading }: Props) => {
<Typography fontVariant="bodyBold" color="grey">
{t('steps.info.moonpayModalHeader')}
</Typography>
{chainId === 5 && (
<Typography fontVariant="body" color="grey">
{`${t('steps.info.moonpayTestCard')}: 4000 0209 5159 5032, 12/2030, 123`}
</Typography>
)}
</MoonPayHeader>
<MoonPayIFrame
title="Moonpay Checkout"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ vi.mock('@app/hooks/useRegistrationData', () => ({
}))

vi.mock('@app/hooks/chain/useChainName', () => ({
useChainName: () => 'goerli',
useChainName: () => 'holesky',
}))

beforeEach(() => {
Expand Down
5 changes: 1 addition & 4 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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,
Expand All @@ -42,7 +40,6 @@ export const getSupportedChainById = (chainId: number | undefined) =>

export type SupportedChain =
| typeof mainnetWithEns
| typeof goerliWithEns
| typeof sepoliaWithEns
| typeof holeskyWithEns
| typeof localhostWithEns
6 changes: 3 additions & 3 deletions src/constants/resolverAddressData.test.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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' }),
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAvatarFromRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
}
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useEthPrice.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFaucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
9 changes: 0 additions & 9 deletions src/utils/SyncProvider/SyncDroppedTransaction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/utils/SyncProvider/SyncDroppedTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions src/utils/query/wagmi.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -83,7 +82,6 @@ const localStorageWithInvertMiddleware = (): Storage | undefined => {
const chains = [
...(isLocalProvider ? ([localhostWithEns] as const) : ([] as const)),
mainnetWithEns,
goerliWithEns,
sepoliaWithEns,
holeskyWithEns,
] as const
Expand Down

0 comments on commit f05a951

Please sign in to comment.