@@ -64,6 +64,13 @@ pub trait SubtensorCustomApi<BlockHash> {
6464 fn get_subnet_state ( & self , netuid : u16 , at : Option < BlockHash > ) -> RpcResult < Vec < u8 > > ;
6565 #[ method( name = "subnetInfo_getLockCost" ) ]
6666 fn get_network_lock_cost ( & self , at : Option < BlockHash > ) -> RpcResult < u64 > ;
67+ #[ method( name = "subnetInfo_getSelectiveMetagraph" ) ]
68+ fn get_selective_metagraph (
69+ & self ,
70+ netuid : u16 ,
71+ metagraph_index : Vec < u16 > ,
72+ at : Option < BlockHash > ,
73+ ) -> RpcResult < Vec < u8 > > ;
6774}
6875
6976pub struct SubtensorCustom < C , P > {
@@ -390,4 +397,23 @@ where
390397 Error :: RuntimeError ( format ! ( "Unable to get subnet lock cost: {:?}" , e) ) . into ( )
391398 } )
392399 }
400+
401+ fn get_selective_metagraph (
402+ & self ,
403+ netuid : u16 ,
404+ metagraph_index : Vec < u16 > ,
405+ at : Option < <Block as BlockT >:: Hash > ,
406+ ) -> RpcResult < Vec < u8 > > {
407+ let api = self . client . runtime_api ( ) ;
408+ let at = at. unwrap_or_else ( || self . client . info ( ) . best_hash ) ;
409+
410+ match api. get_selective_metagraph ( at, netuid, metagraph_index) {
411+ Ok ( result) => Ok ( result. encode ( ) ) ,
412+ Err ( e) => Err ( Error :: RuntimeError ( format ! (
413+ "Unable to get selective metagraph: {:?}" ,
414+ e
415+ ) )
416+ . into ( ) ) ,
417+ }
418+ }
393419}
0 commit comments