Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLNRest return model #494

Merged
merged 2 commits into from
Mar 26, 2024
Merged
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
6 changes: 3 additions & 3 deletions cashu/lightning/corelightningrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def cleanup(self):
logger.warning(f"Error closing wallet connection: {e}")

async def status(self) -> StatusResponse:
r = await self.client.get(f"{self.url}/v1/channel/localremotebal", timeout=5)
r = await self.client.get(f"{self.url}/v1/listFunds", timeout=5)
r.raise_for_status()
if r.is_error or "error" in r.json():
try:
Expand All @@ -88,7 +88,7 @@ async def status(self) -> StatusResponse:
data = r.json()
if len(data) == 0:
return StatusResponse(error_message="no data", balance=0)
balance_msat = int(data.get("localBalance") * 1000)
balance_msat = int(sum([c["our_amount_msat"] for c in data["channels"]]))
return StatusResponse(error_message=None, balance=balance_msat)

async def create_invoice(
Expand Down Expand Up @@ -212,7 +212,7 @@ async def pay_invoice(

checking_id = data["payment_hash"]
preimage = data["payment_preimage"]
fee_msat = data["msatoshi_sent"] - data["msatoshi"]
fee_msat = data["amount_sent_msat"] - data["amount_msat"]

return PaymentResponse(
ok=self.statuses.get(data["status"]),
Expand Down
Loading