Skip to content

Commit

Permalink
Merge branch 'pr/2974' into staging-ln
Browse files Browse the repository at this point in the history
  • Loading branch information
Beerosagos committed Nov 7, 2024
2 parents 63b7894 + a86ec8c commit 5c517a1
Show file tree
Hide file tree
Showing 18 changed files with 215 additions and 195 deletions.
34 changes: 18 additions & 16 deletions backend/lightning/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ type messageSuccessActionDataDto struct {
}

type nodeStateDto struct {
Id string `json:"id"`
BlockHeight uint32 `json:"blockHeight"`
ChannelsBalanceMsat uint64 `json:"channelsBalanceMsat"`
OnchainBalanceMsat uint64 `json:"onchainBalanceMsat"`
PendingOnchainBalanceMsat uint64 `json:"pendingOnchainBalanceMsat"`
Utxos []unspentTransactionOutputDto `json:"utxos"`
MaxPayableMsat uint64 `json:"maxPayableMsat"`
MaxReceivableMsat uint64 `json:"maxReceivableMsat"`
MaxSinglePaymentAmountMsat uint64 `json:"maxSinglePaymentAmountMsat"`
MaxChanReserveMsats uint64 `json:"maxChanReserveMsats"`
ConnectedPeers []string `json:"connectedPeers"`
InboundLiquidityMsats uint64 `json:"inboundLiquidityMsats"`
Id string `json:"id"`
BlockHeight uint32 `json:"blockHeight"`
ChannelsBalanceMsat uint64 `json:"channelsBalanceMsat"`
OnchainBalanceMsat uint64 `json:"onchainBalanceMsat"`
PendingOnchainBalanceMsat uint64 `json:"pendingOnchainBalanceMsat"`
Utxos []unspentTransactionOutputDto `json:"utxos"`
MaxPayableMsat uint64 `json:"maxPayableMsat"`
MaxReceivableMsat uint64 `json:"maxReceivableMsat"`
MaxSinglePaymentAmountMsat uint64 `json:"maxSinglePaymentAmountMsat"`
MaxChanReserveMsats uint64 `json:"maxChanReserveMsats"`
ConnectedPeers []string `json:"connectedPeers"`
MaxReceivableSinglePaymentAmountMsat uint64 `json:"maxReceivableSinglePaymentAmountMsat"`
TotalInboundLiquidityMsats uint64 `json:"totalInboundLiquidityMsats"`
}

type listPaymentsRequestDto struct {
Expand Down Expand Up @@ -191,7 +192,7 @@ type routeHintDto struct {

type routeHintHopDto struct {
SrcNodeId string `json:"srcNodeId"`
ShortChannelId uint64 `json:"shortChannelId"`
ShortChannelId string `json:"shortChannelId"`
FeesBaseMsat uint32 `json:"feesBaseMsat"`
FeesProportionalMillionths uint32 `json:"feesProportionalMillionths"`
CltvExpiryDelta uint64 `json:"cltvExpiryDelta"`
Expand All @@ -200,9 +201,10 @@ type routeHintHopDto struct {
}

type sendPaymentRequestDto struct {
Bolt11 string `json:"bolt11"`
AmountMsat *uint64 `json:"amountMsat"`
Label *string `json:"label"`
Bolt11 string `json:"bolt11"`
UseTrampoline bool `json:"useTrampoline"`
AmountMsat *uint64 `json:"amountMsat"`
Label *string `json:"label"`
}

type sendPaymentResponseDto struct {
Expand Down
7 changes: 4 additions & 3 deletions backend/lightning/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ func toReceivePaymentRequest(receivePaymentRequest receivePaymentRequestDto) bre

func toSendPaymentRequest(sendPaymentRequest sendPaymentRequestDto) breez_sdk.SendPaymentRequest {
return breez_sdk.SendPaymentRequest{
AmountMsat: sendPaymentRequest.AmountMsat,
Bolt11: sendPaymentRequest.Bolt11,
Label: sendPaymentRequest.Label,
AmountMsat: sendPaymentRequest.AmountMsat,
UseTrampoline: sendPaymentRequest.UseTrampoline,
Bolt11: sendPaymentRequest.Bolt11,
Label: sendPaymentRequest.Label,
}
}
25 changes: 13 additions & 12 deletions backend/lightning/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,19 @@ func toNetworkDto(network breez_sdk.Network) (string, error) {

func toNodeStateDto(nodeState breez_sdk.NodeState) nodeStateDto {
return nodeStateDto{
Id: nodeState.Id,
BlockHeight: nodeState.BlockHeight,
ChannelsBalanceMsat: nodeState.ChannelsBalanceMsat,
OnchainBalanceMsat: nodeState.OnchainBalanceMsat,
PendingOnchainBalanceMsat: nodeState.PendingOnchainBalanceMsat,
Utxos: toUnspentTransactionOutputsDto(nodeState.Utxos),
MaxPayableMsat: nodeState.MaxPayableMsat,
MaxReceivableMsat: nodeState.MaxReceivableMsat,
MaxSinglePaymentAmountMsat: nodeState.MaxSinglePaymentAmountMsat,
MaxChanReserveMsats: nodeState.MaxChanReserveMsats,
ConnectedPeers: nodeState.ConnectedPeers,
InboundLiquidityMsats: nodeState.InboundLiquidityMsats,
Id: nodeState.Id,
BlockHeight: nodeState.BlockHeight,
ChannelsBalanceMsat: nodeState.ChannelsBalanceMsat,
OnchainBalanceMsat: nodeState.OnchainBalanceMsat,
PendingOnchainBalanceMsat: nodeState.PendingOnchainBalanceMsat,
Utxos: toUnspentTransactionOutputsDto(nodeState.Utxos),
MaxPayableMsat: nodeState.MaxPayableMsat,
MaxReceivableMsat: nodeState.MaxReceivableMsat,
MaxSinglePaymentAmountMsat: nodeState.MaxSinglePaymentAmountMsat,
MaxChanReserveMsats: nodeState.MaxChanReserveMsats,
ConnectedPeers: nodeState.ConnectedPeers,
MaxReceivableSinglePaymentAmountMsat: nodeState.MaxReceivableSinglePaymentAmountMsat,
TotalInboundLiquidityMsats: nodeState.TotalInboundLiquidityMsats,
}
}

Expand Down
7 changes: 5 additions & 2 deletions frontends/web/src/api/lightning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface LnUrlPayErrorData {
export interface LnUrlPayRequest {
data: LnUrlPayRequestData;
amountMsat: number;
useTrampoline: boolean;
comment?: string;
paymentLabel?: string;
}
Expand Down Expand Up @@ -198,7 +199,8 @@ export interface NodeState {
maxSinglePaymentAmountMsat: number;
maxChanReserveMsats: number;
connectedPeers: string[];
inboundLiquidityMsats: number;
maxReceivableSinglePaymentAmountMsat: number;
totalInboundLiquidityMsats: number;
}

export interface OpenChannelFeeRequest {
Expand Down Expand Up @@ -268,7 +270,7 @@ export interface RouteHint {

export interface RouteHintHop {
srcNodeId: string;
shortChannelId: number;
shortChannelId: string;
feesBaseMsat: number;
feesProportionalMillionths: number;
cltvExpiryDelta: number;
Expand All @@ -278,6 +280,7 @@ export interface RouteHintHop {

export interface SendPaymentRequest {
bolt11: string;
useTrampoline: boolean;
amountMsat?: number;
label?: string;
}
Expand Down
1 change: 1 addition & 0 deletions frontends/web/src/routes/lightning/send/send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export const Send = () => {
case InputTypeVariant.BOLT11:
await postSendPayment({
bolt11: paymentDetails.invoice.bolt11,
useTrampoline: true,
// amountMsat is optional, if amount is missing the UI shows edit-invoice step for the user to enter a custom amountMsat which is passed here
amountMsat: customAmount ? toMsat(customAmount) : undefined
});
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/BitBoxSwiss/bitbox02-api-go v0.0.0-20240925080402-a2115fee878e
github.com/BitBoxSwiss/block-client-go v0.0.0-20240516081043-0d604acd6519
github.com/breez/breez-sdk-go v0.5.2
github.com/breez/breez-sdk-go v0.6.3-rc1
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/breez/breez-sdk-go v0.5.2 h1:frqX14cKTM2egWP7C53u3SzBkYQrgx9P7si/Ig9Droo=
github.com/breez/breez-sdk-go v0.5.2/go.mod h1:EalYMEeQVwRzr6UXnF4QpLlpuWNwQQN9xwtDKNIutBo=
github.com/breez/breez-sdk-go v0.6.3-rc1 h1:LVb7+A6akuEvoHgiODr4a/IUG6evJBLXWyIC5ianjL8=
github.com/breez/breez-sdk-go v0.6.3-rc1/go.mod h1:EalYMEeQVwRzr6UXnF4QpLlpuWNwQQN9xwtDKNIutBo=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
Expand Down
Loading

0 comments on commit 5c517a1

Please sign in to comment.