@@ -46,74 +46,178 @@ These steps should ensure a smooth transition to the latest version of `indexer-
4646
4747[ Contributions guide] ( /contributing.md )
4848
49- ### Supported request and response format examples
49+ ## Supported request and response format examples
5050
51+ ``` bash
52+ curl http://localhost:7600/
53+ ```
54+ ```
55+ Service is up and running
5156```
52- ✗ curl http://localhost:7300/
53- Ready to roll!
54-
55- ✗ curl http://localhost:7300/health
56- {"healthy":true}
5757
58- ✗ curl http://localhost:7300/version
59- {"version":"0.1.0","dependencies":{}}
58+ ``` bash
59+ curl http://localhost:7600/version
60+ ```
61+ ``` json
62+ { "version" :" 0.1.0" , "dependencies" : {.. } }
63+ ```
6064
61- ✗ curl http://localhost:7300/operator/info
62- {"publicKey":"0xacb05407d78129b5717bb51712d3e23a78a10929"}
65+ ``` bash
66+ curl http://localhost:7600/info
67+ ```
68+ ``` json
69+ { "publicKey" : " 0xacb05407d78129b5717bb51712d3e23a78a10929" }
70+ ```
6371
6472# Subgraph queries
65- # Checks for receipts and authorization
66- ✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer token-for-graph-node-query-endpoint' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
67- "{\"data\":{\"_meta\":{\"block\":{\"number\":9425787}}}}"
68-
69- # Takes hex representation for subgraphs deployment id aside from IPFS hash representation
70- ✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer token-for-graph-node-query-endpoint' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
71- "{\"data\":{\"_meta\":{\"block\":{\"number\":9425787}}}}"
72-
73- # Free query auth token check failed
74- ✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: blah' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
75- "Invalid Tap-Receipt header provided"%
73+ ## Checks for receipts and authorization
74+ ``` bash
75+ curl -X POST \
76+ -H ' Content-Type: application/json' \
77+ -H ' Authorization: Bearer token-for-graph-node-query-endpoint' \
78+ --data ' {"query": "{_meta{block{number}}}"}' \
79+ http://localhost:7600/subgraphs/id/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
80+ ```
81+ ``` json
82+ {
83+ "attestable" : true ,
84+ "graphQLResponse" : " {\" data\" :{\" _meta\" :{\" block\" :{\" number\" :10666745}}}}"
85+ }
86+ ```
87+ ## Takes hex representation for subgraphs deployment id aside from IPFS hash representation
88+ ``` bash
89+ curl -X POST \
90+ -H ' Content-Type: application/json' \
91+ -H ' Authorization: Bearer token-for-graph-node-query-endpoint' \
92+ --data ' {"query": "{_meta{block{number}}}"}' \
93+ http://localhost:7600/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
94+ ```
95+ ``` json
96+ {
97+ "attestable" : true ,
98+ "graphQLResponse" : " {\" data\" :{\" _meta\" :{\" block\" :{\" number\" :10666745}}}}"
99+ }
100+ ```
76101
77- # Subgraph health check
78- ✗ curl http://localhost:7300/subgraphs/health/QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj
79- "Subgraph deployment is up to date"%
80- ## Unfound subgraph
81- ✗ curl http://localhost:7300/subgraphs/health/QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB
82- "Invalid indexing status"%
102+ ## Free query auth token check failed
103+ ``` bash
104+ curl -X POST \
105+ -H ' Content-Type: application/json' \
106+ -H ' Authorization: blah' \
107+ --data ' {"query": "{_meta{block{number}}}"}' \
108+ http://localhost:7600/subgraphs/id/0xb655ca6f49e73728a102219726ff678d61d8fb792874792e9f0d9887dc616600
109+ ```
110+ ``` json
111+ {
112+ "message" :" No valid receipt or free query auth token provided"
113+ }
114+ ```
83115
84116# Network queries
85- # Checks for auth and configuration to serve-network-subgraph
86- ✗ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: token-for-network-subgraph' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/network
87- "Not enabled or authorized query"
88-
89- # Indexing status resolver - Route supported root field queries to graph node status endpoint
90- ✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{blockHashFromNumber(network:\"goerli\", blockNumber: 9069120)}"}' http://localhost:7300/status
91- {"data":{"blockHashFromNumber":"e1e5472636db73ba5496aee098dc21310683c95eb30fc46f9ba6c36d8b28d58e"}}%
92-
93- # Indexing status resolver -
94- ✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{indexingStatuses {subgraph health} }"}' http://localhost:7300/status
95- {"data":{"indexingStatuses":[{"subgraph":"QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj","health":"healthy"},{"subgraph":"QmWVtsWk8Pqn3zY3czDjyoVreshRLmoz9jko3mQ4uvxQDj","health":"healthy"},{"subgraph":"QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB","health":"healthy"}]}}
117+ ## Checks for auth and configuration to serve-network-subgraph
118+
119+ ``` bash
120+ curl -X POST \
121+ -H ' Content-Type: application/json' \
122+ -H ' Authorization: token-for-network-subgraph' \
123+ --data ' {"query": "{_meta{block{number}}}"}' \
124+ http://localhost:7600/network
125+ ```
126+ ``` json
127+ {
128+ "message" :" No valid receipt or free query auth token provided"
129+ }
130+ ```
96131
97- # Indexing status resolver - Filter out the unsupported queries
98- ✗ curl -X POST -H 'Content-Type: application/json' --data '{"query": "{_meta{block{number}}}"}' http://localhost:7300/status
99- {"errors":[{"locations":[{"line":1,"column":2}],"message":"Type `Query` has no field `_meta`"}]}%
132+ ## Indexing status resolver - Route supported root field queries to graph node status endpoint
133+ ``` bash
134+ curl -X POST \
135+ -H ' Content-Type: application/json' \
136+ --data ' {"query": "{blockHashFromNumber(network:\"mainnet\", blockNumber: 21033)}"}' \
137+ http://localhost:7600/status
138+ ```
139+ ``` json
140+ {
141+ "data" : {
142+ "blockHashFromNumber" : " 0x6d8daae97a562b1fff22162515452acdd817c3d3c5cde1497b7d9eb6666a957e"
143+ }
144+ }
145+ ```
100146
101- ######## Cost server - read-only graphql query
102- curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment model variables }} "}' http://localhost:7300/cost
147+ ## Indexing status resolver
148+ ``` bash
149+ curl -X POST \
150+ -H ' Content-Type: application/json' \
151+ --data ' {"query": "{indexingStatuses {subgraph health}}"}' \
152+ http://localhost:7600/status
153+ ```
154+ ``` json
155+ {
156+ "data" : {
157+ "indexingStatuses" : [
158+ {
159+ "subgraph" : " QmVhiE4nax9i86UBnBmQCYDzvjWuwHShYh7aspGPQhU5Sj" ,
160+ "health" : " healthy"
161+ },
162+ {
163+ "subgraph" : " QmWVtsWk8Pqn3zY3czDjyoVreshRLmoz9jko3mQ4uvxQDj" ,
164+ "health" : " healthy"
165+ },
166+ {
167+ "subgraph" : " QmacQnSgia4iDPWHpeY6aWxesRFdb8o5DKZUx96zZqEWrB" ,
168+ "health" : " healthy"
169+ }
170+ ]
171+ }
172+ }
173+ ```
103174
104- curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment model variables }} "}' http://localhost:7300/cost
105- {"data":{"costModel":{"deployment":"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea","model":"default => 0.00025;","variables":null}}}%
175+ ## Indexing status resolver - Filter out the unsupported queries
176+ ``` bash
177+ curl -X POST \
178+ -H ' Content-Type: application/json' \
179+ --data ' {"query": "{_meta{block{number}}}"}' \
180+ http://localhost:7600/status
181+ ```
182+ ``` json
183+ {
184+ "errors" : [
185+ {
186+ "locations" : [
187+ {
188+ "line" : 1 ,
189+ "column" : 2
190+ }
191+ ],
192+ "message" : " Type `Query` has no field `_meta`"
193+ }
194+ ]
195+ }
196+ ```
106197
107- curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vas\") { deployment model variables }} "}' http://localhost:7300/cost
108- {"data":{"costModel":null}}%
198+ ## Cost server - read-only graphql query
109199
110- curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModel(deployment: \"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\") { deployment odel variables }} "}' http://localhost:7300/cost
111- {"errors":[{"message":"Cannot query field \"odel\" on type \"CostModel\". Did you mean \"model\"?","locations":[{"line":1,"column":88}]}]}%
200+ ``` bash
201+ curl -X GET \
202+ -H ' Content-Type: application/json' \
203+ --data ' {"query": "{ costModels(deployments: [\"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\"]) { deployment model variables }} "}' \
204+ http://localhost:7300/cost
205+ ```
206+ ``` json
207+ {
208+ "data" : {
209+ "costModels" : [
210+ {
211+ "deployment" : " 0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea" ,
212+ "model" : " default => 0.00025;" ,
213+ "variables" : null
214+ }
215+ ]
216+ }
217+ }
218+ ```
112219
113- curl -X GET -H 'Content-Type: application/json' --data '{"query": "{ costModels(deployments: [\"Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss\"]) { deployment model variables }} "}' http://localhost:7300/cost
114- {"data":{"costModels":[{"deployment":"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea","model":"default => 0.00025;","variables":null}]}}%
115220
116- ```
117221
118222## Dependency choices
119223
@@ -212,4 +316,4 @@ Temporarily live inside the indexer-service package under `src/types`
212316 - [ ] Add cost model metrics
213317- [x] CLI args
214318- [ ] App profiling
215- - [ ] No gcloud profiling, can use ` perf ` to collect performance data.
319+ - [ ] No gcloud profiling, can use ` perf ` to collect performance data.
0 commit comments