diff --git a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts index 4a8de3b1d..16ad99783 100644 --- a/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts +++ b/packages/nextjs/hooks/scaffold-eth/useDeployedContractInfo.ts @@ -21,10 +21,10 @@ export const useDeployedContractInfo = ({ }: UseDeployedContractConfig) => { const isMounted = useIsMounted(); - const selectedChain = useAllowedChain(chainId as AllowedChainIds); - const deployedContract = contracts?.[selectedChain.id]?.[contractName as ContractName] as Contract; + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); + const deployedContract = contracts?.[selectedNetwork.id]?.[contractName as ContractName] as Contract; const [status, setStatus] = useState(ContractCodeStatus.LOADING); - const publicClient = usePublicClient({ chainId: selectedChain.id }); + const publicClient = usePublicClient({ chainId: selectedNetwork.id }); useEffect(() => { const checkContractDeployment = async () => { diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts index 38f797970..86b61f3d5 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldContract.ts @@ -25,13 +25,13 @@ export const useScaffoldContract = < walletClient?: TWalletClient | null; chainId?: AllowedChainIds; }) => { - const selectedChain = useAllowedChain(chainId as AllowedChainIds); + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); const { data: deployedContractData, isLoading: deployedContractLoading } = useDeployedContractInfo({ contractName, - chainId: selectedChain?.id as AllowedChainIds, + chainId: selectedNetwork?.id as AllowedChainIds, }); - const publicClient = usePublicClient({ chainId: selectedChain?.id }); + const publicClient = usePublicClient({ chainId: selectedNetwork?.id }); let contract = undefined; if (deployedContractData && publicClient) { diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts index d3bfa05b3..31187bd6b 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts @@ -83,18 +83,18 @@ export const useScaffoldEventHistory = < watch, enabled = true, }: UseScaffoldEventHistoryConfig) => { - const selectedChain = useAllowedChain(chainId as AllowedChainIds); + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); const publicClient = usePublicClient({ - chainId: selectedChain.id, + chainId: selectedNetwork.id, }); const [isFirstRender, setIsFirstRender] = useState(true); - const { data: blockNumber } = useBlockNumber({ watch: watch, chainId: selectedChain.id }); + const { data: blockNumber } = useBlockNumber({ watch: watch, chainId: selectedNetwork.id }); const { data: deployedContractData } = useDeployedContractInfo({ contractName, - chainId: selectedChain.id as AllowedChainIds, + chainId: selectedNetwork.id as AllowedChainIds, }); const event = @@ -111,7 +111,7 @@ export const useScaffoldEventHistory = < address: deployedContractData?.address, eventName, fromBlock: fromBlock.toString(), - chainId: selectedChain.id, + chainId: selectedNetwork.id, filters: JSON.stringify(filters, replacer), }, ], diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts index 6dde95e67..0a1665b52 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldReadContract.ts @@ -31,10 +31,10 @@ export const useScaffoldReadContract = < chainId, ...readConfig }: UseScaffoldReadConfig) => { - const selectedChain = useAllowedChain(chainId as AllowedChainIds); + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); const { data: deployedContract } = useDeployedContractInfo({ contractName, - chainId: selectedChain.id as AllowedChainIds, + chainId: selectedNetwork.id as AllowedChainIds, }); const { query: queryOptions, watch, ...readContractConfig } = readConfig; @@ -42,7 +42,7 @@ export const useScaffoldReadContract = < const defaultWatch = watch ?? true; const readContractHookRes = useReadContract({ - chainId: selectedChain.id, + chainId: selectedNetwork.id, functionName, address: deployedContract?.address, abi: deployedContract?.abi, @@ -62,7 +62,7 @@ export const useScaffoldReadContract = < const queryClient = useQueryClient(); const { data: blockNumber } = useBlockNumber({ watch: defaultWatch, - chainId: selectedChain.id, + chainId: selectedNetwork.id, query: { enabled: defaultWatch, }, diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts index 1219b473d..51b27e268 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWatchContractEvent.ts @@ -23,10 +23,10 @@ export const useScaffoldWatchContractEvent = < chainId, onLogs, }: UseScaffoldEventConfig) => { - const selectedChain = useAllowedChain(chainId as AllowedChainIds); + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); const { data: deployedContractData } = useDeployedContractInfo({ contractName, - chainId: selectedChain.id as AllowedChainIds, + chainId: selectedNetwork.id as AllowedChainIds, }); const addIndexedArgsToLogs = (logs: Log[]) => logs.map(addIndexedArgsToEvent); @@ -35,7 +35,7 @@ export const useScaffoldWatchContractEvent = < return useWatchContractEvent({ address: deployedContractData?.address, abi: deployedContractData?.abi as Abi, - chainId: selectedChain.id, + chainId: selectedNetwork.id, onLogs: listenerWithIndexedArgs, eventName, }); diff --git a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts index 083bb0414..3a1df1979 100644 --- a/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts +++ b/packages/nextjs/hooks/scaffold-eth/useScaffoldWriteContract.ts @@ -32,11 +32,11 @@ export const useScaffoldWriteContract = ({ const wagmiContractWrite = useWriteContract(writeContractParams); - const selectedChain = useAllowedChain(chainId as AllowedChainIds); + const selectedNetwork = useAllowedChain(chainId as AllowedChainIds); const { data: deployedContractData } = useDeployedContractInfo({ contractName, - chainId: selectedChain.id as AllowedChainIds, + chainId: selectedNetwork.id as AllowedChainIds, }); const sendContractWriteAsyncTx = async < @@ -55,7 +55,7 @@ export const useScaffoldWriteContract = ({ return; } - if (accountChain?.id !== selectedChain.id) { + if (accountChain?.id !== selectedNetwork.id) { notification.error("Your wallet is connected to the wrong network"); return; } @@ -105,7 +105,7 @@ export const useScaffoldWriteContract = ({ return; } - if (accountChain?.id !== selectedChain.id) { + if (accountChain?.id !== selectedNetwork.id) { notification.error("Your wallet is connected to the wrong network"); return; }