diff --git a/package-lock.json b/package-lock.json
index 1fe4ac6..7baff60 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -23,6 +23,8 @@
"@tanstack/react-query-devtools": "^5.50.1",
"axios": "^1.7.2",
"ethers": "^6.13.2",
+ "graphql": "^16.9.0",
+ "graphql-request": "^7.1.0",
"jwt-decode": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -3912,6 +3914,15 @@
"resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-5.0.13.tgz",
"integrity": "sha512-j61DHjsdUCKMXSdNLTOxcG701FWnF0jcqNNQi2iPCDxU8seN/sMxeh62dC++UiagCWq9ghTypX+Pcy7kX+QOeQ=="
},
+ "node_modules/@graphql-typed-document-node/core": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz",
+ "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==",
+ "license": "MIT",
+ "peerDependencies": {
+ "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
+ }
+ },
"node_modules/@hapi/hoek": {
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
@@ -7281,6 +7292,85 @@
"uuid": "dist/bin/uuid"
}
},
+ "node_modules/@molt/command": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/@molt/command/-/command-0.9.0.tgz",
+ "integrity": "sha512-1JI8dAlpqlZoXyKWVQggX7geFNPxBpocHIXQCsnxDjKy+3WX4SGyZVJXuLlqRRrX7FmQCuuMAfx642ovXmPA9g==",
+ "license": "MIT",
+ "dependencies": {
+ "@molt/types": "0.2.0",
+ "alge": "0.8.1",
+ "chalk": "^5.3.0",
+ "lodash.camelcase": "^4.3.0",
+ "lodash.snakecase": "^4.1.1",
+ "readline-sync": "^1.4.10",
+ "string-length": "^6.0.0",
+ "strip-ansi": "^7.1.0",
+ "ts-toolbelt": "^9.6.0",
+ "type-fest": "^4.3.1",
+ "zod": "^3.22.2"
+ }
+ },
+ "node_modules/@molt/command/node_modules/ansi-regex": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
+ "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/@molt/command/node_modules/chalk": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
+ "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@molt/command/node_modules/strip-ansi": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
+ "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/@molt/command/node_modules/type-fest": {
+ "version": "4.25.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.25.0.tgz",
+ "integrity": "sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==",
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@molt/types": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/@molt/types/-/types-0.2.0.tgz",
+ "integrity": "sha512-p6ChnEZDGjg9PYPec9BK6Yp5/DdSrYQvXTBAtgrnqX6N36cZy37ql1c8Tc5LclfIYBNG7EZp8NBcRTYJwyi84g==",
+ "license": "MIT",
+ "dependencies": {
+ "ts-toolbelt": "^9.6.0"
+ }
+ },
"node_modules/@motionone/animation": {
"version": "10.18.0",
"resolved": "https://registry.npmjs.org/@motionone/animation/-/animation-10.18.0.tgz",
@@ -13012,6 +13102,18 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
+ "node_modules/alge": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/alge/-/alge-0.8.1.tgz",
+ "integrity": "sha512-kiV9nTt+XIauAXsowVygDxMZLplZxDWt0W8plE/nB32/V2ziM/P/TxDbSVK7FYIUt2Xo16h3/htDh199LNPCKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "lodash.ismatch": "^4.4.0",
+ "remeda": "^1.0.0",
+ "ts-toolbelt": "^9.6.0",
+ "zod": "^3.17.3"
+ }
+ },
"node_modules/anser": {
"version": "1.4.10",
"resolved": "https://registry.npmjs.org/anser/-/anser-1.4.10.tgz",
@@ -17862,6 +17964,46 @@
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
"dev": true
},
+ "node_modules/graphql": {
+ "version": "16.9.0",
+ "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz",
+ "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==",
+ "license": "MIT",
+ "engines": {
+ "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
+ }
+ },
+ "node_modules/graphql-request": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-7.1.0.tgz",
+ "integrity": "sha512-Ouu/lYVFhARS1aXeZoVJWnGT6grFJXTLwXJuK4mUGGRo0EUk1JkyYp43mdGmRgUVezpRm6V5Sq3t8jBDQcajng==",
+ "license": "MIT",
+ "dependencies": {
+ "@graphql-typed-document-node/core": "^3.2.0",
+ "@molt/command": "^0.9.0",
+ "zod": "^3.23.8"
+ },
+ "bin": {
+ "graffle": "build/cli/generate.js"
+ },
+ "peerDependencies": {
+ "@dprint/formatter": "^0.3.0",
+ "@dprint/typescript": "^0.91.1",
+ "dprint": "^0.46.2",
+ "graphql": "14 - 16"
+ },
+ "peerDependenciesMeta": {
+ "@dprint/formatter": {
+ "optional": true
+ },
+ "@dprint/typescript": {
+ "optional": true
+ },
+ "dprint": {
+ "optional": true
+ }
+ }
+ },
"node_modules/h3": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/h3/-/h3-1.12.0.tgz",
@@ -20601,6 +20743,12 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
+ "license": "MIT"
+ },
"node_modules/lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
@@ -20614,12 +20762,24 @@
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
"license": "MIT"
},
+ "node_modules/lodash.ismatch": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz",
+ "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==",
+ "license": "MIT"
+ },
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
"dev": true
},
+ "node_modules/lodash.snakecase": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
+ "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==",
+ "license": "MIT"
+ },
"node_modules/lodash.throttle": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
@@ -24157,6 +24317,15 @@
"license": "BSD",
"peer": true
},
+ "node_modules/readline-sync": {
+ "version": "1.4.10",
+ "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz",
+ "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/readonly-date": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz",
@@ -24325,6 +24494,12 @@
"jsesc": "bin/jsesc"
}
},
+ "node_modules/remeda": {
+ "version": "1.61.0",
+ "resolved": "https://registry.npmjs.org/remeda/-/remeda-1.61.0.tgz",
+ "integrity": "sha512-caKfSz9rDeSKBQQnlJnVW3mbVdFgxgGWQKq1XlFokqjf+hQD5gxutLGTTY2A/x24UxVyJe9gH5fAkFI63ULw4A==",
+ "license": "MIT"
+ },
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -25472,6 +25647,48 @@
"node": ">=0.6.19"
}
},
+ "node_modules/string-length": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/string-length/-/string-length-6.0.0.tgz",
+ "integrity": "sha512-1U361pxZHEQ+FeSjzqRpV+cu2vTzYeWeafXFLykiFlv4Vc0n3njgU8HrMbyik5uwm77naWMuVG8fhEF+Ovb1Kg==",
+ "license": "MIT",
+ "dependencies": {
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/string-length/node_modules/ansi-regex": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
+ "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/string-length/node_modules/strip-ansi": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
+ "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
"node_modules/string-width": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
@@ -26187,6 +26404,12 @@
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
"dev": true
},
+ "node_modules/ts-toolbelt": {
+ "version": "9.6.0",
+ "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz",
+ "integrity": "sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==",
+ "license": "Apache-2.0"
+ },
"node_modules/tsconfig-paths": {
"version": "3.15.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
diff --git a/package.json b/package.json
index b962868..e3a5fcd 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,8 @@
"@tanstack/react-query-devtools": "^5.50.1",
"axios": "^1.7.2",
"ethers": "^6.13.2",
+ "graphql": "^16.9.0",
+ "graphql-request": "^7.1.0",
"jwt-decode": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
diff --git a/src/pages/Identifiers/Identifiers.tsx b/src/pages/Identifiers/Identifiers.tsx
index a008c63..9e1b053 100644
--- a/src/pages/Identifiers/Identifiers.tsx
+++ b/src/pages/Identifiers/Identifiers.tsx
@@ -10,24 +10,23 @@ import {
Paper,
Box,
Avatar,
+ CircularProgress,
} from '@mui/material';
import VerifiedIcon from '@mui/icons-material/Verified';
import { FaDiscord, FaGoogle } from 'react-icons/fa';
import { useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
-import {
- decryptAttestation,
- getAttestation,
- getAttestationIds,
- getAttestations,
- getAttestationsData,
- hasActiveRevocationTime,
- IAttestation,
-} from '../../libs/oci';
+import { decryptAttestation, getAttestations } from '../../libs/oci';
import { useAccount } from 'wagmi';
import useLit from '../../hooks/LitProvider';
import useSessionSigs from '../../hooks/useSessionSigs';
import { useSigner } from '../../utils/eas-wagmi-utils';
+import { GraphQLClient, gql } from 'graphql-request';
+import { useQuery } from '@tanstack/react-query';
+import {
+ SchemaDecodedItem,
+ SchemaEncoder,
+} from '@ethereum-attestation-service/eas-sdk';
const identifiers = [
{ name: 'Discord', icon: FaDiscord, verified: false, color: 'text-blue-500' },
@@ -35,6 +34,71 @@ const identifiers = [
];
export function Identifiers() {
+ const graphQLClient = new GraphQLClient(
+ 'https://sepolia.easscan.org/graphql'
+ );
+
+ const SCHEMA_TYPES = 'bytes32 key, string provider, string secret';
+
+ const decodettestationData = (data: string): SchemaDecodedItem[] => {
+ const schemaEncoder = new SchemaEncoder(SCHEMA_TYPES);
+ return schemaEncoder.decodeData(data);
+ };
+
+ const useGetAttestations = () => {
+ return useQuery({
+ queryKey: ['getAttestations'],
+ queryFn: async () => {
+ const result = await graphQLClient.request(gql`
+ query Attestations {
+ attestations(
+ where: {
+ attester: {
+ equals: "0x2d7B3e18D45846DA09D78e3644F15BD4aafa634d"
+ }
+ recipient: {
+ equals: "0x026B727b60D336806B87d60e95B6d7FAd2443dD6"
+ }
+ revoked: { equals: false }
+ schemaId: {
+ equals: "0x85e90e3e16d319578888790af3284fea8bca549305071531e7478e3e0b5e7d6d"
+ }
+ }
+ ) {
+ id
+ attester
+ recipient
+ refUID
+ revocable
+ revocationTime
+ expirationTime
+ data
+ }
+ }
+ `);
+
+ // Decode each attestation's data and log it
+ result.attestations.forEach((attestation: any) => {
+ const decodedData = decodettestationData(attestation.data);
+ console.log({ decodedData });
+ });
+
+ // If you want to return decoded data, you can do something like this:
+ const decodedAttestations =
+ result &&
+ result.attestations.map((attestation: any) => ({
+ ...attestation,
+ decodedData: decodettestationData(attestation.data),
+ }));
+
+ return decodedAttestations; // or return result.attestations if you don't need the decoded data in the result
+ },
+ });
+ };
+
+ const { data, isLoading, error } = useGetAttestations();
+ console.log({ data });
+
const { litNodeClient } = useLit();
const { chainId } = useAccount();
const { sessionSigs, createSessionSigs } = useSessionSigs();
@@ -77,7 +141,7 @@ export function Identifiers() {
const attestations = await fetchAttestations();
- const decryptedSecrets = Promise.all(
+ const decryptedSecrets = await Promise.all(
attestations.map(async (attestation) => {
return decryptAttestation(litNodeClient, attestation, sessionSigs);
})
@@ -93,61 +157,67 @@ export function Identifiers() {
Identifiers
-
-
-
-
-
- Actions
-
-
-
-
- {identifiers.map((identifier, index) => (
-
-
-
-
- }
+ {error && (
+ Failed to load attestations
+ )}
+ {!isLoading && !error && (
+
+
+
+
+
+ Actions
+
+
+
+
+ {identifiers.map((identifier, index) => (
+
+
+
+
+
+
+
+ {identifier.verified && (
+
+ )}
+ {identifier.name}
+
+ }
+ style={{ marginLeft: 16 }}
/>
-
-
- {identifier.verified && (
-
- )}
- {identifier.name}
-
- }
- style={{ marginLeft: 16 }}
- />
-
- {identifier.verified ? (
-
- ) : (
-
- )}
-
-
-
-
- ))}
-
+
+ {identifier.verified ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ ))}
+
+ )}
);
}