From cf54215e4fb68e4441a7cf9ce960d0b2b02ae103 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 3 Jun 2024 15:04:34 -0500 Subject: [PATCH] Don't copy lightning: prefix --- src/components/IntegratedQR.tsx | 3 ++- src/routes/Receive.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/IntegratedQR.tsx b/src/components/IntegratedQR.tsx index cab19668..0ad0cee3 100644 --- a/src/components/IntegratedQR.tsx +++ b/src/components/IntegratedQR.tsx @@ -62,6 +62,7 @@ async function share(receiveString: string) { export function IntegratedQr(props: { value: string; + copyString?: string; kind: ReceiveFlavor | "gift" | "lnAddress"; amountSats?: string; }) { @@ -71,7 +72,7 @@ export function IntegratedQr(props: {
copy(props.value)} + onClick={() => copy(props.copyString ?? props.value)} >
diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index ab9d6fae..2637a89b 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -319,6 +319,18 @@ export function Receive() { } }); + // Only copy the raw invoice string for lightning because the lightning prefix is not needed + // for the onchain address we share the whole bip21 uri because it has more information + const copyString = createMemo(() => { + if (receiveState() === "show") { + if (flavor() === "lightning") { + return rawReceiveStrings()?.bolt11; + } else if (flavor() === "onchain") { + return receiveStrings()?.onchain; + } + } + }); + async function checkIfPaid(receiveStrings?: { bolt11?: string; address?: string; @@ -468,6 +480,7 @@ export function Receive() {