Skip to content

Commit

Permalink
confirm attestation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed May 24, 2024
1 parent 1aad327 commit 0ed9826
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const RegistrationForm = ({ toggleRegScreen, setRegistrationData }) => {
const signer = useSigner();
const { chain } = useNetwork();
const [showEASRegisterDialog, setShowEASRegisterDialog] = useState(false);
const [attestationUID, setAttestationUID] = useState(null)
const [attestationURL, setAttestationURL] = useState("");
const [easNetworkID, setEasNetworkID] = useState(1);
const onChangeEASNetworkID = (e) => {
Expand Down Expand Up @@ -431,7 +432,7 @@ const RegistrationForm = ({ toggleRegScreen, setRegistrationData }) => {
eas.connect(signer);

// Performing attestation
const attestation = await eas.attest({
const attestationTx = await eas.attest({
schema: schemaUid,
data: {
recipient: address,
Expand All @@ -444,8 +445,18 @@ const RegistrationForm = ({ toggleRegScreen, setRegistrationData }) => {
},
});

setAttestationURL(`${easscanURL}/${schemaUid}`);
setShowEASRegisterDialog(true);
// Get new attestation UID

const newAttestationUID = await attestationTx.wait();
const attestationTxResponse = await attestationTx.tx();

if (newAttestationUID && attestationTxResponse) {
setAttestationURL(`${easscanURL}/${schemaUid}`);
setAttestationUID(newAttestationUID)
setShowEASRegisterDialog(true);
}


} catch (e) {
console.error("Attest error:", e);
setErrors([`${e.message || e.toString()}`]);
Expand Down Expand Up @@ -915,6 +926,10 @@ const RegistrationForm = ({ toggleRegScreen, setRegistrationData }) => {
<p style={{ fontSize: "15px" }}>
<strong>Congratulations, DAO registered.</strong>
</p>
<p style={{ fontSize: "18px" }}>
<strong>{attestationUID} Attestation Confirmed</strong>
</p>

</div>
<div
style={{
Expand Down

0 comments on commit 0ed9826

Please sign in to comment.