Skip to content

Commit

Permalink
Added ipfsMetadataHash
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmardefago committed Feb 23, 2022
1 parent 05dfa3e commit e75999b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ type Subgraph @entity {
# Metadata from IPFS linked in GNS
"Subgraph metadata"
metadataHash: Bytes!
"Subgraph metadata ipfs hash"
ipfsMetadataHash: String
"Short description of the subgraph"
description: String
"Image in string format"
Expand Down
2 changes: 2 additions & 0 deletions src/mappings/gns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export function handleSubgraphMetadataUpdated(event: SubgraphMetadataUpdated): v
let base58Hash = hexHash.toBase58()

subgraph.metadataHash = event.params.subgraphMetadata
subgraph.ipfsMetadataHash = addQm(subgraph.metadataHash).toBase58()
subgraph = fetchSubgraphMetadata(subgraph, base58Hash)
subgraph.updatedAt = event.block.timestamp.toI32()
subgraph.save()
Expand Down Expand Up @@ -829,6 +830,7 @@ export function handleSubgraphMetadataUpdatedV2(event: SubgraphMetadataUpdated1)
let base58Hash = hexHash.toBase58()

subgraph.metadataHash = event.params.subgraphMetadata
subgraph.ipfsMetadataHash = addQm(subgraph.metadataHash).toBase58()
subgraph = fetchSubgraphMetadata(subgraph, base58Hash)
subgraph.updatedAt = event.block.timestamp.toI32()
subgraph.save()
Expand Down
1 change: 1 addition & 0 deletions src/mappings/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ export function duplicateOrUpdateSubgraphWithNewID(entity: Subgraph, newID: Stri
subgraph.withdrawnTokens = entity.withdrawnTokens
subgraph.nameSignalCount = entity.nameSignalCount
subgraph.metadataHash = entity.metadataHash
subgraph.ipfsMetadataHash = entity.ipfsMetadataHash
subgraph.description = entity.description
subgraph.image = entity.image
subgraph.codeRepository = entity.codeRepository
Expand Down

0 comments on commit e75999b

Please sign in to comment.