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.
This commit is contained in:
fsociety
2024-10-02 14:31:42 +02:00
parent e8820d7c29
commit 259c012657

View File

@@ -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,