Skip to content

Commit

Permalink
fix: type issues when multiple contracts deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
sverps committed Jul 6, 2023
1 parent 7d3e47b commit 5260f41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { AbiEvent, ExtractAbiEventNames } from "abitype";
import { Abi, AbiEvent, ExtractAbiEventNames } from "abitype";
import { Hash } from "viem";
import { usePublicClient } from "wagmi";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
Expand Down Expand Up @@ -42,7 +42,7 @@ export const useScaffoldEventHistory = <
throw new Error("Contract not found");
}

const event = deployedContractData.abi.find(
const event = (deployedContractData.abi as Abi).find(
part => part.type === "event" && part.name === eventName,
) as AbiEvent;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtractAbiEventNames } from "abitype";
import { Abi, ExtractAbiEventNames } from "abitype";
import { Log } from "viem";
import { useContractEvent } from "wagmi";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
Expand All @@ -24,7 +24,7 @@ export const useScaffoldEventSubscriber = <

return useContractEvent({
address: deployedContractData?.address,
abi: deployedContractData?.abi,
abi: deployedContractData?.abi as Abi,
chainId: getTargetNetwork().id,
listener: listener as (logs: Log[]) => void,
eventName,
Expand Down

0 comments on commit 5260f41

Please sign in to comment.