@@ -16,7 +16,7 @@ import (
1616 "github.com/btcsuite/btcutil"
1717 "github.com/lightninglabs/aperture/lsat"
1818 "github.com/lightninglabs/loop/loopdb"
19- "github.com/lightninglabs/loop/swapserverrpc"
19+ looprpc "github.com/lightninglabs/loop/swapserverrpc"
2020 "github.com/lightningnetwork/lnd/lnrpc"
2121 "github.com/lightningnetwork/lnd/lntypes"
2222 "github.com/lightningnetwork/lnd/routing/route"
@@ -89,7 +89,7 @@ type swapServerClient interface {
8989}
9090
9191type grpcSwapServerClient struct {
92- server swapserverrpc .SwapServerClient
92+ server looprpc .SwapServerClient
9393 conn * grpc.ClientConn
9494
9595 wg sync.WaitGroup
@@ -124,7 +124,7 @@ func newSwapServerClient(cfg *ClientConfig, lsatStore lsat.Store) (
124124 return nil , err
125125 }
126126
127- server := swapserverrpc .NewSwapServerClient (serverConn )
127+ server := looprpc .NewSwapServerClient (serverConn )
128128
129129 return & grpcSwapServerClient {
130130 conn : serverConn ,
@@ -138,7 +138,7 @@ func (s *grpcSwapServerClient) GetLoopOutTerms(ctx context.Context) (
138138 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
139139 defer rpcCancel ()
140140 terms , err := s .server .LoopOutTerms (rpcCtx ,
141- & swapserverrpc .ServerLoopOutTermsRequest {
141+ & looprpc .ServerLoopOutTermsRequest {
142142 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
143143 },
144144 )
@@ -161,7 +161,7 @@ func (s *grpcSwapServerClient) GetLoopOutQuote(ctx context.Context,
161161 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
162162 defer rpcCancel ()
163163 quoteResp , err := s .server .LoopOutQuote (rpcCtx ,
164- & swapserverrpc .ServerLoopOutQuoteRequest {
164+ & looprpc .ServerLoopOutQuoteRequest {
165165 Amt : uint64 (amt ),
166166 SwapPublicationDeadline : swapPublicationDeadline .Unix (),
167167 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
@@ -195,7 +195,7 @@ func (s *grpcSwapServerClient) GetLoopInTerms(ctx context.Context) (
195195 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
196196 defer rpcCancel ()
197197 terms , err := s .server .LoopInTerms (rpcCtx ,
198- & swapserverrpc .ServerLoopInTermsRequest {
198+ & looprpc .ServerLoopInTermsRequest {
199199 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
200200 },
201201 )
@@ -221,7 +221,7 @@ func (s *grpcSwapServerClient) GetLoopInQuote(ctx context.Context,
221221 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
222222 defer rpcCancel ()
223223
224- req := & swapserverrpc .ServerLoopInQuoteRequest {
224+ req := & looprpc .ServerLoopInQuoteRequest {
225225 Amt : uint64 (amt ),
226226 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
227227 Pubkey : pubKey [:],
@@ -252,12 +252,12 @@ func (s *grpcSwapServerClient) GetLoopInQuote(ctx context.Context,
252252
253253// marshallRouteHints marshalls a list of route hints.
254254func marshallRouteHints (routeHints [][]zpay32.HopHint ) (
255- []* swapserverrpc .RouteHint , error ) {
255+ []* looprpc .RouteHint , error ) {
256256
257- rpcRouteHints := make ([]* swapserverrpc .RouteHint , 0 , len (routeHints ))
257+ rpcRouteHints := make ([]* looprpc .RouteHint , 0 , len (routeHints ))
258258 for _ , routeHint := range routeHints {
259259 rpcRouteHint := make (
260- []* swapserverrpc .HopHint , 0 , len (routeHint ),
260+ []* looprpc .HopHint , 0 , len (routeHint ),
261261 )
262262 for _ , hint := range routeHint {
263263 rpcHint , err := marshallHopHint (hint )
@@ -267,7 +267,7 @@ func marshallRouteHints(routeHints [][]zpay32.HopHint) (
267267
268268 rpcRouteHint = append (rpcRouteHint , rpcHint )
269269 }
270- rpcRouteHints = append (rpcRouteHints , & swapserverrpc .RouteHint {
270+ rpcRouteHints = append (rpcRouteHints , & looprpc .RouteHint {
271271 HopHints : rpcRouteHint ,
272272 })
273273 }
@@ -276,15 +276,15 @@ func marshallRouteHints(routeHints [][]zpay32.HopHint) (
276276}
277277
278278// marshallHopHint marshalls a single hop hint.
279- func marshallHopHint (hint zpay32.HopHint ) (* swapserverrpc .HopHint , error ) {
279+ func marshallHopHint (hint zpay32.HopHint ) (* looprpc .HopHint , error ) {
280280 nodeID , err := route .NewVertexFromBytes (
281281 hint .NodeID .SerializeCompressed (),
282282 )
283283 if err != nil {
284284 return nil , err
285285 }
286286
287- return & swapserverrpc .HopHint {
287+ return & looprpc .HopHint {
288288 ChanId : hint .ChannelID ,
289289 CltvExpiryDelta : uint32 (hint .CLTVExpiryDelta ),
290290 FeeBaseMsat : hint .FeeBaseMSat ,
@@ -305,7 +305,7 @@ func (s *grpcSwapServerClient) Probe(ctx context.Context, amt btcutil.Amount,
305305 return err
306306 }
307307
308- req := & swapserverrpc .ServerProbeRequest {
308+ req := & looprpc .ServerProbeRequest {
309309 Amt : uint64 (amt ),
310310 Target : target [:],
311311 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
@@ -328,7 +328,7 @@ func (s *grpcSwapServerClient) NewLoopOutSwap(ctx context.Context,
328328 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
329329 defer rpcCancel ()
330330 swapResp , err := s .server .NewLoopOutSwap (rpcCtx ,
331- & swapserverrpc .ServerLoopOutRequest {
331+ & looprpc .ServerLoopOutRequest {
332332 SwapHash : swapHash [:],
333333 Amt : uint64 (amount ),
334334 ReceiverKey : receiverKey [:],
@@ -367,7 +367,7 @@ func (s *grpcSwapServerClient) PushLoopOutPreimage(ctx context.Context,
367367 defer rpcCancel ()
368368
369369 _ , err := s .server .LoopOutPushPreimage (rpcCtx ,
370- & swapserverrpc .ServerLoopOutPushPreimageRequest {
370+ & looprpc .ServerLoopOutPushPreimageRequest {
371371 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
372372 Preimage : preimage [:],
373373 },
@@ -384,7 +384,7 @@ func (s *grpcSwapServerClient) NewLoopInSwap(ctx context.Context,
384384 rpcCtx , rpcCancel := context .WithTimeout (ctx , globalCallTimeout )
385385 defer rpcCancel ()
386386
387- req := & swapserverrpc .ServerLoopInRequest {
387+ req := & looprpc .ServerLoopInRequest {
388388 SwapHash : swapHash [:],
389389 Amt : uint64 (amount ),
390390 SenderKey : senderKey [:],
@@ -421,7 +421,7 @@ func (s *grpcSwapServerClient) NewLoopInSwap(ctx context.Context,
421421// ServerUpdate summarizes an update from the swap server.
422422type ServerUpdate struct {
423423 // State is the state that the server has sent us.
424- State swapserverrpc .ServerSwapState
424+ State looprpc .ServerSwapState
425425
426426 // Timestamp is the time of the server state update.
427427 Timestamp time.Time
@@ -433,7 +433,7 @@ func (s *grpcSwapServerClient) SubscribeLoopInUpdates(ctx context.Context,
433433 hash lntypes.Hash ) (<- chan * ServerUpdate , <- chan error , error ) {
434434
435435 resp , err := s .server .SubscribeLoopInUpdates (
436- ctx , & swapserverrpc .SubscribeUpdatesRequest {
436+ ctx , & looprpc .SubscribeUpdatesRequest {
437437 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
438438 SwapHash : hash [:],
439439 },
@@ -464,7 +464,7 @@ func (s *grpcSwapServerClient) SubscribeLoopOutUpdates(ctx context.Context,
464464 hash lntypes.Hash ) (<- chan * ServerUpdate , <- chan error , error ) {
465465
466466 resp , err := s .server .SubscribeLoopOutUpdates (
467- ctx , & swapserverrpc .SubscribeUpdatesRequest {
467+ ctx , & looprpc .SubscribeUpdatesRequest {
468468 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
469469 SwapHash : hash [:],
470470 },
@@ -603,7 +603,7 @@ type outCancelDetails struct {
603603func (s * grpcSwapServerClient ) CancelLoopOutSwap (ctx context.Context ,
604604 details * outCancelDetails ) error {
605605
606- req := & swapserverrpc .CancelLoopOutSwapRequest {
606+ req := & looprpc .CancelLoopOutSwapRequest {
607607 ProtocolVersion : loopdb .CurrentRPCProtocolVersion ,
608608 SwapHash : details .hash [:],
609609 PaymentAddress : details .paymentAddr [:],
@@ -620,35 +620,35 @@ func (s *grpcSwapServerClient) CancelLoopOutSwap(ctx context.Context,
620620}
621621
622622func rpcRouteCancel (details * outCancelDetails ) (
623- * swapserverrpc .CancelLoopOutSwapRequest_RouteCancel , error ) {
623+ * looprpc .CancelLoopOutSwapRequest_RouteCancel , error ) {
624624
625625 attempts := make (
626- []* swapserverrpc .HtlcAttempt , len (details .metadata .attempts ),
626+ []* looprpc .HtlcAttempt , len (details .metadata .attempts ),
627627 )
628628 for i , remaining := range details .metadata .attempts {
629- attempts [i ] = & swapserverrpc .HtlcAttempt {
629+ attempts [i ] = & looprpc .HtlcAttempt {
630630 RemainingHops : remaining ,
631631 }
632632 }
633633
634- resp := & swapserverrpc .CancelLoopOutSwapRequest_RouteCancel {
635- RouteCancel : & swapserverrpc .RouteCancel {
634+ resp := & looprpc .CancelLoopOutSwapRequest_RouteCancel {
635+ RouteCancel : & looprpc .RouteCancel {
636636 Attempts : attempts ,
637637 // We can cast our lnd failure reason to a loop payment
638638 // failure reason because these values are copied 1:1
639639 // from lnd.
640- Failure : swapserverrpc .PaymentFailureReason (
640+ Failure : looprpc .PaymentFailureReason (
641641 details .metadata .failureReason ,
642642 ),
643643 },
644644 }
645645
646646 switch details .metadata .paymentType {
647647 case paymentTypePrepay :
648- resp .RouteCancel .RouteType = swapserverrpc .RoutePaymentType_PREPAY_ROUTE
648+ resp .RouteCancel .RouteType = looprpc .RoutePaymentType_PREPAY_ROUTE
649649
650650 case paymentTypeInvoice :
651- resp .RouteCancel .RouteType = swapserverrpc .RoutePaymentType_INVOICE_ROUTE
651+ resp .RouteCancel .RouteType = looprpc .RoutePaymentType_INVOICE_ROUTE
652652
653653 default :
654654 return nil , fmt .Errorf ("unknown payment type: %v" ,
0 commit comments