Return lnd wallet balance response in admin rpc proto (#78)

This commit is contained in:
Jonathan Zernik 2020-07-18 03:16:51 -07:00 committed by GitHub
parent 41de02983f
commit c4b64ebb6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View file

@ -242,8 +242,8 @@ def run():
# Check the server balance
get_balance_response = admin_stub.GetBalance(squeak_admin_pb2.GetBalanceRequest())
print("Get balance response balance: " + str(get_balance_response.balance))
assert get_balance_response.balance == 0
print("Get balance response: " + str(get_balance_response))
assert get_balance_response.wallet_balance_response.total_balance == 0
# Create a new signing profile
profile_name = 'bob'
@ -287,8 +287,8 @@ def run():
# Check the server balance
get_balance_response = admin_stub.GetBalance(squeak_admin_pb2.GetBalanceRequest())
print("Get balance response balance: " + str(get_balance_response.balance))
assert get_balance_response.balance == 1000
print("Get balance response: " + str(get_balance_response))
assert get_balance_response.wallet_balance_response.total_balance == 1000
if __name__ == '__main__':

View file

@ -7,7 +7,7 @@ option objc_class_prefix = "SQK";
package squeakserver;
// import "lnd.proto";
import "proto/lnd.proto";
// Interface exported by the server.
service SqueakAdmin {
@ -34,8 +34,8 @@ message GetBalanceRequest {
}
message GetBalanceReply {
/// The wallet balance
int64 balance = 1;
/// The wallet balance response
lnrpc.WalletBalanceResponse wallet_balance_response = 1;
}
message CreateSigningProfileRequest {

View file

@ -37,8 +37,7 @@ class SqueakAdminServerHandler(object):
def handle_get_balance(self):
logger.info("Handle get balance")
wallet_balance = self.lightning_client.get_wallet_balance()
logger.info("Wallet balance: {}".format(wallet_balance))
return wallet_balance.total_balance
return wallet_balance
def handle_create_signing_profile(self, profile_name):
logger.info("Handle create signing profile with name: {}".format(profile_name))

View file

@ -23,9 +23,9 @@ class SqueakAdminServerServicer(squeak_admin_pb2_grpc.SqueakAdminServicer):
self.handler = handler
def GetBalance(self, request, context):
total_balance = self.handler.handle_get_balance()
wallet_balance_response = self.handler.handle_get_balance()
return squeak_admin_pb2.GetBalanceReply(
balance=total_balance,
wallet_balance_response=wallet_balance_response,
)
def CreateSigningProfile(self, request, context):