From ce2a42946d3d27e51fef8bac0670ce5db7670772 Mon Sep 17 00:00:00 2001 From: ollie <67156692+0xEillo@users.noreply.github.com> Date: Wed, 27 Sep 2023 10:37:47 +0100 Subject: [PATCH] feat: add attestations field to portal entity --- subgraph/schema.graphql | 57 ++++++++++++++-------------- subgraph/src/attestation-registry.ts | 2 +- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index ba4e6e18..5357a466 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -1,39 +1,40 @@ type Attestation @entity { - id: ID! - schemaId: Bytes! - replacedBy: Bytes! - attester: Bytes! - portal: Bytes! - attestedDate: BigInt! - expirationDate: BigInt! - revocationDate: BigInt! - version: BigInt! - revoked: Boolean! - subject: Bytes! - attestationData: Bytes! + id: ID! + schemaId: Bytes! + replacedBy: Bytes! + attester: Bytes! + portal: Portal! + attestedDate: BigInt! + expirationDate: BigInt! + revocationDate: BigInt! + version: BigInt! + revoked: Boolean! + subject: Bytes! + attestationData: Bytes! } type Module @entity { - id: ID! - moduleAddress: Bytes! - name: String! - description: String! + id: ID! + moduleAddress: Bytes! + name: String! + description: String! } type Portal @entity { - id: ID! - ownerAddress: Bytes! - modules: [Bytes!] - isRevocable: Boolean! - name: String! - description: String! - ownerName: String! + id: ID! + ownerAddress: Bytes! + modules: [Bytes!] + isRevocable: Boolean! + name: String! + description: String! + ownerName: String! + attestations: [Attestation!]! @derivedFrom(field: "portal") } type Schema @entity { - id: ID! - name: String! - description: String! - context: String! - schema: String! + id: ID! + name: String! + description: String! + context: String! + schema: String! } diff --git a/subgraph/src/attestation-registry.ts b/subgraph/src/attestation-registry.ts index 028ba275..9ae4b21d 100644 --- a/subgraph/src/attestation-registry.ts +++ b/subgraph/src/attestation-registry.ts @@ -13,7 +13,7 @@ export function handleAttestationRegistered(event: AttestationRegisteredEvent): attestation.schemaId = attestationData.schemaId; attestation.replacedBy = attestationData.replacedBy; attestation.attester = attestationData.attester; - attestation.portal = attestationData.portal; + attestation.portal = attestationData.portal.toHexString(); attestation.attestedDate = attestationData.attestedDate; attestation.expirationDate = attestationData.expirationDate; attestation.revocationDate = attestationData.revocationDate;