show selected network

pull/3565/head
Aniket-Engg 2 years ago committed by Aniket
parent 5132c5e1a7
commit fcbf008772
  1. 4
      apps/etherscan/src/app/utils/verify.ts
  2. 21
      apps/etherscan/src/app/views/VerifyView.tsx

@ -119,14 +119,14 @@ export const verify = async (
resetAfter10Seconds(client, setResults)
return returnValue
}
return {
return {
message: 'unknown reason ' + result,
succeed: false
}
} catch (error: any) {
console.error(error)
setResults("Something wrong happened, try again")
return {
return {
message: error.message,
succeed: false
}

@ -30,6 +30,7 @@ export const VerifyView: React.FC<Props> = ({
onVerifiedContract,
}) => {
const [results, setResults] = useState("")
const [networkName, setNetworkName] = useState("")
const verificationResult = useRef({})
const onVerifyContract = async (values: FormValues) => {
@ -43,7 +44,6 @@ export const VerifyView: React.FC<Props> = ({
}
const contractArguments = values.contractArguments.replace("0x", "")
verificationResult.current = await verify(
apiKey,
values.contractAddress,
@ -81,10 +81,21 @@ export const VerifyView: React.FC<Props> = ({
}}
onSubmit={(values) => onVerifyContract(values)}
>
{({ errors, touched, handleSubmit, isSubmitting }) => (
<form onSubmit={handleSubmit}>
{({ errors, touched, handleSubmit, isSubmitting }) => {
if (client && client.call) client.call("network", "detectNetwork").then((network) => {
if (network && network['name']) setNetworkName(network['name'])
})
return (<form onSubmit={handleSubmit}>
<h6>Verify your smart contracts</h6>
<div className="form-group">
<label htmlFor="network">Selected Network</label>
<Field
className="form-control form-control-sm"
type="text"
name="network"
value={networkName}
/>
<label htmlFor="contractName">Contract Name</label>
<Field
as="select"
@ -175,7 +186,9 @@ export const VerifyView: React.FC<Props> = ({
Generate Verification Scripts
</button>
</form>
)}
)
}
}
</Formik>
<div data-id="verify-result"

Loading…
Cancel
Save