Skip to content

Commit

Permalink
Handle expired invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman authored and futurepaul committed Jan 13, 2024
1 parent 97591ee commit 1c8a57d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
5 changes: 5 additions & 0 deletions src/routes/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1c8a57d

Please sign in to comment.