Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lightspark/lightspark_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PrivateFormat,
PublicFormat,
)

from lightspark.exceptions import LightsparkException
from lightspark.objects.Account import Account
from lightspark.objects.Account import from_json as Account_from_json
Expand Down Expand Up @@ -187,6 +188,27 @@ def create_invoice(

return Invoice_from_json(self._requester, json["create_invoice"]["invoice"])

def create_hold_invoice(
self,
node_id: str,
amount_msats: int,
memo: Optional[str] = None,
payment_hash: Optional[str] = None,
expiry_secs: Optional[int] = None,
) -> Invoice:
logger.info("Creating an invoice for node %s.", node_id)
variables = {
"amount_msats": amount_msats,
"node_id": node_id,
"payment_hash": payment_hash,
"memo": memo,
}
if expiry_secs is not None:
variables["expiry_secs"] = expiry_secs
json = self._requester.execute_graphql(CREATE_INVOICE_MUTATION, variables)

return Invoice_from_json(self._requester, json["create_invoice"]["invoice"])

def create_lnurl_invoice(
self,
node_id: str,
Expand Down