Skip to content

Commit

Permalink
Warn about hodl invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Jan 26, 2024
1 parent 4d3ecdc commit c4e6f20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/routes/Send.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MutinyInvoice } from "@mutinywallet/mutiny-wasm";
import { MutinyInvoice, MutinyWallet } from "@mutinywallet/mutiny-wasm";
import { A, useNavigate, useSearchParams } from "@solidjs/router";
import {
createEffect,
Expand Down Expand Up @@ -451,11 +451,15 @@ export function Send() {
function processInvoice(source: ParsedParams & { invoice: string }) {
state.mutiny_wallet
?.decode_invoice(source.invoice!)
.then((invoice) => {
.then(async (invoice) => {
if (invoice.expire <= Date.now() / 1000) {
navigate("/search");
throw new Error(i18n.t("send.error_expired"));
}
const isHodl = await MutinyWallet.is_potential_hodl_invoice(
source.invoice!
);
setIsHodlInvoice(isHodl);

if (invoice?.amount_sats) {
setAmountSats(invoice.amount_sats);
Expand Down

0 comments on commit c4e6f20

Please sign in to comment.