new env: LNURL_META_TEXT
This commit is contained in:
parent
9670f1e856
commit
56870b99ab
2 changed files with 9 additions and 7 deletions
|
|
@ -39,8 +39,8 @@ interface UserOperationInfo {
|
||||||
internal?: boolean;
|
internal?: boolean;
|
||||||
}
|
}
|
||||||
export type PendingTx = { type: 'incoming', tx: AddressReceivingTransaction } | { type: 'outgoing', tx: UserTransactionPayment }
|
export type PendingTx = { type: 'incoming', tx: AddressReceivingTransaction } | { type: 'outgoing', tx: UserTransactionPayment }
|
||||||
const defaultLnurlPayMetadata = `[["text/plain", "lnurl pay to Lightning.pub"]]`
|
const defaultLnurlPayMetadata = (text: string) => `[["text/plain", "${text}"]]`
|
||||||
const defaultLnAddressMetadata = (id: string) => `[["text/plain", "lnurl pay to Lightning.pub"],["text/identifier", "${id}"]]`
|
const defaultLnAddressMetadata = (text: string, id: string) => `[["text/plain", "${text}"],["text/identifier", "${id}"]]`
|
||||||
const confInOne = 1000 * 1000
|
const confInOne = 1000 * 1000
|
||||||
const confInTwo = 100 * 1000 * 1000
|
const confInTwo = 100 * 1000 * 1000
|
||||||
export default class {
|
export default class {
|
||||||
|
|
@ -527,7 +527,7 @@ export default class {
|
||||||
callback: `${url}?k1=${payK1.key}`,
|
callback: `${url}?k1=${payK1.key}`,
|
||||||
maxSendable: remote * 1000,
|
maxSendable: remote * 1000,
|
||||||
minSendable: 10000,
|
minSendable: 10000,
|
||||||
metadata: metadata ? metadata : defaultLnurlPayMetadata,
|
metadata: metadata ? metadata : defaultLnurlPayMetadata(this.settings.lnurlMetaText),
|
||||||
allowsNostr: !!linkedApplication.nostr_public_key,
|
allowsNostr: !!linkedApplication.nostr_public_key,
|
||||||
nostrPubkey: linkedApplication.nostr_public_key || ""
|
nostrPubkey: linkedApplication.nostr_public_key || ""
|
||||||
}
|
}
|
||||||
|
|
@ -547,7 +547,7 @@ export default class {
|
||||||
callback: `${this.settings.serviceUrl}/api/guest/lnurl_pay/handle?k1=${payInfoK1}`,
|
callback: `${this.settings.serviceUrl}/api/guest/lnurl_pay/handle?k1=${payInfoK1}`,
|
||||||
maxSendable: remote * 1000,
|
maxSendable: remote * 1000,
|
||||||
minSendable: 10000,
|
minSendable: 10000,
|
||||||
metadata: defaultLnurlPayMetadata,
|
metadata: defaultLnurlPayMetadata(this.settings.lnurlMetaText),
|
||||||
allowsNostr: !!key.linkedApplication.nostr_public_key,
|
allowsNostr: !!key.linkedApplication.nostr_public_key,
|
||||||
nostrPubkey: key.linkedApplication.nostr_public_key || ""
|
nostrPubkey: key.linkedApplication.nostr_public_key || ""
|
||||||
}
|
}
|
||||||
|
|
@ -623,7 +623,7 @@ export default class {
|
||||||
}
|
}
|
||||||
const invoice = await this.NewInvoice(key.user.user_id, {
|
const invoice = await this.NewInvoice(key.user.user_id, {
|
||||||
amountSats: sats,
|
amountSats: sats,
|
||||||
memo: zapInfo ? zapInfo.description : defaultLnurlPayMetadata
|
memo: zapInfo ? zapInfo.description : defaultLnurlPayMetadata(this.settings.lnurlMetaText)
|
||||||
}, { expiry: defaultInvoiceExpiry, linkedApplication: key.linkedApplication, zapInfo })
|
}, { expiry: defaultInvoiceExpiry, linkedApplication: key.linkedApplication, zapInfo })
|
||||||
return {
|
return {
|
||||||
pr: invoice.invoice,
|
pr: invoice.invoice,
|
||||||
|
|
@ -636,7 +636,7 @@ export default class {
|
||||||
if (!linkedUser) {
|
if (!linkedUser) {
|
||||||
throw new Error("this address is not linked to any user")
|
throw new Error("this address is not linked to any user")
|
||||||
}
|
}
|
||||||
return this.GetLnurlPayInfoFromUser(linkedUser.user.user_id, linkedUser.application, { metadata: defaultLnAddressMetadata(addressName) })
|
return this.GetLnurlPayInfoFromUser(linkedUser.user.user_id, linkedUser.application, { metadata: defaultLnAddressMetadata(this.settings.lnurlMetaText, addressName) })
|
||||||
}
|
}
|
||||||
|
|
||||||
async OpenChannel(userId: string, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> { throw new Error("WIP") }
|
async OpenChannel(userId: string, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> { throw new Error("WIP") }
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export type MainSettings = {
|
||||||
wizard: boolean
|
wizard: boolean
|
||||||
defaultAppName: string
|
defaultAppName: string
|
||||||
pushBackupsToNostr: boolean
|
pushBackupsToNostr: boolean
|
||||||
|
lnurlMetaText: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BitcoinCoreSettings = {
|
export type BitcoinCoreSettings = {
|
||||||
|
|
@ -70,7 +71,8 @@ export const LoadMainSettingsFromEnv = (): MainSettings => {
|
||||||
disableExternalPayments: process.env.DISABLE_EXTERNAL_PAYMENTS === 'true' || false,
|
disableExternalPayments: process.env.DISABLE_EXTERNAL_PAYMENTS === 'true' || false,
|
||||||
wizard: process.env.WIZARD === 'true' || false,
|
wizard: process.env.WIZARD === 'true' || false,
|
||||||
defaultAppName: process.env.DEFAULT_APP_NAME || "wallet",
|
defaultAppName: process.env.DEFAULT_APP_NAME || "wallet",
|
||||||
pushBackupsToNostr: process.env.PUSH_BACKUPS_TO_NOSTR === 'true' || false
|
pushBackupsToNostr: process.env.PUSH_BACKUPS_TO_NOSTR === 'true' || false,
|
||||||
|
lnurlMetaText: process.env.LNURL_META_TEXT || "lnurl pay to Lightning.pub"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue