@@ -47,8 +47,9 @@ use crate::{
47
47
GetBlockInfoResponse , GetBmmHStarCommitmentRequest , GetBmmHStarCommitmentResponse ,
48
48
GetChainInfoRequest , GetChainInfoResponse , GetChainTipRequest , GetChainTipResponse ,
49
49
GetCoinbasePsbtRequest , GetCoinbasePsbtResponse , GetCtipRequest , GetCtipResponse ,
50
- GetSidechainProposalsRequest , GetSidechainProposalsResponse , GetSidechainsRequest ,
51
- GetSidechainsResponse , GetTwoWayPegDataRequest , GetTwoWayPegDataResponse ,
50
+ GetInfoRequest , GetInfoResponse , GetSidechainProposalsRequest ,
51
+ GetSidechainProposalsResponse , GetSidechainsRequest , GetSidechainsResponse ,
52
+ GetTwoWayPegDataRequest , GetTwoWayPegDataResponse ,
52
53
ListSidechainDepositTransactionsRequest , ListSidechainDepositTransactionsResponse ,
53
54
ListTransactionsRequest , ListTransactionsResponse , ListUnspentOutputsRequest ,
54
55
ListUnspentOutputsResponse , Network , SendTransactionRequest , SendTransactionResponse ,
@@ -697,6 +698,36 @@ impl WalletService for crate::wallet::Wallet {
697
698
698
699
type GenerateBlocksStream = BoxStream < ' static , Result < GenerateBlocksResponse , tonic:: Status > > ;
699
700
701
+ async fn get_info (
702
+ & self ,
703
+ _request : tonic:: Request < GetInfoRequest > ,
704
+ ) -> Result < tonic:: Response < GetInfoResponse > , tonic:: Status > {
705
+ let info = self
706
+ . get_wallet_info ( )
707
+ . await
708
+ . map_err ( |err| err. into_status ( ) ) ?;
709
+
710
+ let response = GetInfoResponse {
711
+ network : info. network . to_string ( ) ,
712
+ transaction_count : info. transaction_count as u32 ,
713
+ unspent_output_count : info. unspent_output_count as u32 ,
714
+ descriptors : info
715
+ . keychain_descriptors
716
+ . iter ( )
717
+ . map ( |( kind, descriptor) | {
718
+ (
719
+ match kind {
720
+ bdk_wallet:: KeychainKind :: External => "external" . to_string ( ) ,
721
+ bdk_wallet:: KeychainKind :: Internal => "internal" . to_string ( ) ,
722
+ } ,
723
+ descriptor. to_string ( ) ,
724
+ )
725
+ } )
726
+ . collect ( ) ,
727
+ } ;
728
+ Ok ( tonic:: Response :: new ( response) )
729
+ }
730
+
700
731
async fn create_sidechain_proposal (
701
732
& self ,
702
733
request : tonic:: Request < CreateSidechainProposalRequest > ,
0 commit comments