@@ -64,6 +64,13 @@ pub trait SubtensorCustomApi<BlockHash> {
64
64
fn get_subnet_state ( & self , netuid : u16 , at : Option < BlockHash > ) -> RpcResult < Vec < u8 > > ;
65
65
#[ method( name = "subnetInfo_getLockCost" ) ]
66
66
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 > > ;
67
74
}
68
75
69
76
pub struct SubtensorCustom < C , P > {
@@ -390,4 +397,23 @@ where
390
397
Error :: RuntimeError ( format ! ( "Unable to get subnet lock cost: {:?}" , e) ) . into ( )
391
398
} )
392
399
}
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
+ }
393
419
}
0 commit comments