File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ sp_api::decl_runtime_apis! {
19
19
pub trait DelegateInfoRuntimeApi {
20
20
fn get_delegates( ) -> Vec <DelegateInfo <AccountId32 >>;
21
21
fn get_delegate( delegate_account: AccountId32 ) -> Option <DelegateInfo <AccountId32 >>;
22
- fn get_delegated( delegatee_account: AccountId32 ) -> Vec <( DelegateInfo <AccountId32 >, Compact <u64 >) >;
22
+ fn get_delegated( delegatee_account: AccountId32 ) -> Vec <( DelegateInfo <AccountId32 >, ( Compact <u16 > , Compact < u64 >) ) >;
23
23
}
24
24
25
25
pub trait NeuronInfoRuntimeApi {
Original file line number Diff line number Diff line change @@ -151,16 +151,22 @@ impl<T: Config> Pallet<T> {
151
151
///
152
152
pub fn get_delegated (
153
153
delegatee : T :: AccountId ,
154
- ) -> Vec < ( DelegateInfo < T :: AccountId > , Compact < u64 > ) > {
155
- let mut delegates: Vec < ( DelegateInfo < T :: AccountId > , Compact < u64 > ) > = Vec :: new ( ) ;
154
+ ) -> Vec < ( DelegateInfo < T :: AccountId > , ( Compact < u16 > , Compact < u64 > ) ) > {
155
+ let mut delegates: Vec < ( DelegateInfo < T :: AccountId > , ( Compact < u16 > , Compact < u64 > ) ) > =
156
+ Vec :: new ( ) ;
156
157
for delegate in <Delegates < T > as IterableStorageMap < T :: AccountId , u16 > >:: iter_keys ( ) {
157
158
// Staked to this delegate, so add to list
158
159
for ( netuid, _) in Alpha :: < T > :: iter_prefix ( ( delegate. clone ( ) , delegatee. clone ( ) ) ) {
159
160
let delegate_info = Self :: get_delegate_by_existing_account ( delegate. clone ( ) , true ) ;
160
161
delegates. push ( (
161
162
delegate_info,
162
- Self :: get_stake_for_hotkey_and_coldkey_on_subnet ( & delegate, & delegatee, netuid)
163
+ (
164
+ netuid. into ( ) ,
165
+ Self :: get_stake_for_hotkey_and_coldkey_on_subnet (
166
+ & delegate, & delegatee, netuid,
167
+ )
163
168
. into ( ) ,
169
+ ) ,
164
170
) ) ;
165
171
}
166
172
}
Original file line number Diff line number Diff line change @@ -2062,7 +2062,7 @@ impl_runtime_apis! {
2062
2062
SubtensorModule :: get_delegate( delegate_account)
2063
2063
}
2064
2064
2065
- fn get_delegated( delegatee_account: AccountId32 ) -> Vec <( DelegateInfo <AccountId32 >, Compact <u64 >) > {
2065
+ fn get_delegated( delegatee_account: AccountId32 ) -> Vec <( DelegateInfo <AccountId32 >, ( Compact <u16 > , Compact < u64 >) ) > {
2066
2066
SubtensorModule :: get_delegated( delegatee_account)
2067
2067
}
2068
2068
}
You can’t perform that action at this time.
0 commit comments