From daf57b84bf7f5da89cd5123ffaf8b2d3126f1c9e Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Mon, 27 Nov 2023 16:40:13 -0600 Subject: [PATCH] handle channel reserve error --- src/i18n/en/translations.ts | 5 ++++- src/routes/Send.tsx | 14 +++++++++++++- src/routes/settings/Channels.tsx | 5 +---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index f3c7b4fd..3eb5f57d 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -121,6 +121,9 @@ export default { "We do not have enough balance to pay the given amount.", error_invoice_match: "Amount requested, {{amount}} SATS, does not equal amount set.", + error_channel_reserves: "Not enough available funds.", + error_channel_reserves_explained: + "A portion of your channel balance is reserved for fees. Try sending a smaller amount or adding funds.", error_clipboard: "Clipboard not supported", error_keysend: "Keysend failed", error_LNURL: "LNURL Pay failed", @@ -310,7 +313,7 @@ export default { inbound_outbound_tip: "Outbound is the amount of money you can spend on lightning. Inbound is the amount you can receive without incurring a lightning service fee.", reserve_tip: - "About 1% of your channel balance is reserved on lightning for fees.", + "About 1% of your channel balance is reserved on lightning for fees. Additional reserves are required for channels you opened via swap.", no_channels: "It looks like you don't have any channels yet. To get started, receive some sats over lightning, or swap some on-chain funds into a channel. Get your hands dirty!" }, diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index ae03baa5..3fa04ae9 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -1,7 +1,7 @@ import { Clipboard } from "@capacitor/clipboard"; import { Capacitor } from "@capacitor/core"; import { Contact, MutinyInvoice, TagItem } from "@mutinywallet/mutiny-wasm"; -import { useNavigate } from "@solidjs/router"; +import { A, useNavigate } from "@solidjs/router"; import { createEffect, createMemo, @@ -227,6 +227,18 @@ function Failure(props: { reason: string }) { {i18n.t("send.payment_pending_description")} + + +

+ {i18n.t("send.error_channel_reserves")} +

+ + {i18n.t("send.error_channel_reserves_explained")}{" "} + {i18n.t("common.why")} + +

diff --git a/src/routes/settings/Channels.tsx b/src/routes/settings/Channels.tsx index 18b664c5..e0ff38ae 100644 --- a/src/routes/settings/Channels.tsx +++ b/src/routes/settings/Channels.tsx @@ -74,10 +74,7 @@ export function LiquidityMonitor() { let reserve = 0n; for (const channel of channels) { - inbound = - inbound + - BigInt(channel.size) - - BigInt(channel.balance + channel.reserve); + inbound = inbound + BigInt(channel.inbound); reserve = reserve + BigInt(channel.reserve); outbound = outbound + BigInt(channel.balance); }