@@ -103,7 +103,6 @@ type Client struct {
103
103
lndServices * lndclient.LndServices
104
104
sweeper * sweep.Sweeper
105
105
executor * executor
106
- assetClient * assets.TapdClient
107
106
108
107
resumeReady chan struct {}
109
108
wg sync.WaitGroup
@@ -196,6 +195,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
196
195
CreateExpiryTimer : func (d time.Duration ) <- chan time.Time {
197
196
return time .NewTimer (d ).C
198
197
},
198
+ AssetClient : cfg .AssetClient ,
199
199
LoopOutMaxParts : cfg .LoopOutMaxParts ,
200
200
}
201
201
@@ -286,7 +286,6 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
286
286
errChan : make (chan error ),
287
287
clientConfig : * config ,
288
288
lndServices : cfg .Lnd ,
289
- assetClient : cfg .AssetClient ,
290
289
sweeper : sweeper ,
291
290
executor : executor ,
292
291
resumeReady : make (chan struct {}),
@@ -471,7 +470,7 @@ func (s *Client) Run(ctx context.Context, statusChan chan<- SwapInfo) error {
471
470
func (s * Client ) resumeSwaps (ctx context.Context ,
472
471
loopOutSwaps []* loopdb.LoopOut , loopInSwaps []* loopdb.LoopIn ) {
473
472
474
- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .assetClient )
473
+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .AssetClient )
475
474
476
475
for _ , pend := range loopOutSwaps {
477
476
if pend .State ().State .Type () != loopdb .StateTypePending {
@@ -528,7 +527,7 @@ func (s *Client) LoopOut(globalCtx context.Context,
528
527
529
528
// Verify that if we have an asset id set, we have a valid asset
530
529
// client to use.
531
- if s .assetClient == nil {
530
+ if s .AssetClient == nil {
532
531
return nil , errors .New ("asset client must be set " +
533
532
"when using an asset id" )
534
533
}
@@ -563,7 +562,7 @@ func (s *Client) LoopOut(globalCtx context.Context,
563
562
564
563
// Create a new swap object for this swap.
565
564
swapCfg := newSwapConfig (
566
- s .lndServices , s .Store , s .Server , s .assetClient ,
565
+ s .lndServices , s .Store , s .Server , s .AssetClient ,
567
566
)
568
567
569
568
initResult , err := newLoopOutSwap (
@@ -745,7 +744,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
745
744
746
745
// Create a new swap object for this swap.
747
746
initiationHeight := s .executor .height ()
748
- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .assetClient )
747
+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .AssetClient )
749
748
initResult , err := newLoopInSwap (
750
749
globalCtx , swapCfg , initiationHeight , request ,
751
750
)
@@ -964,7 +963,7 @@ func (s *Client) AbandonSwap(ctx context.Context,
964
963
func (s * Client ) getAssetRfq (ctx context.Context , quote * LoopOutQuote ,
965
964
request * LoopOutQuoteRequest ) (* LoopOutRfq , error ) {
966
965
967
- if s .assetClient == nil {
966
+ if s .AssetClient == nil {
968
967
return nil , errors .New ("asset client must be set " +
969
968
"when trying to loop out with an asset" )
970
969
}
@@ -978,7 +977,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
978
977
}
979
978
980
979
// First we'll get the prepay rfq.
981
- prepayRfq , err := s .assetClient .GetRfqForAsset (
980
+ prepayRfq , err := s .AssetClient .GetRfqForAsset (
982
981
ctx , quote .PrepayAmount , rfqReq .AssetId ,
983
982
rfqReq .AssetEdgeNode , rfqReq .Expiry ,
984
983
rfqReq .MaxLimitMultiplier ,
@@ -999,7 +998,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
999
998
invoiceAmt := request .Amount + quote .SwapFee -
1000
999
quote .PrepayAmount
1001
1000
1002
- swapRfq , err := s .assetClient .GetRfqForAsset (
1001
+ swapRfq , err := s .AssetClient .GetRfqForAsset (
1003
1002
ctx , invoiceAmt , rfqReq .AssetId ,
1004
1003
rfqReq .AssetEdgeNode , rfqReq .Expiry ,
1005
1004
rfqReq .MaxLimitMultiplier ,
@@ -1016,7 +1015,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
1016
1015
}
1017
1016
1018
1017
// We'll also want the asset name to verify for the client.
1019
- assetName , err := s .assetClient .GetAssetName (
1018
+ assetName , err := s .AssetClient .GetAssetName (
1020
1019
ctx , rfqReq .AssetId ,
1021
1020
)
1022
1021
if err != nil {
0 commit comments