From 9317bd4f420837a2d62e7fefa611c591c249ff08 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 17 Apr 2023 14:38:29 +0530 Subject: [PATCH] update network on change --- apps/etherscan/src/app/views/VerifyView.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx index 1e01357608..44e1feb9da 100644 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ b/apps/etherscan/src/app/views/VerifyView.tsx @@ -82,10 +82,11 @@ export const VerifyView: React.FC = ({ onSubmit={(values) => onVerifyContract(values)} > {({ errors, touched, handleSubmit, isSubmitting }) => { - if (client && client.call) client.call("network", "detectNetwork").then((network) => { - if (network && network['name']) setNetworkName(network['name']) - }) - + if (client) { + client.on("blockchain" as any, 'networkStatus', (result) => { + setNetworkName(result.network.name) + }) + } return (
Verify your smart contracts
@@ -95,6 +96,7 @@ export const VerifyView: React.FC = ({ type="text" name="network" value={networkName} + disabled={true} />