From 7c9189e7a2224e249d86aba6cdf9340f2a77df43 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Fri, 17 Nov 2023 13:13:36 -0600 Subject: [PATCH] Show lightning address on send screen --- src/i18n/en/translations.ts | 2 +- src/logic/waila.ts | 4 +++- src/routes/Send.tsx | 30 +++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index 89a1cef..a8b6bb5 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -128,7 +128,7 @@ export default { payment_pending_description: "It's taking a while, but it's possible this payment may still go through. Please check 'Activity' for the current status.", hodl_invoice_warning: - "This is a hodl invoice. Payments to hodl invoices can cause in channel force closes, which results in high on-chain fees. Pay at your own risk!" + "This is a hodl invoice. Payments to hodl invoices can cause channel force closes, which results in high on-chain fees. Pay at your own risk!" }, feedback: { header: "Give us feedback!", diff --git a/src/logic/waila.ts b/src/logic/waila.ts index 01329f6..eb27e93 100644 --- a/src/logic/waila.ts +++ b/src/logic/waila.ts @@ -14,6 +14,7 @@ export type ParsedParams = { privateTag?: string; node_pubkey?: string; lnurl?: string; + lightning_address?: string; }; export function toParsedParams( @@ -54,7 +55,8 @@ export function toParsedParams( network, memo: params.memo, node_pubkey: params.node_pubkey, - lnurl: params.lnurl + lnurl: params.lnurl, + lightning_address: params.lightning_address } }; } diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 8c43588..db0efac 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -179,6 +179,7 @@ function DestinationShower(props: { invoice?: MutinyInvoice; nodePubkey?: string; lnurl?: string; + lightning_address?: string; clearAll: () => void; }) { return ( @@ -192,7 +193,18 @@ function DestinationShower(props: { - + + + + @@ -241,6 +253,7 @@ export default function Send() { const [invoice, setInvoice] = createSignal(); const [nodePubkey, setNodePubkey] = createSignal(); const [lnurlp, setLnurlp] = createSignal(); + const [lnAddress, setLnAddress] = createSignal(); const [address, setAddress] = createSignal(); const [description, setDescription] = createSignal(); @@ -267,12 +280,14 @@ export default function Send() { setDestination(undefined); setAmountSats(0n); setIsAmtEditable(true); + setIsHodlInvoice(false); setSource("lightning"); setInvoice(undefined); setAddress(undefined); setDescription(undefined); setNodePubkey(undefined); setLnurlp(undefined); + setLnAddress(undefined); setFieldDestination(""); } @@ -418,6 +433,18 @@ export default function Send() { } else { setAmountSats(source.amount_sats || 0n); } + + // If it is a lightning address, set the address so we can display it + if (source.lightning_address) { + setLnAddress(source.lightning_address); + // check for hodl invoices + setIsHodlInvoice( + source.lightning_address + .toLowerCase() + .includes("zeuspay.com") + ); + } + setLnurlp(source.lnurl); setSource("lightning"); } @@ -736,6 +763,7 @@ export default function Send() { address={address()} nodePubkey={nodePubkey()} lnurl={lnurlp()} + lightning_address={lnAddress()} clearAll={clearAll} />