@@ -63,6 +63,11 @@ impl JsonRpcServer {
6363 state. remove_handler ( params. parse ( ) ?) . await
6464 } )
6565 . unwrap ( ) ;
66+ rpc_module
67+ . register_async_method ( "subgraph_drop" , |params, state| async move {
68+ state. drop_handler ( params. parse ( ) ?) . await
69+ } )
70+ . unwrap ( ) ;
6671 rpc_module
6772 . register_async_method ( "subgraph_reassign" , |params, state| async move {
6873 state. reassign_handler ( params. parse ( ) ?) . await
@@ -150,6 +155,22 @@ impl<R: SubgraphRegistrar> ServerState<R> {
150155 }
151156 }
152157
158+ /// Handler for the `subgraph_drop` endpoint.
159+ async fn drop_handler ( & self , params : SubgraphDropParams ) -> JsonRpcResult < GraphValue > {
160+ info ! ( & self . logger, "Received subgraph_drop request" ; "params" => format!( "{:?}" , params) ) ;
161+
162+ match self . registrar . remove_deployment ( & params. ipfs_hash ) . await {
163+ Ok ( _) => Ok ( Value :: Null ) ,
164+ Err ( e) => Err ( json_rpc_error (
165+ & self . logger ,
166+ "subgraph_drop" ,
167+ e,
168+ Self :: REMOVE_ERROR ,
169+ params,
170+ ) ) ,
171+ }
172+ }
173+
153174 /// Handler for the `subgraph_remove` endpoint.
154175 async fn remove_handler ( & self , params : SubgraphRemoveParams ) -> JsonRpcResult < GraphValue > {
155176 info ! ( & self . logger, "Received subgraph_remove request" ; "params" => format!( "{:?}" , params) ) ;
@@ -289,6 +310,11 @@ struct SubgraphRemoveParams {
289310 name : SubgraphName ,
290311}
291312
313+ #[ derive( Debug , Deserialize ) ]
314+ struct SubgraphDropParams {
315+ ipfs_hash : DeploymentHash ,
316+ }
317+
292318#[ derive( Debug , Deserialize ) ]
293319struct SubgraphReassignParams {
294320 ipfs_hash : DeploymentHash ,
0 commit comments