lnurl url
This commit is contained in:
parent
5278dda7d9
commit
393ecad4f8
2 changed files with 8 additions and 8 deletions
|
|
@ -131,6 +131,6 @@ export default class {
|
||||||
}
|
}
|
||||||
async GetAppUserLNURLInfo(appId: string, req: Types.GetAppUserLNURLInfoRequest): Promise<Types.LnurlPayInfoResponse> {
|
async GetAppUserLNURLInfo(appId: string, req: Types.GetAppUserLNURLInfoRequest): Promise<Types.LnurlPayInfoResponse> {
|
||||||
const user = await this.storage.applicationStorage.GetApplicationUser(appId, req.user_identifier)
|
const user = await this.storage.applicationStorage.GetApplicationUser(appId, req.user_identifier)
|
||||||
return this.paymentManager.GetLnurlPayInfoFromUser(user.user.user_id)
|
return this.paymentManager.GetLnurlPayInfoFromUser(user.user.user_id, req.base_url_override)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ export default class {
|
||||||
callback: `${this.settings.serviceUrl}/api/guest/lnurl_withdraw/handle`,
|
callback: `${this.settings.serviceUrl}/api/guest/lnurl_withdraw/handle`,
|
||||||
defaultDescription: "lnurl withdraw from lightning.pub",
|
defaultDescription: "lnurl withdraw from lightning.pub",
|
||||||
k1: callbackK1.key,
|
k1: callbackK1.key,
|
||||||
maxWithdrawable: maxWithdrawable,
|
maxWithdrawable: maxWithdrawable * 1000,
|
||||||
minWithdrawable: 0,
|
minWithdrawable: 0,
|
||||||
balanceCheck: this.balanceCheckUrl(newBalanceCheckK1.key),
|
balanceCheck: this.balanceCheckUrl(newBalanceCheckK1.key),
|
||||||
payLink: `${this.settings.serviceUrl}/api/guest/lnurl_pay/info?k1=${payInfoK1.key}`,
|
payLink: `${this.settings.serviceUrl}/api/guest/lnurl_pay/info?k1=${payInfoK1.key}`,
|
||||||
|
|
@ -173,12 +173,12 @@ export default class {
|
||||||
|
|
||||||
async HandleLnurlWithdraw(k1: string, invoice: string): Promise<void> {
|
async HandleLnurlWithdraw(k1: string, invoice: string): Promise<void> {
|
||||||
const key = await this.storage.paymentStorage.UseUserEphemeralKey(k1, 'withdraw')
|
const key = await this.storage.paymentStorage.UseUserEphemeralKey(k1, 'withdraw')
|
||||||
this.PayInvoice(key.user.user_id, {
|
try {
|
||||||
invoice: invoice,
|
await this.PayInvoice(key.user.user_id, { invoice: invoice, amount: 0s })
|
||||||
amount: 0
|
} catch (err: any) {
|
||||||
}).catch(err => {
|
|
||||||
console.error("error sending payment for lnurl withdraw to ", key.user.user_id, err)
|
console.error("error sending payment for lnurl withdraw to ", key.user.user_id, err)
|
||||||
})
|
throw new Error("failed to pay invoice")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetLnurlPayInfoFromUser(userId: string, baseUrl?: string): Promise<Types.LnurlPayInfoResponse> {
|
async GetLnurlPayInfoFromUser(userId: string, baseUrl?: string): Promise<Types.LnurlPayInfoResponse> {
|
||||||
|
|
@ -187,7 +187,7 @@ export default class {
|
||||||
return {
|
return {
|
||||||
tag: 'payRequest',
|
tag: 'payRequest',
|
||||||
callback: `${url}?k1=${payK1.key}`,
|
callback: `${url}?k1=${payK1.key}`,
|
||||||
maxSendable: 10000000,
|
maxSendable: 10000000000,
|
||||||
minSendable: 0,
|
minSendable: 0,
|
||||||
metadata: defaultLnurlPayMetadata
|
metadata: defaultLnurlPayMetadata
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue