-
Notifications
You must be signed in to change notification settings - Fork 2
/
api_schema.graphql
525 lines (484 loc) · 12.4 KB
/
api_schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# AUTOGENERATED. DO NOT MODIFY. ALL CHANGES WILL BE LOST.
enum ApiKeyPermissionLevel {
ADMIN
}
type ApiKeyPublicMetadata {
publicPrefix: String!
notes: String
permissionLevel: ApiKeyPermissionLevel!
}
"""
Metadata that was collected during a bisection run.
"""
type BisectionReport {
"""
The block number and hash that this metadata pertains to.
"""
block: PartialBlock!
"""
The metadata that was collected from the first indexer's
`graph-node` instance.
"""
indexer1Response: String!
"""
The metadata that was collected from the second indexer's
`graph-node` instance.
"""
indexer2Response: String!
}
"""
A bisection run report contains information about a specific bisection
run that is part of a larger divergence investigation.
"""
type BisectionRunReport {
"""
The UUID of the bisection run that this report pertains to. This UUID
is different from the UUID of the parent divergence investigation
request.
"""
uuid: UUID!
"""
The first PoI that was used to start the bisection run.
"""
poi1: HexString!
"""
The second PoI that was used to start the bisection run.
"""
poi2: HexString!
"""
The lower and upper block bounds inside which the bisection run
occurred.
"""
divergenceBlockBounds: DivergenceBlockBounds!
"""
For each specific bisection, a list of bisection reports is
available which includes the block number and hash, as well as the
metadata that was collected from `graph-node` for that block.
"""
bisects: [BisectionReport!]!
"""
If the bisection run failed before reaching a conclusion at a single
block, this field contains the error message.
"""
error: String
}
type Block {
"""
Returns an estimate of the timestamp of the block, based on the
network's block speed and the block's number.
"""
estimatedTimestamp: DateTime
"""
Returns an URL to a block explorer page for the block, if configured.
"""
blockExplorerUrl: String
"""
The block number (a.k.a. height).
"""
number: Int!
"""
The block hash, expressed as a hex string with a '0x' prefix.
"""
hash: HexString!
"""
The network that this block belongs to.
"""
network: Network!
}
"""
A block range, specified by optional start and end block numbers.
"""
input BlockRange {
"""
The start block number (inclusive).
"""
start: Int
"""
The end block number (inclusive).
"""
end: Int
}
"""
Implement the DateTime<Utc> scalar
The input/output is a string in RFC3339 format.
"""
scalar DateTime
type Deployment {
id: String!
}
type DivergenceBlockBounds {
lowerBound: PartialBlock!
upperBound: PartialBlock!
}
"""
A divergence investigation report contains all information that pertains to a divergence
investigation, including the results of its bisection run(s).
"""
type DivergenceInvestigationReport {
"""
The UUID of the divergence investigation request that this report
pertains to. This UUID is also used to identify the report, as well
as the request.
"""
uuid: UUID!
"""
The latest known status of the divergence investigation.
"""
status: DivergenceInvestigationStatus!
"""
A list of bisection runs that were performed as part of this
divergence investigation. If the investigation is still in progress,
this list may be incomplete.
"""
bisectionRuns: [BisectionRunReport!]!
"""
If the divergence investigation failed altogether, this field
contains the error message. Please note that specific bisection runs
may also fail, in which case the error message will be in the
`error` field of the corresponding `BisectionRunReport`.
"""
error: String
}
"""
Once Graphix launches a PoI divergence investigation, its status value
can be one of these.
"""
enum DivergenceInvestigationStatus {
"""
The investigation has been requested, but not yet launched and it's
scheduled to be launched soon.
"""
PENDING
"""
The investigation has been launched, some requests have possibly
been sent already, but the investigation is not concluded. Some
information may be available already, but partial.
"""
IN_PROGRESS
"""
The investigation has been concluded and the end results are
available.
"""
COMPLETE
}
type GraphNodeCollectedVersion {
versionString: String
versionCommit: String
errorResponse: String
collectedAt: NaiveDateTime!
}
scalar HexString
type Indexer {
address: String!
defaultDisplayName: String
"""
The version of the indexer.
"""
graphNodeVersion: GraphNodeCollectedVersion
"""
The network subgraph metadata of the indexer.
"""
networkSubgraphMetadata: IndexerNetworkSubgraphMetadata
}
type IndexerNetworkSubgraphMetadata {
geohash: String
indexerUrl: String
stakedTokens: Float!
allocatedTokens: Float!
lockedTokens: Float!
queryFeesCollected: Float!
queryFeeRebates: Float!
rewardsEarned: Float!
indexerIndexingRewards: Float!
delegatorIndexingRewards: Float!
lastUpdatedAt: NaiveDateTime!
}
scalar IpfsCid
"""
A scalar that can represent any JSON value.
"""
scalar JSON
type MutationRoot {
"""
Launches a divergence investigation, which is a process of comparing
two or more PoIs (up to four) and running a binary search to find the first
diverging block.
"""
launchDivergenceInvestigation(
"""
A list of PoI hashes that should be investigated for divergence. If this list contains more than two PoIs, a new bisection run will be performed for each unordered pair of PoIs.
"""
pois: [HexString!]!,
"""
Indicates whether to collect `graph-node`'s block cache contents during bisection runs to include in the report.
"""
queryBlockCaches: Boolean! = true,
"""
Indicates whether to collect `graph-node`'s ETH call cache contents during bisection runs to include in the report.
"""
queryEthCallCaches: Boolean! = true,
"""
Indicates whether to collect `graph-node`'s entity changes during bisection runs to include in the report.
"""
queryEntityChanges: Boolean! = true
): DivergenceInvestigationReport!
setConfiguration(
"""
The configuration file to use
"""
config: JSON!
): Boolean!
"""
Create a new API key with the given permission level. You'll need to
authenticate with another API key with the `admin` permission level to
do this.
"""
createApiKey(
"""
Permission level of the API key. Use `admin` for full access.
"""
permissionLevel: ApiKeyPermissionLevel!,
"""
Not-encrypted notes to store in the database alongside the API key, to be used for debugging or identification purposes.
"""
notes: String = null
): NewlyCreatedApiKey!
deleteApiKey(apiKey: String!): Boolean!
modifyApiKey( apiKey: String!,
"""
Not-encrypted notes to store in the database alongside the API key, to be used for debugging or identification purposes.
"""
notes: String, permissionLevel: ApiKeyPermissionLevel!
): Boolean!
setDeploymentName(deploymentIpfsCid: String!, name: String!): Deployment!
"""
Completely deletes a network and all related data (PoIs, indexers, subgraphs, etc.).
"""
deleteNetwork(network: String!): String!
}
"""
ISO 8601 combined date and time without timezone.
# Examples
* `2015-07-01T08:59:60.123`,
"""
scalar NaiveDateTime
type Network {
"""
Human-readable name of the network, following The Graph naming
standards.
"""
name: String!
"""
CAIP-2 chain ID of the network, if it exists.
"""
caip2: String
}
type NewlyCreatedApiKey {
apiKey: String!
notes: String
permissionLevel: ApiKeyPermissionLevel!
}
"""
A block number that may or may not also have an associated hash.
"""
type PartialBlock {
"""
The block number (or height).
"""
number: Int!
"""
The block hash, if known. Expressed as a hex string with a '0x' prefix.
"""
hash: HexString
}
"""
A specific indexer can use `PoiAgreementRatio` to check in how much agreement it is with other
indexers, given its own poi for each deployment. A consensus currently means a majority of
indexers agreeing on a particular POI.
"""
type PoiAgreementRatio {
"""
Total number of indexers that have live pois for the deployment.
"""
totalIndexers: Int!
"""
Number of indexers that agree on the POI with the specified indexer,
including the indexer itself.
"""
nAgreeingIndexers: Int!
"""
Number of indexers that disagree on the POI with the specified indexer.
"""
nDisagreeingIndexers: Int!
"""
Indicates if a consensus on the POI exists among indexers.
"""
hasConsensus: Boolean!
"""
Indicates if the specified indexer's POI is part of the consensus.
"""
inConsensus: Boolean!
"""
The PoI in question.
"""
poi: ProofOfIndexing!
}
"""
A filter for PoIs (proofs of indexing).
"""
input PoisQuery {
"""
Restricts the query to PoIs for subgraph deployments that index the
given chain name.
"""
network: String
"""
Restricts the query to PoIs for these given subgraph deployment IDs.
"""
deployments: [IpfsCid!]!
"""
Restricts the query to PoIs that were collected in the given block
range.
"""
blockRange: BlockRange
"""
Upper limit on the number of shown results.
"""
limit: Int
}
type ProofOfIndexing {
"""
The block height and hash for which this PoI is valid.
"""
block: Block!
"""
The PoI's hash.
"""
hash: HexString!
"""
The subgraph deployment that this PoI is for.
"""
deployment: SubgraphDeployment!
"""
The indexer that produced this PoI.
"""
indexer: Indexer!
}
type QueryRoot {
"""
Returns the version of the Graphix instance.
"""
version: String!
"""
Fetches all tracked subgraph deploymens in this Graphix instance and
filters them according to some filtering rules.
"""
deployments(
"""
The network name of the subgraph deployments to fetch
"""
networkName: String, name: String, ipfsCid: IpfsCid,
"""
Upper limit on the number of shown results.
"""
limit: Int! = 100
): [SubgraphDeployment!]!
"""
Fetches all tracked indexers in this Graphix instance and filters them
according to some filtering rules.
"""
indexers(
"""
The address of the indexer, encoded as a hex string with a '0x' prefix
"""
address: HexString,
"""
Upper limit on the number of shown results.
"""
limit: Int! = 100
): [Indexer!]!
"""
Filters through all PoIs ever collected by this Graphix
instance, according to some filtering rules specified in `filter`.
"""
proofsOfIndexing(
"""
Restricts the query to PoIs for subgraph deployments that index the given chain name.
"""
network: String,
"""
Restricts the query to PoIs for these given subgraph deployments (by hex-encoded IPFS CID with '0x' prefix).
"""
deployments: [IpfsCid!]! = [],
"""
Restricts the query to PoIs that were collected in the given block range.
"""
blockRange: BlockRange,
"""
Upper limit on the number of shown results.
"""
limit: Int! = 100
): [ProofOfIndexing!]!
"""
A copy of the configuration file used to run Graphix.
"""
configuration: JSON
"""
Same as [`QueryRoot::proofs_of_indexing`], but only returns PoIs that
are "live" i.e. they are the most recent PoI collected for their
subgraph deployment.
"""
liveProofsOfIndexing(filter: PoisQuery!): [ProofOfIndexing!]!
apiKeys: [ApiKeyPublicMetadata!]!
poiAgreementRatios(indexerAddress: HexString!): [PoiAgreementRatio!]!
divergenceInvestigationReport(
"""
The UUID of the divergence investigation report to fetch. This is the UUID that was returned by the `launchDivergenceInvestigation` mutation.
"""
uuid: UUID!
): DivergenceInvestigationReport
"""
Returns all networks known to Graphix. Subgraphs indexing other networks
won't be available in this Graphix database.
"""
networks: [Network!]!
_service: _Service!
}
type SubgraphDeployment {
"""
IPFS CID of the subgraph deployment manifest e.g. `Qm...`.
"""
cid: IpfsCid!
"""
Human-readable name of the subgraph deployment, if present.
"""
name: String
"""
Network of the subgraph deployment.
"""
network: Network!
}
"""
A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are parsed as
Strings within GraphQL. UUIDs are used to assign unique identifiers to
entities without requiring a central allocating authority.
# References
* [Wikipedia: Universally Unique Identifier](http://en.wikipedia.org/wiki/Universally_unique_identifier)
* [RFC4122: A Universally Unique IDentifier (UUID) URN Namespace](http://tools.ietf.org/html/rfc4122)
"""
scalar UUID
"""
The `_Any` scalar is used to pass representations of entities from external
services into the root `_entities` field for execution.
"""
scalar _Any
type _Service {
sdl: String
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: QueryRoot
mutation: MutationRoot
}