Skip to content

Commit

Permalink
fix: ens-app build linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Julink-eth committed Apr 18, 2024
1 parent f8dd562 commit e9c6f13
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,47 +97,6 @@ const SubtitleWithGradient = styled(Typography)(
`,
)

const nameRegisteredSnippet = [
{
anonymous: false,
inputs: [
{
indexed: false,
name: 'name',
type: 'string',
},
{
indexed: true,
name: 'label',
type: 'bytes32',
},
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: false,
name: 'baseCost',
type: 'uint256',
},
{
indexed: false,
name: 'premium',
type: 'uint256',
},
{
indexed: false,
name: 'expires',
type: 'uint256',
},
],
name: 'NameRegistered',
type: 'event',
},
] as const

const Confetti = dynamic(() =>
import('react-confetti').then((mod) => mod.default as typeof ConfettiT),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const Registration = ({ nameDetails, isLoading }: Props) => {
const commitKey = `commit-${keySuffix}`
const registerKey = `register-${keySuffix}`

const pohSignature = address ? usePohSignature(address) : undefined
const pohSignature = usePohSignature(address)

const { cleanupFlow } = useTransactionFlow()

Expand Down Expand Up @@ -283,7 +283,6 @@ const Registration = ({ nameDetails, isLoading }: Props) => {
),
info: (
<PohInfo
name={normalisedName}
registrationData={item}
callback={genericCallback}
onProfileClick={infoProfileCallback}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import { Card } from '@app/components/Card'
import { ConnectButton } from '@app/components/ConnectButton'
import { useAccountSafely } from '@app/hooks/account/useAccountSafely'
import { useContractAddress } from '@app/hooks/chain/useContractAddress'
import { useEstimateFullRegistration } from '@app/hooks/gasEstimation/useEstimateRegistration'
import { useEstimateFullRegistrationPoh } from '@app/hooks/gasEstimation/useEstimateRegistrationPoh'
import { usePohRegistered } from '@app/hooks/usePohRegistered'
import { usePohSignature } from '@app/hooks/usePohStatus'

import { PaymentMethod, RegistrationReducerDataItem, RegistrationStepData } from '../../types'

Expand Down Expand Up @@ -154,15 +152,10 @@ const PohCheck = ({
const resolverAddress = useContractAddress({ contract: 'ensPublicResolver' })

const [years, setYears] = useState(registrationData.years)
const [reverseRecord, setReverseRecord] = useState(() =>
const [reverseRecord] = useState(() =>
registrationData.started ? registrationData.reverseRecord : !hasPrimaryName,
)

let pohAlreadyRegistered
if (address) {
const { data: pohAlreadyRegisteredData } = usePohRegistered(address)
pohAlreadyRegistered = pohAlreadyRegisteredData
}
const { data: pohAlreadyRegistered } = usePohRegistered(address)

const fullEstimate = useEstimateFullRegistrationPoh({
name,
Expand Down Expand Up @@ -198,7 +191,7 @@ const PohCheck = ({
{!pohSignature && (
<GetPoh>
{t('steps.pohCheck.getPoh')}{' '}
<Link href={'https://poh.linea.build/'} target="_blank">
<Link href="https://poh.linea.build/" target="_blank">
{t('steps.pohCheck.getPohHereLink')}
</Link>
</GetPoh>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const infoItemArr = Array.from({ length: 3 }, (_, i) => `steps.info.ethItems.${i

type Props = {
registrationData: RegistrationReducerDataItem
name: string
callback: (data: { back: boolean }) => void
onProfileClick: () => void
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ens-app-v3/src/hooks/usePohRegistered.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Address } from 'viem'
import { Address, zeroAddress } from 'viem'
import { useReadContract } from 'wagmi'

import { useContractAddress } from './chain/useContractAddress'

export const usePohRegistered = (address: Address) => {
export const usePohRegistered = (address: Address | undefined) => {
const ethRegistrarControllerAddress = useContractAddress({
contract: 'ensEthRegistrarController',
})
Expand All @@ -19,7 +19,7 @@ export const usePohRegistered = (address: Address) => {
},
],
address: ethRegistrarControllerAddress,
args: [address],
args: [address || zeroAddress],
functionName: 'hasRegisteredPoh',
})
}
4 changes: 2 additions & 2 deletions packages/ens-app-v3/src/hooks/usePohStatus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'react'
import { Address, Hex } from 'viem'

export const usePohSignature = (address: Address): Hex | undefined => {
export const usePohSignature = (address: Address | undefined): Hex | undefined => {
const [signature, setSignature] = useState<string | undefined>(undefined)
useMemo(async () => {
const pohSignatureApi = process.env.NEXT_PUBLIC_POH_SIGNATURE_API
Expand All @@ -12,7 +12,7 @@ export const usePohSignature = (address: Address): Hex | undefined => {
})
const respResult = resp.ok ? await resp.text() : undefined
setSignature(respResult)
}, [])
}, [address])

return signature ? (signature as `0x${string}`) : undefined
}
2 changes: 1 addition & 1 deletion packages/ens-app-v3/src/hooks/useRegistrationPohParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const useRegistrationPohParams = ({ name, owner, registrationData, pohSignature
reverseRecord: registrationData.reverseRecord,
signature: pohSignature,
}),
[owner, name, registrationData],
[owner, name, registrationData, pohSignature],
)

return registrationParams
Expand Down

0 comments on commit e9c6f13

Please sign in to comment.