+
-
+
{children}
diff --git a/src/hooks/useAttestationCreation.ts b/src/hooks/useAttestationCreation.ts
index 6253373..c3afeba 100644
--- a/src/hooks/useAttestationCreation.ts
+++ b/src/hooks/useAttestationCreation.ts
@@ -13,26 +13,25 @@ export const THIRD_PARTY_ATTESTATION_SCHEMA =
"string publicKeyOrFingerprint, uint8 trustLevel, string metadata, uint256 timestamp";
export const SELF_ATTESTATION_SCHEMA_ENCODER = new SchemaEncoder(
- SELF_ATTESTATION_SCHEMA,
+ SELF_ATTESTATION_SCHEMA
);
export const THIRD_PARTY_ATTESTATION_SCHEMA_ENCODER = new SchemaEncoder(
- THIRD_PARTY_ATTESTATION_SCHEMA,
+ THIRD_PARTY_ATTESTATION_SCHEMA
);
export const SELF_ATTESTATION_SCHEMA_UID = keccak256(
encodePacked(
["string", "address", "bool"],
- [SELF_ATTESTATION_SCHEMA, zeroAddress, true],
- ),
+ [SELF_ATTESTATION_SCHEMA, zeroAddress, true]
+ )
);
export const THIRD_PARTY_ATTESTATION_SCHEMA_UID = keccak256(
encodePacked(
["string", "address", "bool"],
- [THIRD_PARTY_ATTESTATION_SCHEMA, zeroAddress, true],
- ),
+ [THIRD_PARTY_ATTESTATION_SCHEMA, zeroAddress, true]
+ )
);
-
export const useAttestationCreation = () => {
const { eas } = useEASConnection();
@@ -70,14 +69,14 @@ export const useAttestationCreation = () => {
return await tx.wait();
},
- [eas],
+ [eas]
);
const createThirdPartyAttestation = useCallback(
async (
publicKeyOrFingerprint: string,
trustLevel: number,
- metadata: string,
+ metadata: string
): Promise => {
if (!eas) throw new Error("EAS not initialized");
@@ -110,7 +109,7 @@ export const useAttestationCreation = () => {
return await tx.wait();
},
- [eas],
+ [eas]
);
return { createSelfAttestation, createThirdPartyAttestation };
diff --git a/src/lib/graphql/queries.ts b/src/lib/graphql/queries.ts
index 061be9b..eb48a28 100644
--- a/src/lib/graphql/queries.ts
+++ b/src/lib/graphql/queries.ts
@@ -1,8 +1,22 @@
+import {
+ SELF_ATTESTATION_SCHEMA_UID,
+ THIRD_PARTY_ATTESTATION_SCHEMA_UID,
+} from "@/hooks/useAttestationCreation";
import { gql } from "urql";
export const ATTESTATIONS_FOR_SPECIFIC_ATTESTER = gql`
query AttestationsForSpecificAttester($attester: String!) {
- attestations(where: { attester: { equals: $attester } }) {
+ attestations(
+ where: {
+ attester: { equals: $attester }
+ schemaId: {
+ in: [
+ "${THIRD_PARTY_ATTESTATION_SCHEMA_UID}"
+ "${SELF_ATTESTATION_SCHEMA_UID}"
+ ]
+ }
+ }
+ ) {
id
attester
recipient
@@ -21,9 +35,14 @@ export const ATTESTATIONS_FOR_SPECIFIC_KEY = gql`
query ($publicKeyOrFingerprintOrUid: String!) {
selfAttestations: attestations(
where: {
- OR: [
- { id: { equals: $publicKeyOrFingerprintOrUid } }
- { decodedDataJson: { contains: $publicKeyOrFingerprintOrUid } }
+ AND: [
+ { schemaId: { equals: "${SELF_ATTESTATION_SCHEMA_UID}" } }
+ {
+ OR: [
+ { id: { equals: $publicKeyOrFingerprintOrUid } }
+ { decodedDataJson: { contains: $publicKeyOrFingerprintOrUid } }
+ ]
+ }
]
}
) {
@@ -35,9 +54,14 @@ export const ATTESTATIONS_FOR_SPECIFIC_KEY = gql`
}
thirdPartyAttestations: attestations(
where: {
- OR: [
- { id: { equals: $publicKeyOrFingerprintOrUid } }
- { decodedDataJson: { contains: $publicKeyOrFingerprintOrUid } }
+ AND: [
+ { schemaId: { equals: "${THIRD_PARTY_ATTESTATION_SCHEMA_UID}" } }
+ {
+ OR: [
+ { id: { equals: $publicKeyOrFingerprintOrUid } }
+ { decodedDataJson: { contains: $publicKeyOrFingerprintOrUid } }
+ ]
+ }
]
}
orderBy: { timeCreated: desc }