This commit is contained in:
austinkelsay 2024-11-08 13:54:33 -06:00
parent 473595cf90
commit c350e43b7b
No known key found for this signature in database
GPG Key ID: 44CB4EC6D9F2FA02

View File

@ -63,10 +63,12 @@ export default async function handler(req, res) {
// If this is a zap, store verification URL and zap request in Redis
if (zap_request && foundAddress.allowsNostr) {
console.log('Storing zap request in Redis');
const zapRequest = JSON.parse(zap_request);
const verifyUrl = `${BACKEND_URL}/api/lightning-address/verify/${name}/${paymentHashHex}`;
console.log('Verify URL', verifyUrl);
// Store in Redis with 24-hour expiration
// Store in Redis
await kv.set(`invoice:${paymentHashHex}`, {
verifyUrl,
zapRequest,
@ -74,10 +76,11 @@ export default async function handler(req, res) {
invoice,
foundAddress,
settled: false
}, { ex: expiry || 86400 }); // expiry matches invoice expiry
}, { ex: expiry || 86400 });
// Start polling for this zap request
let attempts = 0;
console.log('Starting polling interval', attempts);
const pollInterval = setInterval(async () => {
console.log('Polling for invoice', attempts);
try {