diff --git a/packages/nextjs/app/debug/_components/contract/ContractReadMethods.tsx b/packages/nextjs/app/debug/_components/contract/ContractReadMethods.tsx index f40a1ee..2c4cefb 100644 --- a/packages/nextjs/app/debug/_components/contract/ContractReadMethods.tsx +++ b/packages/nextjs/app/debug/_components/contract/ContractReadMethods.tsx @@ -15,7 +15,7 @@ export const ContractReadMethods = ({ ); if (!functionsToDisplay.length) { - return <>No read methods; + return <>No view functions; } return ( diff --git a/packages/nextjs/app/debug/_components/contract/ContractUI.tsx b/packages/nextjs/app/debug/_components/contract/ContractUI.tsx index f579810..95605e0 100644 --- a/packages/nextjs/app/debug/_components/contract/ContractUI.tsx +++ b/packages/nextjs/app/debug/_components/contract/ContractUI.tsx @@ -60,11 +60,7 @@ export const ContractUI = ({ contractName, className = "" }: ContractUIProps) =>

)} -
- -
+
diff --git a/packages/nextjs/app/debug/_components/contract/ContractVariables.tsx b/packages/nextjs/app/debug/_components/contract/ContractVariables.tsx deleted file mode 100644 index 9f9548d..0000000 --- a/packages/nextjs/app/debug/_components/contract/ContractVariables.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { AbiFunction } from "abitype"; -import { Contract, ContractName } from "~~/utils/scaffold-move/contract"; - -export const ContractVariables = ({ - deployedContractData, -}: { - deployedContractData: Contract; -}) => { - if (!deployedContractData) { - return null; - } - // const functionsToDisplay = ( - // (deployedContractData.abi as Abi).filter(part => part.type === "function") as AbiFunction[] - // ) - // .filter(fn => { - // const isQueryableWithNoParams = - // (fn.stateMutability === "view" || fn.stateMutability === "pure") && fn.inputs.length === 0; - // return isQueryableWithNoParams; - // }) - // .map(fn => { - // return { - // fn, - // inheritedFrom: ((deployedContractData as GenericContract)?.inheritedFunctions as InheritedFunctions)?.[fn.name], - // }; - // }) - // .sort((a, b) => (b.inheritedFrom ? b.inheritedFrom.localeCompare(a.inheritedFrom) : 1)); - const functionsToDisplay = [] as AbiFunction[]; - if (!functionsToDisplay.length) { - return <>No contract variables; - } - return <>No contract variables; - // return ( - // <> - // {functionsToDisplay.map(({ fn, inheritedFrom }) => ( - // - // ))} - // - // ); -}; diff --git a/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx b/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx index ca959cc..c21bfb1 100644 --- a/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx +++ b/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx @@ -15,7 +15,7 @@ export const ContractWriteMethods = ({ ); if (!functionsToDisplay.length) { - return <>No write methods; + return <>No write functions; } return ( diff --git a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx b/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx deleted file mode 100644 index bf7fe3f..0000000 --- a/packages/nextjs/app/debug/_components/contract/DisplayVariable.tsx +++ /dev/null @@ -1,85 +0,0 @@ -"use client"; - -import { useEffect } from "react"; -import { InheritanceTooltip } from "./InheritanceTooltip"; -import { displayTxResult } from "./utilsDisplay"; -import { Abi, AbiFunction } from "abitype"; -import { Address } from "viem"; -import { useReadContract } from "wagmi"; -import { ArrowPathIcon } from "@heroicons/react/24/outline"; -import { useAnimationConfig } from "~~/hooks/scaffold-eth"; -import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; -import { getParsedError, notification } from "~~/utils/scaffold-eth"; - -type DisplayVariableProps = { - contractAddress: Address; - abiFunction: AbiFunction; - refreshDisplayVariables: boolean; - inheritedFrom?: string; - abi: Abi; -}; - -export const DisplayVariable = ({ - contractAddress, - abiFunction, - refreshDisplayVariables, - abi, - inheritedFrom, -}: DisplayVariableProps) => { - const { targetNetwork } = useTargetNetwork(); - - const { - data: result, - isFetching, - refetch, - error, - } = useReadContract({ - address: contractAddress, - functionName: abiFunction.name, - abi: abi, - chainId: targetNetwork.id, - query: { - retry: false, - }, - }); - - const { showAnimation } = useAnimationConfig(result); - - useEffect(() => { - refetch(); - }, [refetch, refreshDisplayVariables]); - - useEffect(() => { - if (error) { - const parsedError = getParsedError(error); - notification.error(parsedError); - } - }, [error]); - - return ( -
-
-

{abiFunction.name}

- - -
-
-
-
- {displayTxResult(result)} -
-
-
-
- ); -}; diff --git a/packages/nextjs/app/debug/_components/contract/InheritanceTooltip.tsx b/packages/nextjs/app/debug/_components/contract/InheritanceTooltip.tsx deleted file mode 100644 index 9825520..0000000 --- a/packages/nextjs/app/debug/_components/contract/InheritanceTooltip.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { InformationCircleIcon } from "@heroicons/react/20/solid"; - -export const InheritanceTooltip = ({ inheritedFrom }: { inheritedFrom?: string }) => ( - <> - {inheritedFrom && ( - - - )} - -); diff --git a/packages/nextjs/app/debug/_components/contract/index.tsx b/packages/nextjs/app/debug/_components/contract/index.tsx index 059863a..2d5b26b 100644 --- a/packages/nextjs/app/debug/_components/contract/index.tsx +++ b/packages/nextjs/app/debug/_components/contract/index.tsx @@ -1,6 +1,5 @@ export * from "./ContractInput"; export * from "./ContractUI"; -export * from "./DisplayVariable"; export * from "./TxReceipt"; export * from "./utilsContract"; export * from "./utilsDisplay";