|
|
@ -1,4 +1,4 @@ |
|
|
|
import React, { useState } from "react" |
|
|
|
import React, { useRef, useState } from "react" |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
PluginClient, |
|
|
|
PluginClient, |
|
|
@ -30,6 +30,7 @@ export const VerifyView: React.FC<Props> = ({ |
|
|
|
onVerifiedContract, |
|
|
|
onVerifiedContract, |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const [results, setResults] = useState("") |
|
|
|
const [results, setResults] = useState("") |
|
|
|
|
|
|
|
const verificationResult = useRef({}) |
|
|
|
|
|
|
|
|
|
|
|
const onVerifyContract = async (values: FormValues) => { |
|
|
|
const onVerifyContract = async (values: FormValues) => { |
|
|
|
const compilationResult = (await client.call( |
|
|
|
const compilationResult = (await client.call( |
|
|
@ -43,7 +44,7 @@ export const VerifyView: React.FC<Props> = ({ |
|
|
|
|
|
|
|
|
|
|
|
const contractArguments = values.contractArguments.replace("0x", "")
|
|
|
|
const contractArguments = values.contractArguments.replace("0x", "")
|
|
|
|
|
|
|
|
|
|
|
|
const verificationResult = await verify( |
|
|
|
verificationResult.current = await verify( |
|
|
|
apiKey, |
|
|
|
apiKey, |
|
|
|
values.contractAddress, |
|
|
|
values.contractAddress, |
|
|
|
contractArguments, |
|
|
|
contractArguments, |
|
|
@ -53,8 +54,7 @@ export const VerifyView: React.FC<Props> = ({ |
|
|
|
onVerifiedContract, |
|
|
|
onVerifiedContract, |
|
|
|
setResults, |
|
|
|
setResults, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
setResults(verificationResult.current['message']) |
|
|
|
setResults(verificationResult.message) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
@ -139,7 +139,7 @@ export const VerifyView: React.FC<Props> = ({ |
|
|
|
} |
|
|
|
} |
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
name="contractAddress" |
|
|
|
name="contractAddress" |
|
|
|
placeholder="e.g; 0x11b79afc03baf25c631dd70169bb6a3160b2706e" |
|
|
|
placeholder="e.g. 0x11b79afc03baf25c631dd70169bb6a3160b2706e" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<ErrorMessage |
|
|
|
<ErrorMessage |
|
|
|
className="invalid-feedback" |
|
|
|
className="invalid-feedback" |
|
|
@ -178,7 +178,7 @@ export const VerifyView: React.FC<Props> = ({ |
|
|
|
</Formik> |
|
|
|
</Formik> |
|
|
|
|
|
|
|
|
|
|
|
<div data-id="verify-result" |
|
|
|
<div data-id="verify-result" |
|
|
|
style={{ marginTop: "2em", fontSize: "0.8em", textAlign: "center" }} |
|
|
|
style={{ marginTop: "2em", fontSize: "0.8em", textAlign: "center", color: verificationResult.current['succeed'] ? "green" : "red" }} |
|
|
|
dangerouslySetInnerHTML={{ __html: results }} |
|
|
|
dangerouslySetInnerHTML={{ __html: results }} |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|