Update zap-dialog.component.ts (#119)

Handles profiles where lud16 is inserted into lud06
This commit is contained in:
Lu 2023-04-13 15:02:57 +03:00 committed by GitHub
parent 53f614380f
commit ff803bf9e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,10 @@ export class ZapDialogComponent implements OnInit {
async fetchZapper(): Promise<LNURLPayRequest | null> {
let staticPayReq = '';
if (this.profile.lud16) {
if (!this.profile.lud16 && this.profile.lud06 && this.profile.lud06.indexOf('@') > -1) {
const parts = this.profile.lud06.split('@');
staticPayReq = `https://${parts[1]}/.well-known/lnurlp/${parts[0]}`;
} else if (this.profile.lud16) {
const parts = this.profile.lud16.split('@');
staticPayReq = `https://${parts[1]}/.well-known/lnurlp/${parts[0]}`;
} else if (this.profile.lud06 && this.profile.lud06.toLowerCase().startsWith('lnurl')) {
@ -114,7 +117,6 @@ export class ZapDialogComponent implements OnInit {
async onSubmit() {
if (this.sendZapForm.valid) {
debugger;
let comment = this.sendZapForm.get('comment')?.value;
let amount = this.sendZapForm.get('amount')?.value;
if (!amount || !this.payRequest) {
@ -130,7 +132,6 @@ export class ZapDialogComponent implements OnInit {
let zapReqEvent;
if (this.payRequest.nostrPubkey)
if (this.profile.pubkey) {
debugger;
let note = this.event?.id ? this.event.id : null;
zapReqEvent = await this.createZapEvent(this.profile.pubkey, note, comment);
query.set('nostr', JSON.stringify(zapReqEvent));