Skip to content

Commit

Permalink
Feat: include LSPS1 maximum channel size in frontend (#6)
Browse files Browse the repository at this point in the history
* feat: show maximum channel size for LSPS1 options

* fix: lsps1 ok partner check to also check maximum channel size
  • Loading branch information
rolznz authored Jul 5, 2024
1 parent 32c466e commit 538c1dd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions alby/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
23 changes: 14 additions & 9 deletions frontend/src/screens/channels/IncreaseIncomingCapacity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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" &&
Expand Down Expand Up @@ -264,15 +265,19 @@ function NewChannelInternal({ network }: { network: Network }) {
)}
<div>
{peer.name}
{peer.minimumChannelSize > 0 && (
<span className="ml-4 text-xs text-muted-foreground">
Min.{" "}
{new Intl.NumberFormat().format(
peer.minimumChannelSize
)}{" "}
sats
</span>
)}
<span className="ml-4 text-xs text-muted-foreground">
Min.{" "}
{new Intl.NumberFormat().format(
peer.minimumChannelSize
)}
sats
<span className="mr-10" />
Max.{" "}
{new Intl.NumberFormat().format(
peer.maximumChannelSize
)}{" "}
sats
</span>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function NewChannelInternal({ network }: { network: Network }) {
network,
paymentMethod: "onchain",
minimumChannelSize: 0,
maximumChannelSize: 0,
pubkey: "",
host: "",
image: "",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export type RecommendedChannelPeer = {
image: string;
name: string;
minimumChannelSize: number;
maximumChannelSize: number;
} & (
| {
paymentMethod: "onchain";
Expand Down

0 comments on commit 538c1dd

Please sign in to comment.