From 0c3ae66e61bc60d1bbad283e41b76fb272e9c1ad Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Tue, 18 Apr 2023 19:29:42 +0530 Subject: [PATCH] ask for constructor arguments conditionally --- apps/etherscan/src/app/views/VerifyView.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx index 44e1feb9da..1efbd6788a 100644 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ b/apps/etherscan/src/app/views/VerifyView.tsx @@ -31,6 +31,7 @@ export const VerifyView: React.FC = ({ }) => { const [results, setResults] = useState("") const [networkName, setNetworkName] = useState("") + const [showConstructorArgs, setShowConstructorArgs] = useState(false) const verificationResult = useRef({}) const onVerifyContract = async (values: FormValues) => { @@ -107,6 +108,11 @@ export const VerifyView: React.FC = ({ : "form-control form-control-sm" } name="contractName" + onChange={async (e) => { + const {artefact} = await client.call("compilerArtefacts" as any, "getArtefactsByContractName", e.target.value) + if(artefact && artefact.abi && artefact.abi[0].type && artefact.abi[0].type === 'constructor') setShowConstructorArgs(true) + else setShowConstructorArgs(false) + }} >