Handle expired invoices

This commit is contained in:
benthecarman
2024-01-13 13:28:04 +00:00
committed by Paul Miller
parent 97591ee2b1
commit 1c8a57d700
2 changed files with 6 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ export default {
error_clipboard: "Clipboard not supported",
error_keysend: "Keysend failed",
error_LNURL: "LNURL Pay failed",
error_expired: "Invoice is expired",
payment_pending: "Payment pending",
payment_pending_description:
"It's taking a while, but it's possible this payment may still go through. Please check 'Activity' for the current status.",

View File

@@ -446,6 +446,11 @@ export function Send() {
state.mutiny_wallet
?.decode_invoice(source.invoice!)
.then((invoice) => {
if (invoice.expire <= Date.now() / 1000) {
navigate("/search");
throw new Error(i18n.t("send.error_expired"));
}
if (invoice?.amount_sats) {
setAmountSats(invoice.amount_sats);
setIsAmtEditable(false);