From 259c0126579e834602a9f193d273be24a1739beb Mon Sep 17 00:00:00 2001 From: fsociety Date: Wed, 2 Oct 2024 14:31:42 +0200 Subject: [PATCH] feat: dynamic zap endpoint from callback URL in nostrZap.js This commit fetches the callback URL dynamically instead of using a hardcoded value. This improves the flexibility of the system as the callback URL can now be changed without needing to modify the code. --- resources/js/nostrZap.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/js/nostrZap.js b/resources/js/nostrZap.js index 7923a2a..09b3e2d 100644 --- a/resources/js/nostrZap.js +++ b/resources/js/nostrZap.js @@ -36,7 +36,10 @@ export default (livewireComponent) => ({ const amount = amountToPay * 1000; console.log('event', event); - const zapEndpoint = 'https://pay.einundzwanzig.space/BTC/UILNURL/pay/i/98eo2PNNWByxqMCFZR5nzW'; + // Fetch the callback URL + const callbackResponse = await fetch('https://pay.einundzwanzig.space/BTC/UILNURL/pay/lnaddress/verein'); + const callbackData = await callbackResponse.json(); + const zapEndpoint = callbackData.callback; const zapEvent = nip57.makeZapRequest({ profile: sender,