From 62e1e0ef8aacf8e2659d5c4bff1dd32c53a019bd Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 18 Jun 2021 13:29:47 +0200 Subject: [PATCH] pyln: Add wrapper for the keysend command --- contrib/pyln-client/pyln/client/lightning.py | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index f4e53f31935d..3ce3e17ba947 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -1353,3 +1353,26 @@ def getsharedsecret(self, point, **kwargs): } payload.update({k: v for k, v in kwargs.items()}) return self.call("getsharedsecret", payload) + + def keysend(self, destination, msatoshi, label=None, maxfeepercent=None, + retry_for=None, maxdelay=None, exemptfee=None, + extratlvs=None): + """ + """ + + if extra_tlvs is not None and not isinstance(extra_tlvs, dict): + raise ValueErrr( + "extra_tlvs is not a dictionary with integer keys and hexadecimal values" + ) + + payload = { + "destination": destination, + "msatoshi": msatoshi, + "label": label, + "maxfeepercent": maxfeepercent, + "retry_for": retry_for, + "maxdelay": maxdelay, + "exemptfee": exemptfee, + "extratlvs": extratlvs, + } + return self.call("keysend", payload)