@@ -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 {}),
@@ -467,7 +466,7 @@ func (s *Client) Run(ctx context.Context, statusChan chan<- SwapInfo) error {
467
466
func (s * Client ) resumeSwaps (ctx context.Context ,
468
467
loopOutSwaps []* loopdb.LoopOut , loopInSwaps []* loopdb.LoopIn ) {
469
468
470
- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .assetClient )
469
+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .AssetClient )
471
470
472
471
for _ , pend := range loopOutSwaps {
473
472
if pend .State ().State .Type () != loopdb .StateTypePending {
@@ -524,7 +523,7 @@ func (s *Client) LoopOut(globalCtx context.Context,
524
523
525
524
// Verify that if we have an asset id set, we have a valid asset
526
525
// client to use.
527
- if s .assetClient == nil {
526
+ if s .AssetClient == nil {
528
527
return nil , errors .New ("asset client must be set " +
529
528
"when using an asset id" )
530
529
}
@@ -559,7 +558,7 @@ func (s *Client) LoopOut(globalCtx context.Context,
559
558
560
559
// Create a new swap object for this swap.
561
560
swapCfg := newSwapConfig (
562
- s .lndServices , s .Store , s .Server , s .assetClient ,
561
+ s .lndServices , s .Store , s .Server , s .AssetClient ,
563
562
)
564
563
565
564
initResult , err := newLoopOutSwap (
@@ -741,7 +740,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
741
740
742
741
// Create a new swap object for this swap.
743
742
initiationHeight := s .executor .height ()
744
- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .assetClient )
743
+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s .AssetClient )
745
744
initResult , err := newLoopInSwap (
746
745
globalCtx , swapCfg , initiationHeight , request ,
747
746
)
@@ -960,7 +959,7 @@ func (s *Client) AbandonSwap(ctx context.Context,
960
959
func (s * Client ) getAssetRfq (ctx context.Context , quote * LoopOutQuote ,
961
960
request * LoopOutQuoteRequest ) (* LoopOutRfq , error ) {
962
961
963
- if s .assetClient == nil {
962
+ if s .AssetClient == nil {
964
963
return nil , errors .New ("asset client must be set " +
965
964
"when trying to loop out with an asset" )
966
965
}
@@ -974,7 +973,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
974
973
}
975
974
976
975
// First we'll get the prepay rfq.
977
- prepayRfq , err := s .assetClient .GetRfqForAsset (
976
+ prepayRfq , err := s .AssetClient .GetRfqForAsset (
978
977
ctx , quote .PrepayAmount , rfqReq .AssetId ,
979
978
rfqReq .AssetEdgeNode , rfqReq .Expiry ,
980
979
rfqReq .MaxLimitMultiplier ,
@@ -995,7 +994,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
995
994
invoiceAmt := request .Amount + quote .SwapFee -
996
995
quote .PrepayAmount
997
996
998
- swapRfq , err := s .assetClient .GetRfqForAsset (
997
+ swapRfq , err := s .AssetClient .GetRfqForAsset (
999
998
ctx , invoiceAmt , rfqReq .AssetId ,
1000
999
rfqReq .AssetEdgeNode , rfqReq .Expiry ,
1001
1000
rfqReq .MaxLimitMultiplier ,
@@ -1012,7 +1011,7 @@ func (s *Client) getAssetRfq(ctx context.Context, quote *LoopOutQuote,
1012
1011
}
1013
1012
1014
1013
// We'll also want the asset name to verify for the client.
1015
- assetName , err := s .assetClient .GetAssetName (
1014
+ assetName , err := s .AssetClient .GetAssetName (
1016
1015
ctx , rfqReq .AssetId ,
1017
1016
)
1018
1017
if err != nil {
0 commit comments