@@ -14,6 +14,7 @@ import (
1414 "github.com/btcsuite/btcd/btcutil"
1515 "github.com/lightninglabs/aperture/l402"
1616 "github.com/lightninglabs/lndclient"
17+ "github.com/lightninglabs/loop/assets"
1718 "github.com/lightninglabs/loop/loopdb"
1819 "github.com/lightninglabs/loop/swap"
1920 "github.com/lightninglabs/loop/sweep"
@@ -94,6 +95,7 @@ type Client struct {
9495 lndServices * lndclient.LndServices
9596 sweeper * sweep.Sweeper
9697 executor * executor
98+ assetClient * assets.TapdClient
9799
98100 resumeReady chan struct {}
99101 wg sync.WaitGroup
@@ -121,6 +123,9 @@ type ClientConfig struct {
121123 // Lnd is an instance of the lnd proxy.
122124 Lnd * lndclient.LndServices
123125
126+ // AssetClient is an instance of the assets client.
127+ AssetClient * assets.TapdClient
128+
124129 // MaxL402Cost is the maximum price we are willing to pay to the server
125130 // for the token.
126131 MaxL402Cost btcutil.Amount
@@ -273,6 +278,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
273278 errChan : make (chan error ),
274279 clientConfig : * config ,
275280 lndServices : cfg .Lnd ,
281+ assetClient : cfg .AssetClient ,
276282 sweeper : sweeper ,
277283 executor : executor ,
278284 resumeReady : make (chan struct {}),
@@ -453,7 +459,7 @@ func (s *Client) Run(ctx context.Context, statusChan chan<- SwapInfo) error {
453459func (s * Client ) resumeSwaps (ctx context.Context ,
454460 loopOutSwaps []* loopdb.LoopOut , loopInSwaps []* loopdb.LoopIn ) {
455461
456- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server )
462+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s . assetClient )
457463
458464 for _ , pend := range loopOutSwaps {
459465 if pend .State ().State .Type () != loopdb .StateTypePending {
@@ -523,7 +529,7 @@ func (s *Client) LoopOut(globalCtx context.Context,
523529 }
524530
525531 // Create a new swap object for this swap.
526- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server )
532+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s . assetClient )
527533 initResult , err := newLoopOutSwap (
528534 globalCtx , swapCfg , initiationHeight , request ,
529535 )
@@ -682,7 +688,7 @@ func (s *Client) LoopIn(globalCtx context.Context,
682688
683689 // Create a new swap object for this swap.
684690 initiationHeight := s .executor .height ()
685- swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server )
691+ swapCfg := newSwapConfig (s .lndServices , s .Store , s .Server , s . assetClient )
686692 initResult , err := newLoopInSwap (
687693 globalCtx , swapCfg , initiationHeight , request ,
688694 )
0 commit comments