1- use account:: { create_account_loader, AccountLoader } ;
1+ use account:: { create_account_loader, AccountLoader , GraphQLAccount } ;
22use block:: { GraphQLBlock , GraphQLSnarkJob , GraphQLUserCommands } ;
33use juniper:: { graphql_value, EmptySubscription , FieldError , GraphQLEnum , RootNode } ;
4- use ledger:: Account ;
4+ use ledger:: { Account , AccountId } ;
55use mina_p2p_messages:: v2:: {
66 conv, LedgerHash , MinaBaseSignedCommandStableV2 , MinaBaseUserCommandStableV2 ,
77 MinaBaseZkappCommandTStableV1WireStableV1 , TokenIdKeyHash , TransactionHash ,
@@ -10,12 +10,12 @@ use node::{
1010 account:: AccountPublicKey ,
1111 ledger:: read:: LedgerStatus ,
1212 rpc:: {
13- AccountQuery , GetBlockQuery , PooledCommandsQuery , RpcGenesisBlockResponse ,
14- RpcGetBlockResponse , RpcPooledUserCommandsResponse , RpcPooledZkappCommandsResponse ,
15- RpcRequest , RpcSnarkPoolCompletedJobsResponse , RpcSnarkPoolPendingJobsGetResponse ,
16- RpcSyncStatsGetResponse , RpcTransactionInjectResponse , RpcTransactionStatusGetResponse ,
17- SyncStatsQuery , RpcStatusGetResponse , RpcNodeStatus , RpcBestChainResponse ,
18- RpcLedgerStatusGetResponse
13+ AccountQuery , GetBlockQuery , PooledCommandsQuery , RpcBestChainResponse ,
14+ RpcGenesisBlockResponse , RpcGetBlockResponse , RpcLedgerAccountDelegatorsGetResponse ,
15+ RpcLedgerStatusGetResponse , RpcNodeStatus , RpcPooledUserCommandsResponse ,
16+ RpcPooledZkappCommandsResponse , RpcRequest , RpcSnarkPoolCompletedJobsResponse ,
17+ RpcSnarkPoolPendingJobsGetResponse , RpcStatusGetResponse , RpcSyncStatsGetResponse ,
18+ RpcTransactionInjectResponse , RpcTransactionStatusGetResponse , SyncStatsQuery ,
1919 } ,
2020 stats:: sync:: SyncKind ,
2121 BuildEnv ,
@@ -162,6 +162,24 @@ impl Context {
162162 . await
163163 . clone ( )
164164 }
165+
166+ pub ( crate ) async fn load_account ( & self , account_id : AccountId ) -> Option < GraphQLAccount > {
167+ self . account_loader . try_load ( account_id) . await . ok ( ) ?. ok ( )
168+ }
169+
170+ pub async fn fetch_delegators (
171+ & self ,
172+ ledger_hash : LedgerHash ,
173+ account_id : AccountId ,
174+ ) -> RpcLedgerAccountDelegatorsGetResponse {
175+ self . rpc_sender
176+ . oneshot_request ( RpcRequest :: LedgerAccountDelegatorsGet (
177+ ledger_hash. clone ( ) ,
178+ account_id. clone ( ) ,
179+ ) )
180+ . await
181+ . flatten ( )
182+ }
165183}
166184
167185#[ derive( Clone , Copy , Debug , GraphQLEnum ) ]
0 commit comments