mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
feat: add keysend payment method in webln.js and update button action in web-l-n.blade.php
This commit is contained in:
@@ -19,6 +19,25 @@ export default (livewireComponent) => ({
|
||||
});
|
||||
},
|
||||
|
||||
async keySendMethod() {
|
||||
// keysend(args: KeysendArgs): Promise<SendPaymentResponse>;
|
||||
// Send a keysend payment to the specified node.
|
||||
await webln.keysend({
|
||||
destination: '0363662a4ae8b8b7a73d9f4e459a9b25d4786f4ecc7315b5401934f3a2ef609750', amount: 1,
|
||||
})
|
||||
.then(response => {
|
||||
console.log('Payment response:', response);
|
||||
this.$wire.call('logThis', 'Payment response: ' + JSON.stringify(response));
|
||||
this.$wire.call('reloadMe');
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Payment failed:', error);
|
||||
this.$wire.call('logThis', 'Payment failed: ' + error);
|
||||
this.$wire.call('reloadMe');
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
async init() {
|
||||
console.log('WebLN initialized');
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="text-xs sm:text-base break-words">payment_request: {{ $invoice['payment_request'] }}</div>
|
||||
<div class="mt-6">
|
||||
<div class="flex justify-center">
|
||||
<button x-on:click="pay" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Pay Invoice</button>
|
||||
<button x-on:click="keySendMethod" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Pay Invoice</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user