Skip to content

Commit 8b49d17

Browse files
committed
fix: workaround query type issues if entity is named Metadata
1 parent 26464e6 commit 8b49d17

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

schema.graphql

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ type GraphAccount @entity {
247247
"Default display name is the current default name. Used for filtered queries in the explorer"
248248
defaultDisplayName: String
249249

250-
# IPFS Metadata.
251-
metadata: GraphAccountMetadata
250+
# IPFS Meta.
251+
metadata: GraphAccountMeta
252252

253253
# Operator info
254254
"Operator of other Graph Accounts"
@@ -301,7 +301,7 @@ type GraphAccount @entity {
301301
tokenLockWallets: [TokenLockWallet!]!
302302
}
303303

304-
type GraphAccountMetadata @entity(immutable:true) {
304+
type GraphAccountMeta @entity(immutable:true) {
305305
"IPFS hash with account metadata details"
306306
id: ID!
307307
"Account that reference this metadata file. For compatibility purposes. For the full list use graphAccounts"
@@ -433,17 +433,17 @@ type Subgraph @entity {
433433
"Total amount of NameSignal entities"
434434
nameSignalCount: Int!
435435

436-
# Metadata from IPFS linked in GNS
436+
# Meta from IPFS linked in GNS
437437
"Subgraph metadata"
438438
metadataHash: Bytes
439439
"Subgraph metadata ipfs hash and entity"
440-
metadata: SubgraphMetadata
440+
metadata: SubgraphMeta
441441

442442
# Auxiliary fields
443443
currentVersionRelationEntity: CurrentSubgraphDeploymentRelation
444444
}
445445

446-
type SubgraphMetadata @entity(immutable:true) {
446+
type SubgraphMeta @entity(immutable:true) {
447447
"Subgraph metadata ipfs hash"
448448
id: ID!
449449
"Subgraph that reference this metadata. For compatibility purposes. For the full list use subgraphs"
@@ -500,15 +500,15 @@ type SubgraphVersion @entity {
500500
createdAt: Int!
501501

502502
metadataHash: Bytes
503-
# Metadata from IPFS linked in GNS
504-
metadata: SubgraphVersionMetadata
503+
# Meta from IPFS linked in GNS
504+
metadata: SubgraphVersionMeta
505505

506506
entityVersion: Int!
507507
"[DEPRECATED] Used for duplicate entities to enable old IDs from before the subgraph NFT update"
508508
linkedEntity: SubgraphVersion
509509
}
510510

511-
type SubgraphVersionMetadata @entity(immutable:true) {
511+
type SubgraphVersionMeta @entity(immutable:true) {
512512
"Subgraph version metadata ipfs hash"
513513
id: ID!
514514
"SubgraphVersion entity that references this metadata. For compatibility purposes. For the full list use subgraphVersions"
@@ -654,7 +654,7 @@ type SubgraphDeploymentManifest @entity(immutable:true) {
654654
# }
655655

656656
"""
657-
Metadata for the Indexer along with parameters and staking data
657+
Meta for the Indexer along with parameters and staking data
658658
"""
659659
type Indexer @entity {
660660
"Eth address of Indexer"
@@ -1452,7 +1452,7 @@ type _Schema_
14521452
name: "subgraphMetadataSearch"
14531453
language: en
14541454
algorithm: rank
1455-
include: [{ entity: "SubgraphMetadata", fields: [{ name: "displayName" }, { name: "description" }] }]
1455+
include: [{ entity: "SubgraphMeta", fields: [{ name: "displayName" }, { name: "description" }] }]
14561456
)
14571457
@fulltext(
14581458
name: "curatorSearch"

src/mappings/ipfs.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { json, Bytes, dataSource, JSONValueKind, log, DataSourceContext } from '@graphprotocol/graph-ts'
22
import {
3-
SubgraphMetadata,
4-
SubgraphVersionMetadata,
5-
GraphAccountMetadata,
3+
SubgraphMeta,
4+
SubgraphVersionMeta,
5+
GraphAccountMeta,
66
SubgraphDeploymentSchema,
77
SubgraphDeploymentManifest,
88
} from '../types/schema'
@@ -13,7 +13,7 @@ import { jsonToString } from './utils'
1313

1414
export function handleSubgraphMetadata(content: Bytes): void {
1515
let id = dataSource.context().getString("id")
16-
let subgraphMetadata = new SubgraphMetadata(id)
16+
let subgraphMetadata = new SubgraphMeta(id)
1717
let tryData = json.try_fromBytes(content)
1818
if (tryData.isOk) {
1919
let data = tryData.value.toObject()
@@ -41,7 +41,7 @@ export function handleSubgraphMetadata(content: Bytes): void {
4141

4242
export function handleSubgraphVersionMetadata(content: Bytes): void {
4343
let id = dataSource.context().getString("id")
44-
let subgraphVersionMetadata = new SubgraphVersionMetadata(id)
44+
let subgraphVersionMetadata = new SubgraphVersionMeta(id)
4545
let tryData = json.try_fromBytes(content)
4646
if (tryData.isOk) {
4747
let data = tryData.value.toObject()
@@ -53,7 +53,7 @@ export function handleSubgraphVersionMetadata(content: Bytes): void {
5353

5454
export function handleGraphAccountMetadata(content: Bytes): void {
5555
let id = dataSource.context().getString("id")
56-
let graphAccountMetadata = new GraphAccountMetadata(id)
56+
let graphAccountMetadata = new GraphAccountMeta(id)
5757
let tryData = json.try_fromBytes(content)
5858
if (tryData.isOk) {
5959
let data = tryData.value.toObject()

subgraph.template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ templates:
726726
file: ./src/mappings/ipfs.ts
727727
handler: handleSubgraphMetadata
728728
entities:
729-
- SubgraphMetadata
729+
- SubgraphMeta
730730
abis:
731731
- name: EpochManager
732732
file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json
@@ -738,7 +738,7 @@ templates:
738738
file: ./src/mappings/ipfs.ts
739739
handler: handleSubgraphVersionMetadata
740740
entities:
741-
- SubgraphVersionMetadata
741+
- SubgraphVersionMeta
742742
abis:
743743
- name: EpochManager
744744
file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json
@@ -750,7 +750,7 @@ templates:
750750
file: ./src/mappings/ipfs.ts
751751
handler: handleGraphAccountMetadata
752752
entities:
753-
- GraphAccountMetadata
753+
- GraphAccountMeta
754754
abis:
755755
- name: EpochManager
756756
file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json

0 commit comments

Comments
 (0)