From ff737e5486d2d291fcbd256832f83a49ed47a9b2 Mon Sep 17 00:00:00 2001 From: daniyal Date: Tue, 13 Aug 2024 18:13:30 +0500 Subject: [PATCH] fix: removed removed optional lnurl from tags of payment zap request --- src/controllers/zap.ts | 14 +------------- src/types/zap.ts | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/controllers/zap.ts b/src/controllers/zap.ts index a82bb38..608fee1 100644 --- a/src/controllers/zap.ts +++ b/src/controllers/zap.ts @@ -1,7 +1,5 @@ import { Invoice } from '@getalby/lightning-tools' import axios, { AxiosInstance } from 'axios' -import { bech32 } from 'bech32' -import { Buffer } from 'buffer' import { Filter, kinds } from 'nostr-tools' import { requestProvider, SendPaymentResponse, WebLNProvider } from 'webln' import { @@ -79,17 +77,10 @@ export class ZapController { throw `Amount '${amount}' is not within minSendable and maxSendable values '${minSendable}-${maxSendable}'.` } - // encode lnurl into bech32 using lnurl prefix - const lnurlBech32 = bech32.encode( - 'lnurl', - bech32.toWords(Buffer.from(lnurl, 'utf8')) - ) - // generate zap request const zapRequest = await this.createZapRequest( amount, content, - lnurlBech32, recipientPubKey, senderPubkey, eventId, @@ -122,7 +113,7 @@ export class ZapController { // send zap request as GET request to callback url received from the lnurl pay endpoint const { data } = await this.httpClient.get( - `${callback}?amount=${amount}&nostr=${encodedEvent}&lnurl=${lnurlBech32}` + `${callback}?amount=${amount}&nostr=${encodedEvent}` ) // data object of the response should contain payment request @@ -271,7 +262,6 @@ export class ZapController { * Constructs zap request object. * @param amount - request amount (sats). * @param content - comment. - * @param lnurl - lnurl pay endpoint. * @param recipientPubKey - pubKey of the recipient. * @param senderPubkey - pubKey of of the sender. * @param eventId - event id, if zapping an event. @@ -281,7 +271,6 @@ export class ZapController { private async createZapRequest( amount: number, content = '', - lnurl: string, recipientPubKey: string, senderPubkey: string, eventId?: string, @@ -297,7 +286,6 @@ export class ZapController { tags: [ ['relays', `${this.appRelay}`], ['amount', `${amount}`], - ['lnurl', lnurl], ['p', recipientHexKey] ], pubkey: senderPubkey, diff --git a/src/types/zap.ts b/src/types/zap.ts index ef9903f..9666318 100644 --- a/src/types/zap.ts +++ b/src/types/zap.ts @@ -7,7 +7,6 @@ export interface LnurlResponse { minSendable: number maxSendable: number commentAllowed: number - payerData: { [key: string]: { [key: string]: boolean } } tag: string nostrPubkey: string allowsNostr: boolean @@ -20,7 +19,6 @@ export const isLnurlResponse = (obj: any): obj is LnurlResponse => 'minSendable' in obj && 'maxSendable' in obj && 'commentAllowed' in obj && - 'payerData' in obj && 'tag' in obj && 'nostrPubkey' in obj && 'allowsNostr' in obj