Skip to content

Commit

Permalink
feat: typo frontend explaantions + fix chain error
Browse files Browse the repository at this point in the history
  • Loading branch information
yum0e committed Jul 18, 2023
1 parent db5df13 commit d7fc038
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
23 changes: 10 additions & 13 deletions front/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@ const Header: React.FC = () => {
<a href="https://builders.sismo.io"> Join the Telegram Builders Group </a>
</h3>
<p>
1. The frontend requests ZK Proofs via Sismo Connect Button <br />
2. The user generates ZK Proofs in their Data Vault and sends the Sismo Connect response to
1. A contract is deployed with a Sismo Connect Configuration and a Sismo Connect Request <br />
2. The frontend queries the Sismo Connect Configuration and Request from the contract <br />
3. The frontend requests ZK Proofs via Sismo Connect Button <br />
4. The user generates ZK Proofs in their Data Vault and sends the Sismo Connect response to
the frontend <br />
3. The frontend forwards the response to ERC20 smart contract via claimWithSismo function{" "}
5. The frontend forwards the response to ERC20 smart contract via claimWithSismo function{" "}
<br />
4. The smart contract verifies the proofs contained in the response, mints ERC20 tokens and stores
6. The smart contract verifies the proofs contained in the response, mints ERC20 tokens and stores
verified claims and auths <br />
5. The frontend reads the verified claims and auths from the contract and displays them
7. The frontend reads the verified claims and auths from the contract and displays them
</p>
<div>
<p>
<b className="code-snippet">src/front/app/sismo-connect-config.ts</b>: Sismo Connect
configuration and requests
<b className="code-snippet">src/front/app/page.tsx</b>: Frontend - Queries contract to know Sismo Connect Configuration and Request, requests ZK Proofs from users via Sismo Connect Button
</p>
<p>
<b className="code-snippet">src/front/app/page.tsx</b>: Frontend - make Sismo Connect
request
</p>
<p>
<b className="code-snippet">src/Airdrop.sol</b>: Contract - verify Sismo Connect request,
mint tokens and stores verified claims and auths
<b className="code-snippet">src/Airdrop.sol</b>: Contract - Sets up the Sismo Connect Configuration and Request, verifies Sismo Connect response,
mints tokens and stores verified claims, auths and signed message
</p>
<p className="callout">
{" "}
Expand Down
8 changes: 6 additions & 2 deletions front/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export default function Home() {
// Get the SismoConnectConfig and Sismo Connect Request from the contract
// Set react state accordingly to display the Sismo Connect Button
useEffect(() => {
if (chain?.id !== CHAIN.id) {
setSismoConnectRequest(null);
return;
}
if (!isConnected) return;
async function getRequests() {
const appId = (await airdropContract.read.APP_ID()) as string;
Expand All @@ -123,12 +127,12 @@ export default function Home() {
});
}
getRequests();
}, [pageState]);
}, [pageState, chain]);

useEffect(() => {
setClaimError(error);
if (!responseBytes) return;
setPageState("responseReceived");
setClaimError(error);
}, [responseBytes, error, claimError]);

/* ************************* Reset state **************************** */
Expand Down

0 comments on commit d7fc038

Please sign in to comment.