@@ -145,6 +145,11 @@ async fn handle_create<R: SubgraphRegistrar>(
145145 request : & JsonRpcRequest ,
146146 id : JsonRpcId ,
147147) -> JsonRpcResponse {
148+ #[ derive( Debug , Deserialize ) ]
149+ pub struct SubgraphCreateParams {
150+ pub name : SubgraphName ,
151+ }
152+
148153 let params: SubgraphCreateParams = match parse_params ( request, id. clone ( ) ) {
149154 Ok ( p) => p,
150155 Err ( resp) => return resp,
@@ -172,13 +177,21 @@ async fn handle_deploy<R: SubgraphRegistrar>(
172177 request : & JsonRpcRequest ,
173178 id : JsonRpcId ,
174179) -> JsonRpcResponse {
180+ #[ derive( Debug , Deserialize ) ]
181+ pub struct SubgraphDeployParams {
182+ pub name : SubgraphName ,
183+ pub ipfs_hash : DeploymentHash ,
184+ pub node_id : Option < NodeId > ,
185+ pub debug_fork : Option < DeploymentHash > ,
186+ pub history_blocks : Option < i32 > ,
187+ }
188+
175189 let params: SubgraphDeployParams = match parse_params ( request, id. clone ( ) ) {
176190 Ok ( p) => p,
177191 Err ( resp) => return resp,
178192 } ;
179193
180194 let node_id = params. node_id . clone ( ) . unwrap_or ( state. node_id . clone ( ) ) ;
181- let routes = subgraph_routes ( & params. name , state. http_port ) ;
182195
183196 let result = state
184197 . registrar
@@ -195,7 +208,7 @@ async fn handle_deploy<R: SubgraphRegistrar>(
195208 false ,
196209 )
197210 . await
198- . map ( |_| routes ) ;
211+ . map ( |_| subgraph_routes ( & params . name , state . http_port ) ) ;
199212
200213 to_response (
201214 & state. logger ,
@@ -213,6 +226,11 @@ async fn handle_remove<R: SubgraphRegistrar>(
213226 request : & JsonRpcRequest ,
214227 id : JsonRpcId ,
215228) -> JsonRpcResponse {
229+ #[ derive( Debug , Deserialize ) ]
230+ pub struct SubgraphRemoveParams {
231+ pub name : SubgraphName ,
232+ }
233+
216234 let params: SubgraphRemoveParams = match parse_params ( request, id. clone ( ) ) {
217235 Ok ( p) => p,
218236 Err ( resp) => return resp,
@@ -240,6 +258,12 @@ async fn handle_reassign<R: SubgraphRegistrar>(
240258 request : & JsonRpcRequest ,
241259 id : JsonRpcId ,
242260) -> JsonRpcResponse {
261+ #[ derive( Debug , Deserialize ) ]
262+ pub struct SubgraphReassignParams {
263+ pub ipfs_hash : DeploymentHash ,
264+ pub node_id : NodeId ,
265+ }
266+
243267 let params: SubgraphReassignParams = match parse_params ( request, id. clone ( ) ) {
244268 Ok ( p) => p,
245269 Err ( resp) => return resp,
@@ -261,6 +285,13 @@ async fn handle_reassign<R: SubgraphRegistrar>(
261285 )
262286}
263287
288+ // Parameter structs for pause and resume
289+
290+ #[ derive( Debug , Deserialize ) ]
291+ pub struct SubgraphPauseParams {
292+ pub deployment : DeploymentHash ,
293+ }
294+
264295/// Handler for `subgraph_pause`.
265296async fn handle_pause < R : SubgraphRegistrar > (
266297 state : & AppState < R > ,
@@ -334,35 +365,3 @@ fn subgraph_routes(name: &SubgraphName, http_port: u16) -> JsonValue {
334365
335366 serde_json:: to_value ( map) . expect ( "invalid subgraph routes" )
336367}
337-
338- // Parameter structs for each method
339-
340- #[ derive( Debug , Deserialize ) ]
341- pub struct SubgraphCreateParams {
342- pub name : SubgraphName ,
343- }
344-
345- #[ derive( Debug , Deserialize ) ]
346- pub struct SubgraphDeployParams {
347- pub name : SubgraphName ,
348- pub ipfs_hash : DeploymentHash ,
349- pub node_id : Option < NodeId > ,
350- pub debug_fork : Option < DeploymentHash > ,
351- pub history_blocks : Option < i32 > ,
352- }
353-
354- #[ derive( Debug , Deserialize ) ]
355- pub struct SubgraphRemoveParams {
356- pub name : SubgraphName ,
357- }
358-
359- #[ derive( Debug , Deserialize ) ]
360- pub struct SubgraphReassignParams {
361- pub ipfs_hash : DeploymentHash ,
362- pub node_id : NodeId ,
363- }
364-
365- #[ derive( Debug , Deserialize ) ]
366- pub struct SubgraphPauseParams {
367- pub deployment : DeploymentHash ,
368- }
0 commit comments