diff options
| author | Adam Soltys <[email protected]> | 2025-08-21 11:38:42 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-08-21 11:38:42 -0700 |
| commit | c1310f5d2fce5fd9df42c8cc8753ea5895aab377 (patch) | |
| tree | de657d8eabd57143c3ac05f9d62571a544847fcf /lib | |
| parent | d2b99925d1e09de63207b4948d6970065dc64371 (diff) | |
| download | coinos-server-c1310f5d2fce5fd9df42c8cc8753ea5895aab377.tar.gz coinos-server-c1310f5d2fce5fd9df42c8cc8753ea5895aab377.zip | |
fix invoice update
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/invoices.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index b8eedbf6..48eb4879 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -20,6 +20,7 @@ export const generate = async ({ invoice, user }) => { currency, expiry, fiat, + id, tip, amount, items = [], @@ -55,7 +56,7 @@ export const generate = async ({ invoice, user }) => { if (rate < 0) fail("invalid rate"); if (memo && memo.length > 5000) fail("memo too long"); - const id = v4(); + if (!id) id = v4(); let hash; let text; @@ -81,7 +82,7 @@ export const generate = async ({ invoice, user }) => { expiry ||= 60 * 60 * 24 * 30; r = await ln.invoice({ amount_msat: amount ? `${amount + tip}sat` : "any", - label: id, + label: `${id} ${user.username} ${new Date()}`, description: memo || "", expiry, deschashonly: true, @@ -95,7 +96,7 @@ export const generate = async ({ invoice, user }) => { } else if (type === PaymentType.bolt12) { const r = await ln.offer({ amount: amount ? `${amount + tip}sat` : "any", - label: id, + label: `${id} ${user.username} ${new Date()}`, description: memo || id, }); |
