aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/features/names.js11
-rw-r--r--src/i18n.js2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/features/names.js b/src/features/names.js
index fe5ab0a..45b0b36 100644
--- a/src/features/names.js
+++ b/src/features/names.js
@@ -694,14 +694,25 @@ export function namesFeature(ctx) {
try {
const a = await hook('arkMakeInvoice', sat, (inv.memo || '').trim().slice(0, 100));
inv.invoice = a.invoice;
+ inv.expiresAt = a.expiresAt || 0;
+ // the QR gives way to "expired" when the hour is up
+ if (inv.expiresAt) setTimeout(() => { if (ui.namesInv === inv) render(); }, Math.max(0, inv.expiresAt - Date.now()) + 500);
} catch (e) { inv.error = e.message; }
inv.busy = false; render();
}
function invoicePane() {
const inv = ui.namesInv || (ui.namesInv = {});
+ // The server finishes a Lightning receive only while this wallet is
+ // open to take it: paid with coinos shut, the money goes back to the
+ // payer. The invoice lasts an hour, and the screen says both.
+ if (inv.invoice && inv.expiresAt && Date.now() >= inv.expiresAt)
+ return h('div', { class: 'col', style: 'gap:10px;width:100%;align-items:center' },
+ h('div', { class: 'small muted', style: 'text-align:center' }, t('namesInvExpired')),
+ h('button', { class: 'btn-sm', onClick: () => { ui.namesInv = {}; render(); } }, t('namesInvNew')));
if (inv.invoice)
return h('div', { class: 'col', style: 'gap:10px;width:100%;align-items:center' },
+ h('div', { class: 'notice small names-inv-open', style: 'width:100%;text-align:center' }, t('namesInvKeepOpen')),
h('div', { html: qrSvg(inv.invoice.toUpperCase(), { ec: 'L', mode: 'Alphanumeric' }) }),
h('div', { class: 'addr-box break', style: 'width:100%;font-size:11px' }, inv.invoice),
h('div', { class: 'row gap6' },
diff --git a/src/i18n.js b/src/i18n.js
index fa21732..a06c35c 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -1422,6 +1422,8 @@ const STR = {
namesInvMemoPh: 'Description (optional)',
namesInvCreate: 'Create invoice',
namesInvNew: 'New invoice',
+ namesInvKeepOpen: 'Keep coinos open until this is paid. If it\u2019s paid while coinos is closed, the money goes back to the sender. It expires in an hour.',
+ namesInvExpired: 'This invoice has expired. Make a new one when you\u2019re ready to be paid.',
namesInvBadAmount: 'Enter an amount in sats',
namesOfferMemoPh: 'Label (e.g. Ocean payout)',
namesOfferCreate: 'Create',