diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js
index 06b04473c..a2d80d04e 100644
--- a/api/resolvers/wallet.js
+++ b/api/resolvers/wallet.js
@@ -93,6 +93,7 @@ export default {
ELSE 'PENDING' END as status,
"desc" as description,
comment as "invoiceComment",
+ "lud18Data" as "invoicePayerData",
'invoice' as type
FROM "Invoice"
WHERE "userId" = $1
@@ -109,6 +110,7 @@ export default {
COALESCE(status::text, 'PENDING') as status,
NULL as description,
NULL as "invoiceComment",
+ NULL as "invoicePayerData",
'withdrawal' as type
FROM "Withdrawl"
WHERE "userId" = $1
@@ -135,6 +137,7 @@ export default {
NULL AS status,
NULL as description,
NULL as "invoiceComment",
+ NULL as "invoicePayerData",
'stacked' AS type
FROM "ItemAct"
JOIN "Item" ON "ItemAct"."itemId" = "Item".id
@@ -148,14 +151,14 @@ export default {
queries.push(
`(SELECT ('earn' || min("Earn".id)) as id, min("Earn".id) as "factId", NULL as bolt11,
created_at as "createdAt", sum(msats),
- 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", 'earn' as type
+ 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", NULL as "invoicePayerData", 'earn' as type
FROM "Earn"
WHERE "Earn"."userId" = $1 AND "Earn".created_at <= $2
GROUP BY "userId", created_at)`)
queries.push(
`(SELECT ('referral' || "ReferralAct".id) as id, "ReferralAct".id as "factId", NULL as bolt11,
created_at as "createdAt", msats,
- 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", 'referral' as type
+ 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", NULL as "invoicePayerData", 'referral' as type
FROM "ReferralAct"
WHERE "ReferralAct"."referrerId" = $1 AND "ReferralAct".created_at <= $2)`)
}
@@ -164,7 +167,7 @@ export default {
queries.push(
`(SELECT ('spent' || "Item".id) as id, "Item".id as "factId", NULL as bolt11,
MAX("ItemAct".created_at) as "createdAt", sum("ItemAct".msats) as msats,
- 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", 'spent' as type
+ 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", NULL as "invoicePayerData", 'spent' as type
FROM "ItemAct"
JOIN "Item" on "ItemAct"."itemId" = "Item".id
WHERE "ItemAct"."userId" = $1
@@ -173,7 +176,7 @@ export default {
queries.push(
`(SELECT ('donation' || "Donation".id) as id, "Donation".id as "factId", NULL as bolt11,
created_at as "createdAt", sats * 1000 as msats,
- 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", 'donation' as type
+ 0 as "msatsFee", NULL as status, NULL as description, NULL as "invoiceComment", NULL as "invoicePayerData", 'donation' as type
FROM "Donation"
WHERE "userId" = $1
AND created_at <= $2)`)
@@ -259,7 +262,7 @@ export default {
const [inv] = await serialize(models,
models.$queryRaw`SELECT * FROM create_invoice(${invoice.id}, ${invoice.request},
- ${expiresAt}::timestamp, ${amount * 1000}, ${user.id}::INTEGER, ${description}, NULL,
+ ${expiresAt}::timestamp, ${amount * 1000}, ${user.id}::INTEGER, ${description}, NULL, NULL,
${invLimit}::INTEGER, ${balanceLimit})`)
if (hodlInvoice) await models.invoice.update({ where: { hash: invoice.id }, data: { preimage: invoice.secret } })
diff --git a/api/typeDefs/wallet.js b/api/typeDefs/wallet.js
index e5e9bf9c2..a7d103554 100644
--- a/api/typeDefs/wallet.js
+++ b/api/typeDefs/wallet.js
@@ -27,6 +27,7 @@ export default gql`
satsRequested: Int!
nostr: JSONObject
comment: String
+ lud18Data: JSONObject
hmac: String
isHeld: Boolean
}
@@ -55,6 +56,7 @@ export default gql`
description: String
item: Item
invoiceComment: String
+ invoicePayerData: JSONObject
}
type History {
diff --git a/components/invoice.js b/components/invoice.js
index 36a505254..cb9e72183 100644
--- a/components/invoice.js
+++ b/components/invoice.js
@@ -11,6 +11,7 @@ import { useMe } from './me'
import { useShowModal } from './modal'
import { sleep } from '../lib/time'
import Countdown from './countdown'
+import PayerData from './payer-data'
export function Invoice ({ invoice, onPayment, info, successVerb }) {
const [expired, setExpired] = useState(new Date(invoice.expiredAt) <= new Date())
@@ -38,7 +39,7 @@ export function Invoice ({ invoice, onPayment, info, successVerb }) {
}
}, [invoice.confirmedAt, invoice.isHeld, invoice.satsReceived])
- const { nostr } = invoice
+ const { nostr, comment, lud18Data } = invoice
return (
<>
@@ -70,6 +71,20 @@ export function Invoice ({ invoice, onPayment, info, successVerb }) {
/>
: null}
+ {lud18Data &&
+
+ }
+ />
+
}
+ {comment &&
+
+ {comment}}
+ />
+
}
>
)
}
diff --git a/components/notifications.js b/components/notifications.js
index 33b0014db..b440a6cbc 100644
--- a/components/notifications.js
+++ b/components/notifications.js
@@ -237,11 +237,27 @@ function NostrZap ({ n }) {
}
function InvoicePaid ({ n }) {
+ let payerSig
+ if (n.invoice.lud18Data) {
+ const { name, identifier, email, pubkey } = n.invoice.lud18Data
+ const id = identifier || email || pubkey
+ payerSig = '- '
+ if (name) {
+ payerSig += name
+ if (id) payerSig += ' \\ '
+ }
+
+ if (id) payerSig += id
+ }
return (