From 538c1dd884a4fdee7346f0152d9d6ddf257fa9a7 Mon Sep 17 00:00:00 2001 From: Roland <33993199+rolznz@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:26:20 +0700 Subject: [PATCH] Feat: include LSPS1 maximum channel size in frontend (#6) * feat: show maximum channel size for LSPS1 options * fix: lsps1 ok partner check to also check maximum channel size --- alby/models.go | 1 + .../channels/IncreaseIncomingCapacity.tsx | 23 +++++++++++-------- .../channels/IncreaseOutgoingCapacity.tsx | 1 + frontend/src/types.ts | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/alby/models.go b/alby/models.go index 0392a93c..625f8b4e 100644 --- a/alby/models.go +++ b/alby/models.go @@ -52,6 +52,7 @@ type ChannelPeerSuggestion struct { Pubkey string `json:"pubkey"` Host string `json:"host"` MinimumChannelSize uint64 `json:"minimumChannelSize"` + MaximumChannelSize uint64 `json:"maximumChannelSize"` Name string `json:"name"` Image string `json:"image"` BrokenLspUrl string `json:"lsp_url"` diff --git a/frontend/src/screens/channels/IncreaseIncomingCapacity.tsx b/frontend/src/screens/channels/IncreaseIncomingCapacity.tsx index fe55ea01..7296d8fd 100644 --- a/frontend/src/screens/channels/IncreaseIncomingCapacity.tsx +++ b/frontend/src/screens/channels/IncreaseIncomingCapacity.tsx @@ -128,6 +128,7 @@ function NewChannelInternal({ network }: { network: Network }) { const okPartners = channelPeerSuggestions.filter( (partner) => amount >= partner.minimumChannelSize && + amount <= partner.maximumChannelSize && partner.network === network && partner.paymentMethod === "lightning" && partner.lspType === "LSPS1" && @@ -264,15 +265,19 @@ function NewChannelInternal({ network }: { network: Network }) { )}
{peer.name} - {peer.minimumChannelSize > 0 && ( - - Min.{" "} - {new Intl.NumberFormat().format( - peer.minimumChannelSize - )}{" "} - sats - - )} + + Min.{" "} + {new Intl.NumberFormat().format( + peer.minimumChannelSize + )} + sats + + Max.{" "} + {new Intl.NumberFormat().format( + peer.maximumChannelSize + )}{" "} + sats +
diff --git a/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx b/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx index 2fce2778..5e578b8e 100644 --- a/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx +++ b/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx @@ -70,6 +70,7 @@ function NewChannelInternal({ network }: { network: Network }) { network, paymentMethod: "onchain", minimumChannelSize: 0, + maximumChannelSize: 0, pubkey: "", host: "", image: "", diff --git a/frontend/src/types.ts b/frontend/src/types.ts index db6a5b80..b7a7abbd 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -298,6 +298,7 @@ export type RecommendedChannelPeer = { image: string; name: string; minimumChannelSize: number; + maximumChannelSize: number; } & ( | { paymentMethod: "onchain";