mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-09 20:29:15 +02:00
minor fix for cashu
This commit is contained in:
parent
ab1524b478
commit
83ac35334d
2
dvm.py
2
dvm.py
@ -115,7 +115,9 @@ class DVM:
|
||||
|
||||
cashu_redeemed = False
|
||||
if cashu != "":
|
||||
print(cashu)
|
||||
cashu_redeemed, cashu_message = redeem_cashu(cashu, int(amount), self.dvm_config, self.client)
|
||||
print(cashu_message)
|
||||
if cashu_message != "success":
|
||||
send_job_status_reaction(nip90_event, "error", False, amount, self.client, cashu_message,
|
||||
self.dvm_config)
|
||||
|
@ -281,7 +281,7 @@ def parse_cashu(cashu_token: str):
|
||||
def redeem_cashu(cashu, required_amount, config, client) -> (bool, str):
|
||||
proofs, mint, redeem_invoice_amount, total_amount = parse_cashu(cashu)
|
||||
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: " +
|
||||
str(fees) + " Sats) below required amount of " + str(required_amount)
|
||||
+ " 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
|
||||
print(is_paid)
|
||||
if is_paid:
|
||||
print("token redeemed")
|
||||
print("cashu token redeemed")
|
||||
return True, "success"
|
||||
else:
|
||||
msg = tree.get("detail").split('.')[0].strip() if tree.get("detail") else None
|
||||
|
Loading…
x
Reference in New Issue
Block a user