From c2a116b713c6fc5d935df20d66c22f255802dc1b Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Thu, 2 Apr 2020 12:43:23 +0100 Subject: [PATCH] Update lndgrpc.py --- lnbits/wallets/lndgrpc.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lnbits/wallets/lndgrpc.py b/lnbits/wallets/lndgrpc.py index 6b9e9b2fe..dfb585934 100644 --- a/lnbits/wallets/lndgrpc.py +++ b/lnbits/wallets/lndgrpc.py @@ -6,17 +6,24 @@ from .base import InvoiceResponse, PaymentResponse, PaymentStatus, Wallet class LndWallet(Wallet): - """https://api.lightning.community/rest/index.html#lnd-rest-api-reference""" def __init__(self): endpoint = getenv("LND_GRPC_ENDPOINT") self.endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint self.port = getenv("LND_GRPC_PORT") - self.auth_admin = os.path.expanduser("~/")+(getenv("LND_ADMIN_MACAROON")) - self.auth_invoice = os.path.expanduser("~/")+(getenv("LND_INVOICE_MACAROON")) - self.auth_read = os.path.expanduser("~/")+(getenv("LND_READ_MACAROON")) - self.auth_cert = os.path.expanduser("~/")+(getenv("LND_CERT")) + self.auth_admin = getenv("LND_ADMIN_MACAROON") + self.auth_invoice = getenv("LND_INVOICE_MACAROON") + self.auth_read = getenv("LND_READ_MACAROON") + self.auth_cert = getenv("LND_CERT") + + lnd_rpc = lnd_grpc.Client( + lnd_dir = None, + tls_cert_path = self.auth_cert, + network = 'mainnet', + grpc_host = self.endpoint, + grpc_port = self.port + ) def create_invoice(self, amount: int, mem: str = "") -> InvoiceResponse: @@ -51,7 +58,7 @@ class LndWallet(Wallet): grpc_port = self.port ) - payinvoice = lnd_rpc.pay_invoice( # https://github.com/willcl-ark/lnd_grpc/blob/cf938c51c201f078e8bbe9e19ffc2d038f3abf7f/lnd_grpc/lightning.py#L439 + payinvoice = lnd_rpc.pay_invoice( payment_request = bolt11, )