chore: remove json tags from lnclient models (#2375)

* chore: remove json tags from lnclient models

these should not be passed through the API directly

* fix: properly return not implemented errors

* fix: json tags on TLVRecord
This commit is contained in:
Roland 2026-05-25 21:56:07 +07:00 committed by GitHub
parent 4053a4a722
commit e3373474f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 386 additions and 217 deletions

View file

@ -834,12 +834,20 @@ func (api *api) Stop() error {
return nil
}
func (api *api) GetNodeConnectionInfo(ctx context.Context) (*lnclient.NodeConnectionInfo, error) {
func (api *api) GetNodeConnectionInfo(ctx context.Context) (*NodeConnectionInfo, error) {
lnClient := api.svc.GetLNClient()
if lnClient == nil {
return nil, ErrLNClientNotStarted
}
return lnClient.GetNodeConnectionInfo(ctx)
info, err := lnClient.GetNodeConnectionInfo(ctx)
if err != nil {
return nil, err
}
return &NodeConnectionInfo{
Pubkey: info.Pubkey,
Address: info.Address,
Port: info.Port,
}, nil
}
func (api *api) RefundSwap(refundSwapRequest *RefundSwapRequest) error {
@ -1127,20 +1135,47 @@ func (api *api) GetSwapMnemonic() string {
return api.keys.GetSwapMnemonic()
}
func (api *api) GetNodeStatus(ctx context.Context) (*lnclient.NodeStatus, error) {
func (api *api) GetNodeStatus(ctx context.Context) (*NodeStatus, error) {
lnClient := api.svc.GetLNClient()
if lnClient == nil {
return nil, ErrLNClientNotStarted
}
return lnClient.GetNodeStatus(ctx)
nodeStatus, err := lnClient.GetNodeStatus(ctx)
if err != nil {
return nil, err
}
if nodeStatus == nil {
return nil, nil
}
return toApiNodeStatus(nodeStatus), nil
}
func (api *api) ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error) {
func toApiNodeStatus(nodeStatus *lnclient.NodeStatus) *NodeStatus {
return &NodeStatus{
IsReady: nodeStatus.IsReady,
InternalNodeStatus: nodeStatus.InternalNodeStatus,
}
}
func (api *api) ListPeers(ctx context.Context) ([]PeerDetails, error) {
lnClient := api.svc.GetLNClient()
if lnClient == nil {
return nil, ErrLNClientNotStarted
}
return lnClient.ListPeers(ctx)
peers, err := lnClient.ListPeers(ctx)
if err != nil {
return nil, err
}
apiPeers := make([]PeerDetails, 0, len(peers))
for _, peer := range peers {
apiPeers = append(apiPeers, PeerDetails{
NodeId: peer.NodeId,
Address: peer.Address,
IsPersisted: peer.IsPersisted,
IsConnected: peer.IsConnected,
})
}
return apiPeers, nil
}
func (api *api) ConnectPeer(ctx context.Context, connectPeerRequest *ConnectPeerRequest) error {
@ -1148,7 +1183,11 @@ func (api *api) ConnectPeer(ctx context.Context, connectPeerRequest *ConnectPeer
if lnClient == nil {
return ErrLNClientNotStarted
}
return lnClient.ConnectPeer(ctx, connectPeerRequest)
return lnClient.ConnectPeer(ctx, &lnclient.ConnectPeerRequest{
Pubkey: connectPeerRequest.Pubkey,
Address: connectPeerRequest.Address,
Port: connectPeerRequest.Port,
})
}
func (api *api) OpenChannel(ctx context.Context, openChannelRequest *OpenChannelRequest) (*OpenChannelResponse, error) {
@ -1156,7 +1195,17 @@ func (api *api) OpenChannel(ctx context.Context, openChannelRequest *OpenChannel
if lnClient == nil {
return nil, ErrLNClientNotStarted
}
return lnClient.OpenChannel(ctx, openChannelRequest)
resp, err := lnClient.OpenChannel(ctx, &lnclient.OpenChannelRequest{
Pubkey: openChannelRequest.Pubkey,
AmountSats: openChannelRequest.AmountSats,
Public: openChannelRequest.Public,
})
if err != nil {
return nil, err
}
return &OpenChannelResponse{
FundingTxId: resp.FundingTxId,
}, nil
}
func (api *api) DisconnectPeer(ctx context.Context, peerId string) error {
@ -1180,11 +1229,15 @@ func (api *api) CloseChannel(ctx context.Context, peerId, channelId string, forc
"channel_id": channelId,
"force": force,
}).Info("Closing channel")
return lnClient.CloseChannel(ctx, &lnclient.CloseChannelRequest{
err := lnClient.CloseChannel(ctx, &lnclient.CloseChannelRequest{
NodeId: peerId,
ChannelId: channelId,
Force: force,
})
if err != nil {
return nil, err
}
return &CloseChannelResponse{}, nil
}
func (api *api) UpdateChannel(ctx context.Context, updateChannelRequest *UpdateChannelRequest) error {
@ -1195,7 +1248,13 @@ func (api *api) UpdateChannel(ctx context.Context, updateChannelRequest *UpdateC
logger.Logger.WithFields(logrus.Fields{
"request": updateChannelRequest,
}).Info("updating channel")
return lnClient.UpdateChannel(ctx, updateChannelRequest)
return lnClient.UpdateChannel(ctx, &lnclient.UpdateChannelRequest{
ChannelId: updateChannelRequest.ChannelId,
NodeId: updateChannelRequest.NodeId,
ForwardingFeeBaseMsat: updateChannelRequest.ForwardingFeeBaseMsat,
ForwardingFeeProportionalMillionths: updateChannelRequest.ForwardingFeeProportionalMillionths,
MaxDustHtlcExposureFromFeeRateMultiplier: updateChannelRequest.MaxDustHtlcExposureFromFeeRateMultiplier,
})
}
func (api *api) MakeOffer(ctx context.Context, description string) (string, error) {
@ -1306,7 +1365,70 @@ func (api *api) GetBalances(ctx context.Context) (*BalancesResponse, error) {
if err != nil {
return nil, err
}
return balances, nil
return toApiBalances(balances), nil
}
func toApiBalances(balances *lnclient.BalancesResponse) *BalancesResponse {
totalSpendableMsat := balances.Lightning.TotalSpendableMsat
totalReceivableMsat := balances.Lightning.TotalReceivableMsat
nextMaxSpendableMsat := balances.Lightning.NextMaxSpendableMsat
nextMaxReceivableMsat := balances.Lightning.NextMaxReceivableMsat
nextMaxSpendableMPPMsat := balances.Lightning.NextMaxSpendableMPPMsat
nextMaxReceivableMPPMsat := balances.Lightning.NextMaxReceivableMPPMsat
return &BalancesResponse{
Onchain: OnchainBalanceResponse{
Spendable: balances.Onchain.SpendableSat,
SpendableSat: balances.Onchain.SpendableSat,
Total: balances.Onchain.TotalSat,
TotalSat: balances.Onchain.TotalSat,
Reserved: balances.Onchain.ReservedSat,
ReservedSat: balances.Onchain.ReservedSat,
PendingBalancesFromChannelClosures: balances.Onchain.PendingBalancesFromChannelClosuresSat,
PendingBalancesFromChannelClosuresSat: balances.Onchain.PendingBalancesFromChannelClosuresSat,
PendingBalancesDetails: toApiPendingBalanceDetails(balances.Onchain.PendingBalancesDetails),
PendingSweepBalancesDetails: toApiPendingBalanceDetails(balances.Onchain.PendingSweepBalancesDetails),
InternalBalances: balances.Onchain.InternalBalances,
},
Lightning: LightningBalanceResponse{
TotalSpendable: totalSpendableMsat,
TotalSpendableSat: totalSpendableMsat / 1000,
TotalSpendableMsat: totalSpendableMsat,
TotalReceivable: totalReceivableMsat,
TotalReceivableSat: totalReceivableMsat / 1000,
TotalReceivableMsat: totalReceivableMsat,
NextMaxSpendable: nextMaxSpendableMsat,
NextMaxSpendableSat: nextMaxSpendableMsat / 1000,
NextMaxSpendableMsat: nextMaxSpendableMsat,
NextMaxReceivable: nextMaxReceivableMsat,
NextMaxReceivableSat: nextMaxReceivableMsat / 1000,
NextMaxReceivableMsat: nextMaxReceivableMsat,
NextMaxSpendableMPP: nextMaxSpendableMPPMsat,
NextMaxSpendableMPPSat: nextMaxSpendableMPPMsat / 1000,
NextMaxSpendableMPPMsat: nextMaxSpendableMPPMsat,
NextMaxReceivableMPP: nextMaxReceivableMPPMsat,
NextMaxReceivableMPPSat: nextMaxReceivableMPPMsat / 1000,
NextMaxReceivableMPPMsat: nextMaxReceivableMPPMsat,
},
}
}
func toApiPendingBalanceDetails(details []lnclient.PendingBalanceDetails) []PendingBalanceDetails {
if details == nil {
return nil
}
apiDetails := make([]PendingBalanceDetails, 0, len(details))
for _, d := range details {
apiDetails = append(apiDetails, PendingBalanceDetails{
ChannelId: d.ChannelId,
NodeId: d.NodeId,
Amount: d.AmountSat,
AmountSat: d.AmountSat,
FundingTxId: d.FundingTxId,
FundingTxVout: d.FundingTxVout,
})
}
return apiDetails
}
// TODO: remove dependency on this endpoint
@ -1738,12 +1860,27 @@ func (api *api) SyncWallet() error {
lnClient.UpdateLastWalletSyncRequest()
return nil
}
func (api *api) ListOnchainTransactions(ctx context.Context) ([]lnclient.OnchainTransaction, error) {
func (api *api) ListOnchainTransactions(ctx context.Context) ([]OnchainTransaction, error) {
lnClient := api.svc.GetLNClient()
if lnClient == nil {
return nil, ErrLNClientNotStarted
}
return lnClient.ListOnchainTransactions(ctx)
transactions, err := lnClient.ListOnchainTransactions(ctx)
if err != nil {
return nil, err
}
apiTransactions := make([]OnchainTransaction, 0, len(transactions))
for _, t := range transactions {
apiTransactions = append(apiTransactions, OnchainTransaction{
AmountSat: t.AmountSat,
CreatedAt: t.CreatedAt,
State: t.State,
Type: t.Type,
NumConfirmations: t.NumConfirmations,
TxId: t.TxId,
})
}
return apiTransactions, nil
}
func (api *api) GetLogOutput(ctx context.Context, logType string, getLogRequest *GetLogOutputRequest) (*GetLogOutputResponse, error) {
@ -1819,7 +1956,11 @@ func (api *api) Health(ctx context.Context) (*HealthResponse, error) {
if lnClient != nil {
nodeStatus, _ := lnClient.GetNodeStatus(ctx)
if nodeStatus == nil || !nodeStatus.IsReady {
alarms = append(alarms, NewHealthAlarm(HealthAlarmKindNodeNotReady, nodeStatus))
var apiNodeStatus *NodeStatus
if nodeStatus != nil {
apiNodeStatus = toApiNodeStatus(nodeStatus)
}
alarms = append(alarms, NewHealthAlarm(HealthAlarmKindNodeNotReady, apiNodeStatus))
}
channels, err := lnClient.ListChannels(ctx)

View file

@ -8,7 +8,6 @@ import (
"github.com/getAlby/hub/alby"
"github.com/getAlby/hub/db"
"github.com/getAlby/hub/lnclient"
"github.com/getAlby/hub/swaps"
)
@ -28,9 +27,9 @@ type API interface {
ChangeUnlockPassword(changeUnlockPasswordRequest *ChangeUnlockPasswordRequest) error
SetAutoUnlockPassword(unlockPassword string) error
Stop() error
GetNodeConnectionInfo(ctx context.Context) (*lnclient.NodeConnectionInfo, error)
GetNodeStatus(ctx context.Context) (*lnclient.NodeStatus, error)
ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error)
GetNodeConnectionInfo(ctx context.Context) (*NodeConnectionInfo, error)
GetNodeStatus(ctx context.Context) (*NodeStatus, error)
ListPeers(ctx context.Context) ([]PeerDetails, error)
ConnectPeer(ctx context.Context, connectPeerRequest *ConnectPeerRequest) error
DisconnectPeer(ctx context.Context, peerId string) error
OpenChannel(ctx context.Context, openChannelRequest *OpenChannelRequest) (*OpenChannelResponse, error)
@ -44,7 +43,7 @@ type API interface {
RedeemOnchainFunds(ctx context.Context, toAddress string, amountSat uint64, feeRate *uint64, sendAll bool) (*RedeemOnchainFundsResponse, error)
GetBalances(ctx context.Context) (*BalancesResponse, error)
ListTransactions(ctx context.Context, appId *uint, limit uint64, offset uint64) (*ListTransactionsResponse, error)
ListOnchainTransactions(ctx context.Context) ([]lnclient.OnchainTransaction, error)
ListOnchainTransactions(ctx context.Context) ([]OnchainTransaction, error)
SendPayment(ctx context.Context, invoice string, amountMsat *uint64, metadata map[string]interface{}, fromAppId *uint) (*SendPaymentResponse, error)
CreateInvoice(ctx context.Context, amountMsat uint64, description string) (*MakeInvoiceResponse, error)
LookupInvoice(ctx context.Context, paymentHash string) (*LookupInvoiceResponse, error)
@ -361,11 +360,68 @@ type AutoUnlockRequest struct {
UnlockPassword string `json:"unlockPassword"`
}
type ConnectPeerRequest = lnclient.ConnectPeerRequest
type OpenChannelRequest = lnclient.OpenChannelRequest
type OpenChannelResponse = lnclient.OpenChannelResponse
type CloseChannelResponse = lnclient.CloseChannelResponse
type UpdateChannelRequest = lnclient.UpdateChannelRequest
type ConnectPeerRequest struct {
Pubkey string `json:"pubkey"`
Address string `json:"address"`
Port uint16 `json:"port"`
}
type OpenChannelRequest struct {
Pubkey string `json:"pubkey"`
AmountSats int64 `json:"amountSats"`
Public bool `json:"public"`
}
type OpenChannelResponse struct {
FundingTxId string `json:"fundingTxId"`
}
type CloseChannelResponse struct {
}
type UpdateChannelRequest struct {
ChannelId string `json:"channelId"`
NodeId string `json:"nodeId"`
ForwardingFeeBaseMsat uint32 `json:"forwardingFeeBaseMsat"`
ForwardingFeeProportionalMillionths uint32 `json:"forwardingFeeProportionalMillionths"`
MaxDustHtlcExposureFromFeeRateMultiplier uint64 `json:"maxDustHtlcExposureFromFeeRateMultiplier"`
}
type NodeConnectionInfo struct {
Pubkey string `json:"pubkey"`
Address string `json:"address"`
Port int `json:"port"`
}
type NodeStatus struct {
IsReady bool `json:"isReady"`
InternalNodeStatus interface{} `json:"internalNodeStatus"`
}
type PeerDetails struct {
NodeId string `json:"nodeId"`
Address string `json:"address"`
IsPersisted bool `json:"isPersisted"`
IsConnected bool `json:"isConnected"`
}
type OnchainTransaction struct {
AmountSat uint64 `json:"amountSat"`
CreatedAt uint64 `json:"createdAt"`
State string `json:"state"`
Type string `json:"type"`
NumConfirmations uint32 `json:"numConfirmations"`
TxId string `json:"txId"`
}
type PendingBalanceDetails struct {
ChannelId string `json:"channelId"`
NodeId string `json:"nodeId"`
Amount uint64 `json:"amount"` // deprecated
AmountSat uint64 `json:"amountSat"`
FundingTxId string `json:"fundingTxId"`
FundingTxVout uint32 `json:"fundingTxVout"`
}
type RebalanceChannelRequest struct {
ReceiveThroughNodePubkey string `json:"receiveThroughNodePubkey"`
@ -389,8 +445,45 @@ type RedeemOnchainFundsResponse struct {
TxId string `json:"txId"`
}
type OnchainBalanceResponse = lnclient.OnchainBalanceResponse
type BalancesResponse = lnclient.BalancesResponse
type OnchainBalanceResponse struct {
Spendable int64 `json:"spendable"` // deprecated
SpendableSat int64 `json:"spendableSat"`
Total int64 `json:"total"` // deprecated
TotalSat int64 `json:"totalSat"`
Reserved int64 `json:"reserved"` // deprecated
ReservedSat int64 `json:"reservedSat"`
PendingBalancesFromChannelClosures uint64 `json:"pendingBalancesFromChannelClosures"` // deprecated
PendingBalancesFromChannelClosuresSat uint64 `json:"pendingBalancesFromChannelClosuresSat"`
PendingBalancesDetails []PendingBalanceDetails `json:"pendingBalancesDetails"`
PendingSweepBalancesDetails []PendingBalanceDetails `json:"pendingSweepBalancesDetails"`
InternalBalances interface{} `json:"internalBalances"`
}
type LightningBalanceResponse struct {
TotalSpendable int64 `json:"totalSpendable"` // deprecated
TotalSpendableSat int64 `json:"totalSpendableSat"`
TotalSpendableMsat int64 `json:"totalSpendableMsat"`
TotalReceivable int64 `json:"totalReceivable"` // deprecated
TotalReceivableSat int64 `json:"totalReceivableSat"`
TotalReceivableMsat int64 `json:"totalReceivableMsat"`
NextMaxSpendable int64 `json:"nextMaxSpendable"` // deprecated
NextMaxSpendableSat int64 `json:"nextMaxSpendableSat"`
NextMaxSpendableMsat int64 `json:"nextMaxSpendableMsat"`
NextMaxReceivable int64 `json:"nextMaxReceivable"` // deprecated
NextMaxReceivableSat int64 `json:"nextMaxReceivableSat"`
NextMaxReceivableMsat int64 `json:"nextMaxReceivableMsat"`
NextMaxSpendableMPP int64 `json:"nextMaxSpendableMPP"` // deprecated
NextMaxSpendableMPPSat int64 `json:"nextMaxSpendableMPPSat"`
NextMaxSpendableMPPMsat int64 `json:"nextMaxSpendableMPPMsat"`
NextMaxReceivableMPP int64 `json:"nextMaxReceivableMPP"` // deprecated
NextMaxReceivableMPPSat int64 `json:"nextMaxReceivableMPPSat"`
NextMaxReceivableMPPMsat int64 `json:"nextMaxReceivableMPPMsat"`
}
type BalancesResponse struct {
Onchain OnchainBalanceResponse `json:"onchain"`
Lightning LightningBalanceResponse `json:"lightning"`
}
type SendPaymentResponse = Transaction
type MakeInvoiceResponse = Transaction
@ -503,7 +596,7 @@ type BasicRestoreWailsRequest struct {
UnlockPassword string `json:"unlockPassword"`
}
type NetworkGraphResponse = lnclient.NetworkGraphResponse
type NetworkGraphResponse = interface{}
type LSPOrderRequest struct {
Amount *uint64 `json:"amount"` // deprecated

View file

@ -171,19 +171,19 @@ func (cs *CashuService) GetNodeConnectionInfo(ctx context.Context) (nodeConnecti
}
func (cs *CashuService) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error {
return nil
return errors.New("not implemented")
}
func (cs *CashuService) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}
func (cs *CashuService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
return nil, nil
func (cs *CashuService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
return errors.New("not implemented")
}
func (cs *CashuService) GetNewOnchainAddress(ctx context.Context) (string, error) {
return "", nil
return "", errors.New("not implemented")
}
func (cs *CashuService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBalanceResponse, error) {
@ -191,7 +191,7 @@ func (cs *CashuService) GetOnchainBalance(ctx context.Context) (*lnclient.Onchai
}
func (cs *CashuService) RedeemOnchainFunds(ctx context.Context, toAddress string, amountSat uint64, feeRate *uint64, sendAll bool) (string, error) {
return "", nil
return "", errors.New("not implemented")
}
func (cs *CashuService) ResetRouter(key string) error {
@ -218,11 +218,11 @@ func (cs *CashuService) ResetRouter(key string) error {
}
func (cs *CashuService) SignMessage(ctx context.Context, message string) (string, error) {
return "", nil
return "", errors.New("not implemented")
}
func (cs *CashuService) DisconnectPeer(ctx context.Context, peerId string) error {
return nil
return errors.New("not implemented")
}
func (cs *CashuService) ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error) {
@ -247,7 +247,7 @@ func (cs *CashuService) GetNodeStatus(ctx context.Context) (nodeStatus *lnclient
}
func (cs *CashuService) UpdateChannel(ctx context.Context, updateChannelRequest *lnclient.UpdateChannelRequest) error {
return nil
return errors.New("not implemented")
}
func (cs *CashuService) GetBalances(ctx context.Context, includeInactiveChannels bool) (*lnclient.BalancesResponse, error) {
@ -259,14 +259,8 @@ func (cs *CashuService) GetBalances(ctx context.Context, includeInactiveChannels
PendingBalancesDetails: []lnclient.PendingBalanceDetails{},
PendingSweepBalancesDetails: []lnclient.PendingBalanceDetails{}},
Lightning: lnclient.LightningBalanceResponse{
TotalSpendable: balance,
TotalSpendableSat: balance / 1000,
TotalSpendableMsat: balance,
NextMaxSpendable: balance,
NextMaxSpendableSat: balance / 1000,
NextMaxSpendableMsat: balance,
NextMaxSpendableMPP: balance,
NextMaxSpendableMPPSat: balance / 1000,
NextMaxSpendableMPPMsat: balance,
},
}, nil

View file

@ -882,7 +882,7 @@ func clnHoldInvoiceToTransaction(invoice *clngrpcHold.Invoice, decodedInvoice *c
return tx, nil
}
func (c *CLNService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
func (c *CLNService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
logger.Logger.WithFields(logrus.Fields{
"closeChannelRequest": closeChannelRequest,
}).Debug("Closing Channel")
@ -901,10 +901,10 @@ func (c *CLNService) CloseChannel(ctx context.Context, closeChannelRequest *lncl
_, err := c.client.Close(ctx, req)
if err != nil {
logger.Logger.WithError(err).Error("Failed to close channel")
return nil, fmt.Errorf("close failed: %w", err)
return fmt.Errorf("close failed: %w", err)
}
return &lnclient.CloseChannelResponse{}, err
return nil
}
func (c *CLNService) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error {

View file

@ -1093,7 +1093,7 @@ func (ls *LDKService) UpdateChannel(ctx context.Context, updateChannelRequest *l
return nil
}
func (ls *LDKService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
func (ls *LDKService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
logger.Logger.WithFields(logrus.Fields{
"request": closeChannelRequest,
}).Info("Closing Channel")
@ -1106,9 +1106,9 @@ func (ls *LDKService) CloseChannel(ctx context.Context, closeChannelRequest *lnc
}
if err != nil {
logger.Logger.WithError(err).Error("CloseChannel failed")
return nil, err
return err
}
return &lnclient.CloseChannelResponse{}, nil
return nil
}
func (ls *LDKService) GetNewOnchainAddress(ctx context.Context) (string, error) {
@ -1149,7 +1149,6 @@ func (ls *LDKService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainB
pendingBalancesDetails = append(pendingBalancesDetails, lnclient.PendingBalanceDetails{
NodeId: nodeId,
ChannelId: channelId,
Amount: amountSat,
AmountSat: amountSat,
FundingTxId: fundingTxId,
FundingTxVout: uint32(fundingTxIndex),
@ -1186,7 +1185,6 @@ func (ls *LDKService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainB
pendingSweepBalanceDetails = append(pendingSweepBalanceDetails, lnclient.PendingBalanceDetails{
NodeId: *nodeId,
ChannelId: *channelId,
Amount: amountSat,
AmountSat: amountSat,
FundingTxId: *fundingTxId,
FundingTxVout: uint32(*fundingTxIndex),
@ -1212,13 +1210,9 @@ func (ls *LDKService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainB
}
return &lnclient.OnchainBalanceResponse{
Spendable: int64(balances.SpendableOnchainBalanceSats),
SpendableSat: int64(balances.SpendableOnchainBalanceSats),
Total: int64(balances.TotalOnchainBalanceSats - balances.TotalAnchorChannelsReserveSats),
TotalSat: int64(balances.TotalOnchainBalanceSats - balances.TotalAnchorChannelsReserveSats),
Reserved: int64(balances.TotalAnchorChannelsReserveSats),
ReservedSat: int64(balances.TotalAnchorChannelsReserveSats),
PendingBalancesFromChannelClosures: pendingBalancesFromChannelClosuresSat,
PendingBalancesFromChannelClosuresSat: pendingBalancesFromChannelClosuresSat,
PendingBalancesDetails: pendingBalancesDetails,
PendingSweepBalancesDetails: pendingSweepBalanceDetails,
@ -1598,7 +1592,7 @@ func (ls *LDKService) handleLdkEvent(event *ldk_node.Event) {
fundingTxId = details.FundingTxId
fundingTxVout = details.FundingTxVout
fundingTxUrl = fmt.Sprintf("https://mempool.space/tx/%s#flow=&vout=%d", fundingTxId, fundingTxVout)
pendingBalance += details.Amount
pendingBalance += details.AmountSat
}
}
for _, details := range onchainBalance.PendingSweepBalancesDetails {
@ -1606,7 +1600,7 @@ func (ls *LDKService) handleLdkEvent(event *ldk_node.Event) {
fundingTxId = details.FundingTxId
fundingTxVout = details.FundingTxVout
fundingTxUrl = fmt.Sprintf("https://mempool.space/tx/%s#flow=&vout=%d", fundingTxId, fundingTxVout)
pendingBalance += details.Amount
pendingBalance += details.AmountSat
}
}
}
@ -1868,23 +1862,11 @@ func (ls *LDKService) GetBalances(ctx context.Context, includeInactiveChannels b
return &lnclient.BalancesResponse{
Onchain: *onchainBalance,
Lightning: lnclient.LightningBalanceResponse{
TotalSpendable: totalSpendable,
TotalSpendableSat: totalSpendable / 1000,
TotalSpendableMsat: totalSpendable,
TotalReceivable: totalReceivable,
TotalReceivableSat: totalReceivable / 1000,
TotalReceivableMsat: totalReceivable,
NextMaxSpendable: nextMaxSpendable,
NextMaxSpendableSat: nextMaxSpendable / 1000,
NextMaxSpendableMsat: nextMaxSpendable,
NextMaxReceivable: nextMaxReceivable,
NextMaxReceivableSat: nextMaxReceivable / 1000,
NextMaxReceivableMsat: nextMaxReceivable,
NextMaxSpendableMPP: nextMaxSpendableMPP,
NextMaxSpendableMPPSat: nextMaxSpendableMPP / 1000,
NextMaxSpendableMPPMsat: nextMaxSpendableMPP,
NextMaxReceivableMPP: nextMaxReceivableMPP,
NextMaxReceivableMPPSat: nextMaxReceivableMPP / 1000,
NextMaxReceivableMPPMsat: nextMaxReceivableMPP,
},
}, nil

View file

@ -1169,7 +1169,7 @@ func (svc *LNDService) UpdateChannel(ctx context.Context, updateChannelRequest *
return nil
}
func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
logger.Logger.WithFields(logrus.Fields{
"request": closeChannelRequest,
}).Info("Closing Channel")
@ -1177,7 +1177,7 @@ func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *ln
resp, err := svc.client.ListChannels(ctx, &lnrpc.ListChannelsRequest{})
if err != nil {
logger.Logger.WithError(err).Error("Failed to fetch channels")
return nil, err
return err
}
var foundChannel *lnrpc.Channel
@ -1191,12 +1191,12 @@ func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *ln
if foundChannel == nil {
logger.Logger.WithField("request", closeChannelRequest).Error("Failed to find channel to close")
return nil, errors.New("no channel exists with the given id")
return errors.New("no channel exists with the given id")
}
channelPoint, err := svc.parseChannelPoint(foundChannel.ChannelPoint)
if err != nil {
return nil, err
return err
}
stream, err := svc.client.CloseChannel(ctx, &lnrpc.CloseChannelRequest{
@ -1205,13 +1205,13 @@ func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *ln
})
if err != nil {
logger.Logger.WithField("request", closeChannelRequest).WithError(err).Error("Failed to close channel")
return nil, err
return err
}
for {
resp, err := stream.Recv()
if err != nil {
return nil, err
return err
}
switch update := resp.Update.(type) {
@ -1219,13 +1219,13 @@ func (svc *LNDService) CloseChannel(ctx context.Context, closeChannelRequest *ln
closingHash := update.ClosePending.Txid
txid, err := chainhash.NewHash(closingHash)
if err != nil {
return nil, err
return err
}
logger.Logger.WithFields(logrus.Fields{
"closingTxid": txid.String(),
}).Info("Channel close pending")
// TODO: return the closing tx id or fire an event
return &lnclient.CloseChannelResponse{}, nil
return nil
}
}
}
@ -1263,7 +1263,6 @@ func (svc *LNDService) GetOnchainBalance(ctx context.Context) (*lnclient.Onchain
}
pendingBalancesDetails = append(pendingBalancesDetails, lnclient.PendingBalanceDetails{
NodeId: closingChannel.Channel.RemoteNodePub,
Amount: uint64(closingChannel.LimboBalance),
AmountSat: uint64(closingChannel.LimboBalance),
FundingTxId: channelPoint.GetFundingTxidStr(),
FundingTxVout: channelPoint.GetOutputIndex(),
@ -1274,13 +1273,9 @@ func (svc *LNDService) GetOnchainBalance(ctx context.Context) (*lnclient.Onchain
"balances": balances,
}).Debug("Listed Balances")
return &lnclient.OnchainBalanceResponse{
Spendable: int64(balances.ConfirmedBalance),
SpendableSat: int64(balances.ConfirmedBalance),
Total: int64(balances.TotalBalance),
TotalSat: int64(balances.TotalBalance),
Reserved: int64(balances.ReservedBalanceAnchorChan),
ReservedSat: int64(balances.ReservedBalanceAnchorChan),
PendingBalancesFromChannelClosures: pendingBalancesFromChannelClosures,
PendingBalancesFromChannelClosuresSat: pendingBalancesFromChannelClosures,
PendingBalancesDetails: pendingBalancesDetails,
PendingSweepBalancesDetails: []lnclient.PendingBalanceDetails{},
@ -1446,23 +1441,11 @@ func (svc *LNDService) GetBalances(ctx context.Context, includeInactiveChannels
return &lnclient.BalancesResponse{
Onchain: *onchainBalance,
Lightning: lnclient.LightningBalanceResponse{
TotalSpendable: totalSpendable,
TotalSpendableSat: totalSpendable / 1000,
TotalSpendableMsat: totalSpendable,
TotalReceivable: totalReceivable,
TotalReceivableSat: totalReceivable / 1000,
TotalReceivableMsat: totalReceivable,
NextMaxSpendable: nextMaxSpendable,
NextMaxSpendableSat: nextMaxSpendable / 1000,
NextMaxSpendableMsat: nextMaxSpendable,
NextMaxReceivable: nextMaxReceivable,
NextMaxReceivableSat: nextMaxReceivable / 1000,
NextMaxReceivableMsat: nextMaxReceivable,
NextMaxSpendableMPP: nextMaxSpendableMPP,
NextMaxSpendableMPPSat: nextMaxSpendableMPP / 1000,
NextMaxSpendableMPPMsat: nextMaxSpendableMPP,
NextMaxReceivableMPP: nextMaxReceivableMPP,
NextMaxReceivableMPPSat: nextMaxReceivableMPP / 1000,
NextMaxReceivableMPPMsat: nextMaxReceivableMPP,
},
}, nil

View file

@ -5,8 +5,9 @@ import (
"errors"
)
// TODO: remove JSON tags from these models (LNClient models should not be exposed directly)
// TLVRecord JSON tags are kept because values flow through the freeform
// transaction Metadata blob and are surfaced to NIP-47 clients via
// lookup_invoice / list_transactions.
type TLVRecord struct {
Type uint64 `json:"type"`
// hex-encoded value
@ -42,18 +43,18 @@ type Transaction struct {
}
type OnchainTransaction struct {
AmountSat uint64 `json:"amountSat"`
CreatedAt uint64 `json:"createdAt"`
State string `json:"state"`
Type string `json:"type"`
NumConfirmations uint32 `json:"numConfirmations"`
TxId string `json:"txId"`
AmountSat uint64
CreatedAt uint64
State string
Type string
NumConfirmations uint32
TxId string
}
type NodeConnectionInfo struct {
Pubkey string `json:"pubkey"`
Address string `json:"address"`
Port int `json:"port"`
Pubkey string
Address string
Port int
}
type LNClient interface {
@ -73,7 +74,7 @@ type LNClient interface {
GetNodeStatus(ctx context.Context) (nodeStatus *NodeStatus, err error)
ConnectPeer(ctx context.Context, connectPeerRequest *ConnectPeerRequest) error
OpenChannel(ctx context.Context, openChannelRequest *OpenChannelRequest) (*OpenChannelResponse, error)
CloseChannel(ctx context.Context, closeChannelRequest *CloseChannelRequest) (*CloseChannelResponse, error)
CloseChannel(ctx context.Context, closeChannelRequest *CloseChannelRequest) error
UpdateChannel(ctx context.Context, updateChannelRequest *UpdateChannelRequest) error
DisconnectPeer(ctx context.Context, peerId string) error
MakeOffer(ctx context.Context, description string) (string, error)
@ -116,111 +117,91 @@ type Channel struct {
}
type NodeStatus struct {
IsReady bool `json:"isReady"`
InternalNodeStatus interface{} `json:"internalNodeStatus"`
IsReady bool
InternalNodeStatus interface{}
}
type ConnectPeerRequest struct {
Pubkey string `json:"pubkey"`
Address string `json:"address"`
Port uint16 `json:"port"`
Pubkey string
Address string
Port uint16
}
type OpenChannelRequest struct {
Pubkey string `json:"pubkey"`
AmountSats int64 `json:"amountSats"`
Public bool `json:"public"`
Pubkey string
AmountSats int64
Public bool
}
type OpenChannelResponse struct {
FundingTxId string `json:"fundingTxId"`
FundingTxId string
}
type CloseChannelRequest struct {
ChannelId string `json:"channelId"`
NodeId string `json:"nodeId"`
Force bool `json:"force"`
ChannelId string
NodeId string
Force bool
}
type UpdateChannelRequest struct {
ChannelId string `json:"channelId"`
NodeId string `json:"nodeId"`
ForwardingFeeBaseMsat uint32 `json:"forwardingFeeBaseMsat"`
ForwardingFeeProportionalMillionths uint32 `json:"forwardingFeeProportionalMillionths"`
MaxDustHtlcExposureFromFeeRateMultiplier uint64 `json:"maxDustHtlcExposureFromFeeRateMultiplier"`
}
type CloseChannelResponse struct {
ChannelId string
NodeId string
ForwardingFeeBaseMsat uint32
ForwardingFeeProportionalMillionths uint32
MaxDustHtlcExposureFromFeeRateMultiplier uint64
}
type PendingBalanceDetails struct {
ChannelId string `json:"channelId"`
NodeId string `json:"nodeId"`
Amount uint64 `json:"amount"` // deprecated
AmountSat uint64 `json:"amountSat"`
FundingTxId string `json:"fundingTxId"`
FundingTxVout uint32 `json:"fundingTxVout"`
ChannelId string
NodeId string
AmountSat uint64
FundingTxId string
FundingTxVout uint32
}
type OnchainBalanceResponse struct {
Spendable int64 `json:"spendable"` // deprecated
SpendableSat int64 `json:"spendableSat"`
Total int64 `json:"total"` // deprecated
TotalSat int64 `json:"totalSat"`
Reserved int64 `json:"reserved"` // deprecated
ReservedSat int64 `json:"reservedSat"`
PendingBalancesFromChannelClosures uint64 `json:"pendingBalancesFromChannelClosures"` // deprecated
PendingBalancesFromChannelClosuresSat uint64 `json:"pendingBalancesFromChannelClosuresSat"`
PendingBalancesDetails []PendingBalanceDetails `json:"pendingBalancesDetails"`
PendingSweepBalancesDetails []PendingBalanceDetails `json:"pendingSweepBalancesDetails"`
InternalBalances interface{} `json:"internalBalances"`
SpendableSat int64
TotalSat int64
ReservedSat int64
PendingBalancesFromChannelClosuresSat uint64
PendingBalancesDetails []PendingBalanceDetails
PendingSweepBalancesDetails []PendingBalanceDetails
InternalBalances interface{}
}
type PeerDetails struct {
NodeId string `json:"nodeId"`
Address string `json:"address"`
IsPersisted bool `json:"isPersisted"`
IsConnected bool `json:"isConnected"`
NodeId string
Address string
IsPersisted bool
IsConnected bool
}
type LightningBalanceResponse struct {
TotalSpendable int64 `json:"totalSpendable"` // deprecated
TotalSpendableSat int64 `json:"totalSpendableSat"`
TotalSpendableMsat int64 `json:"totalSpendableMsat"`
TotalReceivable int64 `json:"totalReceivable"` // deprecated
TotalReceivableSat int64 `json:"totalReceivableSat"`
TotalReceivableMsat int64 `json:"totalReceivableMsat"`
NextMaxSpendable int64 `json:"nextMaxSpendable"` // deprecated
NextMaxSpendableSat int64 `json:"nextMaxSpendableSat"`
NextMaxSpendableMsat int64 `json:"nextMaxSpendableMsat"`
NextMaxReceivable int64 `json:"nextMaxReceivable"` // deprecated
NextMaxReceivableSat int64 `json:"nextMaxReceivableSat"`
NextMaxReceivableMsat int64 `json:"nextMaxReceivableMsat"`
NextMaxSpendableMPP int64 `json:"nextMaxSpendableMPP"` // deprecated
NextMaxSpendableMPPSat int64 `json:"nextMaxSpendableMPPSat"`
NextMaxSpendableMPPMsat int64 `json:"nextMaxSpendableMPPMsat"`
NextMaxReceivableMPP int64 `json:"nextMaxReceivableMPP"` // deprecated
NextMaxReceivableMPPSat int64 `json:"nextMaxReceivableMPPSat"`
NextMaxReceivableMPPMsat int64 `json:"nextMaxReceivableMPPMsat"`
TotalSpendableMsat int64
TotalReceivableMsat int64
NextMaxSpendableMsat int64
NextMaxReceivableMsat int64
NextMaxSpendableMPPMsat int64
NextMaxReceivableMPPMsat int64
}
type PayInvoiceResponse struct {
Preimage string `json:"preimage"`
FeeMsat uint64 `json:"feeMsat"`
Preimage string
FeeMsat uint64
}
type PayOfferResponse = struct {
Preimage string `json:"preimage"`
FeeMsat uint64 `json:"feeMsat"`
PaymentHash string `json:"paymentHash"`
Preimage string
FeeMsat uint64
PaymentHash string
}
type PayKeysendResponse struct {
FeeMsat uint64 `json:"feeMsat"`
FeeMsat uint64
}
type BalancesResponse struct {
Onchain OnchainBalanceResponse `json:"onchain"`
Lightning LightningBalanceResponse `json:"lightning"`
Onchain OnchainBalanceResponse
Lightning LightningBalanceResponse
}
type NetworkGraphResponse = interface{}

View file

@ -131,14 +131,8 @@ func (svc *PhoenixService) GetBalances(ctx context.Context, includeInactiveChann
PendingBalancesDetails: []lnclient.PendingBalanceDetails{},
PendingSweepBalancesDetails: []lnclient.PendingBalanceDetails{}},
Lightning: lnclient.LightningBalanceResponse{
TotalSpendable: balance,
TotalSpendableSat: balance / 1000,
TotalSpendableMsat: balance,
NextMaxSpendable: balance,
NextMaxSpendableSat: balance / 1000,
NextMaxSpendableMsat: balance,
NextMaxSpendableMPP: balance,
NextMaxSpendableMPPSat: balance / 1000,
NextMaxSpendableMPPMsat: balance,
},
}, nil
@ -351,7 +345,7 @@ func (svc *PhoenixService) RedeemOnchainFunds(ctx context.Context, toAddress str
}
func (svc *PhoenixService) ResetRouter(key string) error {
return nil
return errors.New("not implemented")
}
func (svc *PhoenixService) Shutdown() error {
@ -390,18 +384,18 @@ func (svc *PhoenixService) GetNodeConnectionInfo(ctx context.Context) (nodeConne
}
func (svc *PhoenixService) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error {
return nil
return errors.New("not implemented")
}
func (svc *PhoenixService) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error) {
return nil, nil
return nil, errors.New("not implemented")
}
func (svc *PhoenixService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
return nil, nil
func (svc *PhoenixService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
return errors.New("not implemented")
}
func (svc *PhoenixService) GetNewOnchainAddress(ctx context.Context) (string, error) {
return "", nil
return "", errors.New("not implemented")
}
func (svc *PhoenixService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBalanceResponse, error) {
@ -442,11 +436,11 @@ func (svc *PhoenixService) GetNetworkGraph(ctx context.Context, nodeIds []string
func (svc *PhoenixService) UpdateLastWalletSyncRequest() {}
func (svc *PhoenixService) DisconnectPeer(ctx context.Context, peerId string) error {
return nil
return errors.New("not implemented")
}
func (svc *PhoenixService) UpdateChannel(ctx context.Context, updateChannelRequest *lnclient.UpdateChannelRequest) error {
return nil
return errors.New("not implemented")
}
func (svc *PhoenixService) GetSupportedNIP47Methods() []string {
@ -499,7 +493,7 @@ func (svc *PhoenixService) GetCustomNodeCommandDefinitions() []lnclient.CustomNo
}
func (svc *PhoenixService) ExecuteCustomNodeCommand(ctx context.Context, command *lnclient.CustomNodeCommandRequest) (*lnclient.CustomNodeCommandResponse, error) {
return nil, nil
return nil, lnclient.ErrUnknownCustomNodeCommand
}
func (svc *PhoenixService) MakeOffer(ctx context.Context, description string) (string, error) {

View file

@ -53,7 +53,7 @@ func (controller *nip47Controller) HandleGetBalanceEvent(ctx context.Context, ni
}, nostr.Tags{})
return
}
balanceMsat = balances.Lightning.TotalSpendable
balanceMsat = balances.Lightning.TotalSpendableMsat
}
responsePayload := &getBalanceResponse{

View file

@ -11,11 +11,17 @@ import (
"github.com/sirupsen/logrus"
)
type tlvRecord struct {
Type uint64 `json:"type"`
// hex-encoded value
Value string `json:"value"`
}
type payKeysendParams struct {
Amount uint64 `json:"amount"`
Pubkey string `json:"pubkey"`
Preimage string `json:"preimage"`
TLVRecords []lnclient.TLVRecord `json:"tlv_records"`
Amount uint64 `json:"amount"`
Pubkey string `json:"pubkey"`
Preimage string `json:"preimage"`
TLVRecords []tlvRecord `json:"tlv_records"`
}
func (controller *nip47Controller) HandlePayKeysendEvent(ctx context.Context, nip47Request *models.Request, requestEventId uint, app *db.App, publishResponse publishFunc, tags nostr.Tags) {
@ -35,7 +41,15 @@ func (controller *nip47Controller) payKeysend(ctx context.Context, payKeysendPar
"senderPubkey": payKeysendParams.Pubkey,
}).Info("Sending keysend payment")
transaction, err := controller.transactionsService.SendKeysend(payKeysendParams.Amount, payKeysendParams.Pubkey, payKeysendParams.TLVRecords, payKeysendParams.Preimage, controller.lnClient, &app.ID, &requestEventId)
tlvRecords := make([]lnclient.TLVRecord, 0, len(payKeysendParams.TLVRecords))
for _, r := range payKeysendParams.TLVRecords {
tlvRecords = append(tlvRecords, lnclient.TLVRecord{
Type: r.Type,
Value: r.Value,
})
}
transaction, err := controller.transactionsService.SendKeysend(payKeysendParams.Amount, payKeysendParams.Pubkey, tlvRecords, payKeysendParams.Preimage, controller.lnClient, &app.ID, &requestEventId)
if err != nil {
logger.Logger.WithFields(logrus.Fields{
"request_event_id": requestEventId,

View file

@ -213,7 +213,7 @@ func (svc *swapsService) EnableAutoSwapOut(encryptionKey string) error {
logger.Logger.WithError(err).Error("Failed to get balance")
continue
}
lightningBalance := uint64(balance.Lightning.TotalSpendable)
lightningBalance := uint64(balance.Lightning.TotalSpendableMsat)
balanceThresholdMilliSats := balanceThreshold * 1000
if lightningBalance < balanceThresholdMilliSats {
logger.Logger.Info("Threshold requirements not met for swap, ignoring")

View file

@ -29,8 +29,6 @@ var MockNodeInfo = lnclient.NodeInfo{
var MockLNClientBalances = lnclient.BalancesResponse{
Lightning: lnclient.LightningBalanceResponse{
TotalSpendable: 21000,
TotalSpendableSat: 21,
TotalSpendableMsat: 21000,
},
}
@ -181,8 +179,8 @@ func (mln *MockLn) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient
func (mln *MockLn) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error) {
return nil, nil
}
func (mln *MockLn) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
return nil, nil
func (mln *MockLn) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
return nil
}
func (mln *MockLn) GetNewOnchainAddress(ctx context.Context) (string, error) {
return "", nil

View file

@ -96,31 +96,20 @@ func (_c *MockLNClient_CancelHoldInvoice_Call) RunAndReturn(run func(ctx context
}
// CloseChannel provides a mock function for the type MockLNClient
func (_mock *MockLNClient) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error) {
func (_mock *MockLNClient) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error {
ret := _mock.Called(ctx, closeChannelRequest)
if len(ret) == 0 {
panic("no return value specified for CloseChannel")
}
var r0 *lnclient.CloseChannelResponse
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)); ok {
return returnFunc(ctx, closeChannelRequest)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, *lnclient.CloseChannelRequest) *lnclient.CloseChannelResponse); ok {
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, *lnclient.CloseChannelRequest) error); ok {
r0 = returnFunc(ctx, closeChannelRequest)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*lnclient.CloseChannelResponse)
}
r0 = ret.Error(0)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, *lnclient.CloseChannelRequest) error); ok {
r1 = returnFunc(ctx, closeChannelRequest)
} else {
r1 = ret.Error(1)
}
return r0, r1
return r0
}
// MockLNClient_CloseChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CloseChannel'
@ -153,12 +142,12 @@ func (_c *MockLNClient_CloseChannel_Call) Run(run func(ctx context.Context, clos
return _c
}
func (_c *MockLNClient_CloseChannel_Call) Return(closeChannelResponse *lnclient.CloseChannelResponse, err error) *MockLNClient_CloseChannel_Call {
_c.Call.Return(closeChannelResponse, err)
func (_c *MockLNClient_CloseChannel_Call) Return(err error) *MockLNClient_CloseChannel_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockLNClient_CloseChannel_Call) RunAndReturn(run func(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)) *MockLNClient_CloseChannel_Call {
func (_c *MockLNClient_CloseChannel_Call) RunAndReturn(run func(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) error) *MockLNClient_CloseChannel_Call {
_c.Call.Return(run)
return _c
}