From 1f48a40d87728610e1530d37000dfe7b2c5d4656 Mon Sep 17 00:00:00 2001
From: jo-elimu <1451036+jo-elimu@users.noreply.github.com>
Date: Mon, 1 Jul 2024 13:14:50 +0700
Subject: [PATCH] feat(backend): add attestation handler
refs #34
---
frontend/src/components/Attestations.tsx | 96 +++++++++++++++++++
frontend/src/pages/_app.tsx | 3 +-
.../src/pages/distributions/[queueNumber].tsx | 9 ++
3 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 frontend/src/components/Attestations.tsx
diff --git a/frontend/src/components/Attestations.tsx b/frontend/src/components/Attestations.tsx
new file mode 100644
index 0000000..c2e10ea
--- /dev/null
+++ b/frontend/src/components/Attestations.tsx
@@ -0,0 +1,96 @@
+import { Address, Avatar, Badge, Identity, Name, getAttestations } from "@coinbase/onchainkit/identity";
+import { useEffect, useState } from "react";
+
+import { base, baseSepolia } from 'wagmi/chains'
+import LoadingIndicator from "./LoadingIndicator";
+import Link from "next/link";
+
+export default function Attestations({ queueIndex }: any) {
+ console.debug("Attestations");
+
+ console.debug("queueIndex:", queueIndex);
+
+ const [data, setData] = useState(null);
+
+ useEffect(() => {
+ fetch("https://base-sepolia.easscan.org/graphql", {
+ method: "POST",
+ headers: {
+ "content-type": "application/json"
+ },
+ body: JSON.stringify({
+ query: `
+ query AttestationsQuery {
+ attestations(where: {schemaId: {equals: "0x47ae9f9a75fc6f94927dfcabe6c68ecaad18b8e55db85911b91846017103387e"}}) {
+ id,
+ attester,
+ recipient,
+ time,
+ decodedDataJson
+ }
+ }
+ `
+ })
+ })
+ .then(response => response.json())
+ .then(result => {
+ console.debug("then");
+ console.debug("result.data:", result.data);
+ setData(result.data);
+ })
+ .catch(error => {
+ console.error("error:", error);
+ // TODO: Handle errors
+ });
+ }, []);
+
+ if (!data) {
+ return