Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zencephalon committed Feb 14, 2024
1 parent 5196b06 commit bd5f860
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/hooks/L1/useProveWithdrawalArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function useProveWithdrawalArgs({
throw new Error('L2 chain not configured')
}

const l2PublicClient = usePublicClient({ chainId: l2Chain.chainId })
const l2PublicClient = usePublicClient({ chainId: l2Chain.chainId })!

const { data: blockNumberOfLatestL2OutputProposal } = useBlockNumberOfLatestL2OutputProposal({
config: opConfig,
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/L1/useSimulateProveWithdrawalTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export function useSimulateProveWithdrawalTransaction<
}

const account = useAccount(rest)
const l1PublicClient = usePublicClient({ chainId: l2Chain.l1ChainId })
const l2PublicClient = usePublicClient({ chainId: l2ChainId })
const l1PublicClient = usePublicClient({ chainId: l2Chain.l1ChainId })!
const l2PublicClient = usePublicClient({ chainId: l2ChainId })!
const l1Addresses = opConfig.l2chains[l2ChainId].l1Addresses

const query = {
Expand Down Expand Up @@ -103,7 +103,8 @@ export function useSimulateProveWithdrawalTransaction<
}),
}

const enabled = Boolean(account.address) && (queryOverride?.enabled ?? true)
const enabled = Boolean(account.address) && (queryOverride?.enabled ?? true) && Boolean(l1PublicClient)
&& Boolean(l2PublicClient)
return {
...useQuery({ ...query, queryKeyHashFn: hashFn, enabled }),
queryKey: query.queryKey,
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/L1/useWriteDepositETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ async function writeMutation(
{ l1ChainId, l2ChainId, args, ...rest }: DepositETHMutationParameters,
) {
const walletClient = await getWalletClient(config, { chainId: l1ChainId })
const l1PublicClient = getPublicClient(config, { chainId: l1ChainId })
const l2PublicClient = getPublicClient(config, { chainId: l2ChainId })
const l1PublicClient = await getPublicClient(config, { chainId: l1ChainId })!
const l2PublicClient = await getPublicClient(config, { chainId: l2ChainId })!
const l1Addresses = config.l2chains[l2ChainId].l1Addresses

const l2GasLimit = args.gasLimit
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/L1/useWriteFinalizeWithdrawalTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ async function writeMutation(
{ l1ChainId, l2ChainId, args, ...rest }: FinalizeWithdrawalTransactionMutationParameters,
) {
const walletClient = await getWalletClient(config, { chainId: l1ChainId })
const l1PublicClient = getPublicClient(config, { chainId: l1ChainId })
const l2PublicClient = getPublicClient(config, { chainId: l2ChainId })
const l1PublicClient = await getPublicClient(config, { chainId: l1ChainId })!
const l2PublicClient = await getPublicClient(config, { chainId: l2ChainId })!
const l1Addresses = config.l2chains[l2ChainId].l1Addresses

const withdrawalMessages = await getWithdrawalMessages(l2PublicClient, {
Expand Down
4 changes: 2 additions & 2 deletions src/util/getStateTrieProof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export async function makeStateTrieProof(
}

export function useMakeStateTrieProof(
client: PublicClient,
client: PublicClient | undefined,
blockNumber: bigint | undefined,
address: `0x${string}`,
slot: `0x${string}` | undefined,
) {
const [proof, setProof] = useState<StateTrieProof | undefined>(undefined)

useEffect(() => {
if (!blockNumber || !slot) {
if (!blockNumber || !slot || !client) {
return undefined
}

Expand Down

0 comments on commit bd5f860

Please sign in to comment.