Skip to content

Commit

Permalink
added v2 integration
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Aug 29, 2024
1 parent 7f9040a commit 7cfe16b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/people/widgetViews/summaries/wantedSummaries/Invoice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ export default function Invoice(props: {
qrSize?: number;
}) {
const decoded = lighningDecoder.decode(props.lnInvoice);
const expiry = decoded.sections[8].value;

let expiry = decoded.sections[8].value;
// if it's not v1, do v2
if (isNaN(expiry)) {
expiry = decoded.sections[10].value;
}
const timeCreated = decoded.sections[4].value;

// eslint-disable-next-line react-hooks/exhaustive-deps
const endTime = new Date((timeCreated + expiry) * 1000);
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft(endTime, 'hours'));
Expand Down

0 comments on commit 7cfe16b

Please sign in to comment.