mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-03 23:04:16 +00:00
Merge pull request #2185 from aftermath2/accept_prefixed_invoices
Support prefixed invoices
This commit is contained in:
@ -34,7 +34,11 @@ import { systemClient } from '../../../services/System';
|
||||
|
||||
import lnproxies from '../../../../static/lnproxies.json';
|
||||
import { type UseAppStoreType, AppContext } from '../../../contexts/AppContext';
|
||||
|
||||
let filteredProxies: Array<Record<string, object>> = [];
|
||||
|
||||
const lightningPrefix: string = 'lightning:';
|
||||
|
||||
export interface LightningForm {
|
||||
invoice: string;
|
||||
amount: number;
|
||||
@ -132,18 +136,26 @@ export const LightningPayoutForm = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (lightning.invoice !== '') {
|
||||
const invoice = lightning.invoice.startsWith(lightningPrefix) ?
|
||||
lightning.invoice.slice(lightningPrefix.length) : lightning.invoice;
|
||||
|
||||
setLightning({
|
||||
...lightning,
|
||||
badInvoice: validateInvoice(lightning.invoice, lightning.amount),
|
||||
invoice: invoice,
|
||||
badInvoice: validateInvoice(invoice, lightning.amount),
|
||||
});
|
||||
}
|
||||
}, [lightning.invoice, lightning.amount]);
|
||||
|
||||
useEffect(() => {
|
||||
if (lightning.lnproxyInvoice !== '') {
|
||||
const invoice = lightning.lnproxyInvoice.startsWith(lightningPrefix) ?
|
||||
lightning.lnproxyInvoice.slice(lightningPrefix.length) : lightning.lnproxyInvoice;
|
||||
|
||||
setLightning({
|
||||
...lightning,
|
||||
badLnproxy: validateInvoice(lightning.lnproxyInvoice, lightning.lnproxyAmount),
|
||||
lnproxyInvoice: invoice,
|
||||
badLnproxy: validateInvoice(invoice, lightning.lnproxyAmount),
|
||||
});
|
||||
}
|
||||
}, [lightning.lnproxyInvoice, lightning.lnproxyAmount]);
|
||||
|
Reference in New Issue
Block a user