@@ -12,7 +12,7 @@ use std::sync::Arc;
12
12
use sp_api:: ProvideRuntimeApi ;
13
13
14
14
pub use subtensor_custom_rpc_runtime_api:: {
15
- DelegateInfoRuntimeApi , NeuronInfoRuntimeApi , SubnetInfoRuntimeApi ,
15
+ ColdkeySwapRuntimeApi , DelegateInfoRuntimeApi , NeuronInfoRuntimeApi , SubnetInfoRuntimeApi ,
16
16
SubnetRegistrationRuntimeApi ,
17
17
} ;
18
18
@@ -51,6 +51,24 @@ pub trait SubtensorCustomApi<BlockHash> {
51
51
52
52
#[ method( name = "subnetInfo_getLockCost" ) ]
53
53
fn get_network_lock_cost ( & self , at : Option < BlockHash > ) -> RpcResult < u64 > ;
54
+ #[ method( name = "coldkeySwap_getScheduledColdkeySwap" ) ]
55
+ fn get_scheduled_coldkey_swap (
56
+ & self ,
57
+ coldkey_account_vec : Vec < u8 > ,
58
+ at : Option < BlockHash > ,
59
+ ) -> RpcResult < Vec < u8 > > ;
60
+ #[ method( name = "coldkeySwap_getRemainingArbitrationPeriod" ) ]
61
+ fn get_remaining_arbitration_period (
62
+ & self ,
63
+ coldkey_account_vec : Vec < u8 > ,
64
+ at : Option < BlockHash > ,
65
+ ) -> RpcResult < Vec < u8 > > ;
66
+ #[ method( name = "coldkeySwap_getColdkeySwapDestinations" ) ]
67
+ fn get_coldkey_swap_destinations (
68
+ & self ,
69
+ coldkey_account_vec : Vec < u8 > ,
70
+ at : Option < BlockHash > ,
71
+ ) -> RpcResult < Vec < u8 > > ;
54
72
}
55
73
56
74
pub struct SubtensorCustom < C , P > {
99
117
C :: Api : NeuronInfoRuntimeApi < Block > ,
100
118
C :: Api : SubnetInfoRuntimeApi < Block > ,
101
119
C :: Api : SubnetRegistrationRuntimeApi < Block > ,
120
+ C :: Api : ColdkeySwapRuntimeApi < Block > ,
102
121
{
103
122
fn get_delegates ( & self , at : Option < <Block as BlockT >:: Hash > ) -> RpcResult < Vec < u8 > > {
104
123
let api = self . client . runtime_api ( ) ;
@@ -223,4 +242,51 @@ where
223
242
Error :: RuntimeError ( format ! ( "Unable to get subnet lock cost: {:?}" , e) ) . into ( )
224
243
} )
225
244
}
245
+
246
+ fn get_scheduled_coldkey_swap (
247
+ & self ,
248
+ coldkey_account_vec : Vec < u8 > ,
249
+ at : Option < <Block as BlockT >:: Hash > ,
250
+ ) -> RpcResult < Vec < u8 > > {
251
+ let api = self . client . runtime_api ( ) ;
252
+ let at = at. unwrap_or_else ( || self . client . info ( ) . best_hash ) ;
253
+
254
+ api. get_scheduled_coldkey_swap ( at, coldkey_account_vec)
255
+ . map_err ( |e| {
256
+ Error :: RuntimeError ( format ! ( "Unable to get scheduled coldkey swap: {:?}" , e) ) . into ( )
257
+ } )
258
+ }
259
+
260
+ fn get_remaining_arbitration_period (
261
+ & self ,
262
+ coldkey_account_vec : Vec < u8 > ,
263
+ at : Option < <Block as BlockT >:: Hash > ,
264
+ ) -> RpcResult < Vec < u8 > > {
265
+ let api = self . client . runtime_api ( ) ;
266
+ let at = at. unwrap_or_else ( || self . client . info ( ) . best_hash ) ;
267
+
268
+ api. get_remaining_arbitration_period ( at, coldkey_account_vec)
269
+ . map_err ( |e| {
270
+ Error :: RuntimeError ( format ! (
271
+ "Unable to get remaining arbitration period: {:?}" ,
272
+ e
273
+ ) )
274
+ . into ( )
275
+ } )
276
+ }
277
+
278
+ fn get_coldkey_swap_destinations (
279
+ & self ,
280
+ coldkey_account_vec : Vec < u8 > ,
281
+ at : Option < <Block as BlockT >:: Hash > ,
282
+ ) -> RpcResult < Vec < u8 > > {
283
+ let api = self . client . runtime_api ( ) ;
284
+ let at = at. unwrap_or_else ( || self . client . info ( ) . best_hash ) ;
285
+
286
+ api. get_coldkey_swap_destinations ( at, coldkey_account_vec)
287
+ . map_err ( |e| {
288
+ Error :: RuntimeError ( format ! ( "Unable to get coldkey swap destinations: {:?}" , e) )
289
+ . into ( )
290
+ } )
291
+ }
226
292
}
0 commit comments