mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-06-29 16:20:42 +02:00
minor fix for cashu
This commit is contained in:
2
dvm.py
2
dvm.py
@ -115,7 +115,9 @@ class DVM:
|
|||||||
|
|
||||||
cashu_redeemed = False
|
cashu_redeemed = False
|
||||||
if cashu != "":
|
if cashu != "":
|
||||||
|
print(cashu)
|
||||||
cashu_redeemed, cashu_message = redeem_cashu(cashu, int(amount), self.dvm_config, self.client)
|
cashu_redeemed, cashu_message = redeem_cashu(cashu, int(amount), self.dvm_config, self.client)
|
||||||
|
print(cashu_message)
|
||||||
if cashu_message != "success":
|
if cashu_message != "success":
|
||||||
send_job_status_reaction(nip90_event, "error", False, amount, self.client, cashu_message,
|
send_job_status_reaction(nip90_event, "error", False, amount, self.client, cashu_message,
|
||||||
self.dvm_config)
|
self.dvm_config)
|
||||||
|
@ -281,7 +281,7 @@ def parse_cashu(cashu_token: str):
|
|||||||
def redeem_cashu(cashu, required_amount, config, client) -> (bool, str):
|
def redeem_cashu(cashu, required_amount, config, client) -> (bool, str):
|
||||||
proofs, mint, redeem_invoice_amount, total_amount = parse_cashu(cashu)
|
proofs, mint, redeem_invoice_amount, total_amount = parse_cashu(cashu)
|
||||||
fees = total_amount - redeem_invoice_amount
|
fees = total_amount - redeem_invoice_amount
|
||||||
if redeem_invoice_amount <= required_amount:
|
if redeem_invoice_amount < required_amount:
|
||||||
err = ("Token value (Payment: " + str(total_amount) + " Sats. Fees: " +
|
err = ("Token value (Payment: " + str(total_amount) + " Sats. Fees: " +
|
||||||
str(fees) + " Sats) below required amount of " + str(required_amount)
|
str(fees) + " Sats) below required amount of " + str(required_amount)
|
||||||
+ " Sats. Cashu token has not been claimed.")
|
+ " Sats. Cashu token has not been claimed.")
|
||||||
@ -308,7 +308,7 @@ def redeem_cashu(cashu, required_amount, config, client) -> (bool, str):
|
|||||||
is_paid = tree["paid"] if tree.get("paid") else False
|
is_paid = tree["paid"] if tree.get("paid") else False
|
||||||
print(is_paid)
|
print(is_paid)
|
||||||
if is_paid:
|
if is_paid:
|
||||||
print("token redeemed")
|
print("cashu token redeemed")
|
||||||
return True, "success"
|
return True, "success"
|
||||||
else:
|
else:
|
||||||
msg = tree.get("detail").split('.')[0].strip() if tree.get("detail") else None
|
msg = tree.get("detail").split('.')[0].strip() if tree.get("detail") else None
|
||||||
|
Reference in New Issue
Block a user