From fd0fcefe02b869732ce6b3ae969ba82181d7dba3 Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Thu, 2 May 2024 16:54:43 -0500 Subject: [PATCH 1/3] Consider fedimint balance for on chain sends --- src/routes/Send.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 39f24ab4..7dd22b14 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -248,10 +248,15 @@ export function Send() { }); const maxOnchain = createMemo(() => { - return ( - (state.balance?.confirmed ?? 0n) + - (state.balance?.unconfirmed ?? 0n) - ); + const conf = state.balance?.confirmed ?? 0n; + const unc = state.balance?.unconfirmed ?? 0n; + const fed = state.balance?.federation ?? 0n; + + if (fed > conf + unc) { + return fed; + } else { + return conf + unc; + } }); const maxLightning = createMemo(() => { From 2504e57194b851763fdef9b9229a6d7474c4e6eb Mon Sep 17 00:00:00 2001 From: Tony Giorgio Date: Mon, 6 May 2024 14:43:16 -0500 Subject: [PATCH 2/3] Change tx id to internal for fedimint onchain --- src/components/ActivityDetailsModal.tsx | 85 +++++++++++++------------ src/routes/Receive.tsx | 3 +- 2 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/components/ActivityDetailsModal.tsx b/src/components/ActivityDetailsModal.tsx index a64e5164..dfda31ef 100644 --- a/src/components/ActivityDetailsModal.tsx +++ b/src/components/ActivityDetailsModal.tsx @@ -408,48 +408,53 @@ function OnchainDetails(props: { "Pending" )} - -
- {/* Have to do all these shenanigans because css / html is hard */} -
- + +
+ {/* Have to do all these shenanigans because css / html is hard */} + +
- -
- + + ); diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index 2116a2f4..b93f64cb 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -60,6 +60,7 @@ export type OnChainTx = { }>; }; txid: string; + internal_id: string; received: number; sent: number; confirmation_time: { @@ -213,7 +214,7 @@ export function Receive() { const paymentTxId = paidState() === "onchain_paid" ? paymentTx() - ? paymentTx()?.txid + ? paymentTx()?.internal_id : undefined : paymentInvoice() ? paymentInvoice()?.payment_hash From 2c840933947b6d816b56efa9e883e145186a6c41 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Thu, 9 May 2024 11:56:20 -0500 Subject: [PATCH 3/3] on-chain warnings and hide zero amounts --- public/i18n/en.json | 4 +++- src/components/ActivityDetailsModal.tsx | 2 +- src/components/ReceiveWarnings.tsx | 13 ++++++++++++- src/routes/Receive.tsx | 5 +++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/public/i18n/en.json b/public/i18n/en.json index 888852d5..908ffeb2 100644 --- a/public/i18n/en.json +++ b/public/i18n/en.json @@ -148,7 +148,9 @@ "body": "Lightning receives will automatically go into your chosen federation. You can swap to self-custodial later if you want." }, "receive_strings_error": "Something went wrong generating an invoice or on-chain address.", - "error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger." + "error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger.", + "warning_on_chain_fedi": "On-chain fedimint deposits require 10 confirmations.", + "warning_address_reuse": "Only send to this address once!" }, "send": { "search": { diff --git a/src/components/ActivityDetailsModal.tsx b/src/components/ActivityDetailsModal.tsx index dfda31ef..a9e3c455 100644 --- a/src/components/ActivityDetailsModal.tsx +++ b/src/components/ActivityDetailsModal.tsx @@ -168,7 +168,7 @@ function OnchainHeader(props: { info: OnChainTx; kind?: HackActivityType }) {
- + 0}>
{ + if (props.flavor === "onchain" && state.federations?.length) { + return true; + } + }); + return ( @@ -92,6 +98,11 @@ export function ReceiveWarnings(props: { {warningText()} + + + {i18n.t("receive.warning_on_chain_fedi")} + + ); } diff --git a/src/routes/Receive.tsx b/src/routes/Receive.tsx index b93f64cb..69872be6 100644 --- a/src/routes/Receive.tsx +++ b/src/routes/Receive.tsx @@ -460,6 +460,11 @@ export function Receive() {

{error()}

+ + + {i18n.t("receive.warning_address_reuse")} + +