Skip to content

Commit 9c34c47

Browse files
committed
cln: added display logic for PREMIUM
Add item to peerSwapPeer to display Premium Rate Ppm. Set the value retrieved from the poll so that it can be checked with the ListPeers command.
1 parent 65dcce8 commit 9c34c47

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

clightning/clightning_commands.go

+13-9
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ type SwapOut struct {
186186
ShortChannelId string `json:"short_channel_id"`
187187
SatAmt uint64 `json:"amt_sat"`
188188
Asset string `json:"asset"`
189-
Force bool `json:"force"`
190189
PremiumLimit int64 `json:"premium_limit"`
190+
Force bool `json:"force"`
191191
cl *ClightningClient `json:"-"`
192192
}
193193

@@ -649,7 +649,9 @@ func (l *ListPeers) Call() (jrpc2.Result, error) {
649649
SatsOut: ReceiverSatsOut,
650650
SatsIn: ReceiverSatsIn,
651651
},
652-
PaidFee: paidFees,
652+
PaidFee: paidFees,
653+
SwapInPremiumRatePpm: p.SwapInPremiumRatePPM,
654+
SwapOutPremiumRatePpm: p.SwapOutPremiumRatePPM,
653655
}
654656

655657
peerSwapPeerChannels := []*PeerSwapPeerChannel{}
@@ -1131,13 +1133,15 @@ type SwapStats struct {
11311133
}
11321134

11331135
type PeerSwapPeer struct {
1134-
NodeId string `json:"nodeid"`
1135-
SwapsAllowed bool `json:"swaps_allowed"`
1136-
SupportedAssets []string `json:"supported_assets"`
1137-
Channels []*PeerSwapPeerChannel `json:"channels"`
1138-
AsSender *SwapStats `json:"sent,omitempty"`
1139-
AsReceiver *SwapStats `json:"received,omitempty"`
1140-
PaidFee uint64 `json:"total_fee_paid,omitempty"`
1136+
NodeId string `json:"nodeid"`
1137+
SwapsAllowed bool `json:"swaps_allowed"`
1138+
SupportedAssets []string `json:"supported_assets"`
1139+
Channels []*PeerSwapPeerChannel `json:"channels"`
1140+
AsSender *SwapStats `json:"sent,omitempty"`
1141+
AsReceiver *SwapStats `json:"received,omitempty"`
1142+
PaidFee uint64 `json:"total_fee_paid,omitempty"`
1143+
SwapInPremiumRatePpm int64
1144+
SwapOutPremiumRatePpm int64
11411145
}
11421146

11431147
// checkFeatures checks if a node runs the peerswap Plugin

swap/swap.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ func (s *SwapData) GetAsset() string {
235235
return ""
236236
}
237237
func (s *SwapData) GetPremium() int64 {
238-
if s.SwapInRequest != nil {
238+
if s.SwapInAgreement != nil {
239239
return s.SwapInAgreement.Premium
240240
}
241-
if s.SwapOutRequest != nil {
241+
if s.SwapOutAgreement != nil {
242242
return s.SwapOutAgreement.Premium
243243
}
244244
return 0

0 commit comments

Comments
 (0)