|
|
@ -19,6 +19,7 @@ import (
|
|
|
|
"github.com/lightninglabs/loop/sweep"
|
|
|
|
"github.com/lightninglabs/loop/sweep"
|
|
|
|
"github.com/lightningnetwork/lnd/lntypes"
|
|
|
|
"github.com/lightningnetwork/lnd/lntypes"
|
|
|
|
"github.com/lightningnetwork/lnd/routing/route"
|
|
|
|
"github.com/lightningnetwork/lnd/routing/route"
|
|
|
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc/status"
|
|
|
|
"google.golang.org/grpc/status"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -148,6 +149,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
|
|
|
|
LndServices: cfg.Lnd,
|
|
|
|
LndServices: cfg.Lnd,
|
|
|
|
Server: swapServerClient,
|
|
|
|
Server: swapServerClient,
|
|
|
|
Store: loopDB,
|
|
|
|
Store: loopDB,
|
|
|
|
|
|
|
|
Conn: swapServerClient.conn,
|
|
|
|
LsatStore: lsatStore,
|
|
|
|
LsatStore: lsatStore,
|
|
|
|
CreateExpiryTimer: func(d time.Duration) <-chan time.Time {
|
|
|
|
CreateExpiryTimer: func(d time.Duration) <-chan time.Time {
|
|
|
|
return time.NewTimer(d).C
|
|
|
|
return time.NewTimer(d).C
|
|
|
@ -200,6 +202,11 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
|
|
|
|
return client, cleanup, nil
|
|
|
|
return client, cleanup, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetConn returns the gRPC connection to the server.
|
|
|
|
|
|
|
|
func (s *Client) GetConn() *grpc.ClientConn {
|
|
|
|
|
|
|
|
return s.clientConfig.Conn
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FetchSwaps returns all loop in and out swaps currently in the database.
|
|
|
|
// FetchSwaps returns all loop in and out swaps currently in the database.
|
|
|
|
func (s *Client) FetchSwaps(ctx context.Context) ([]*SwapInfo, error) {
|
|
|
|
func (s *Client) FetchSwaps(ctx context.Context) ([]*SwapInfo, error) {
|
|
|
|
loopOutSwaps, err := s.Store.FetchLoopOutSwaps(ctx)
|
|
|
|
loopOutSwaps, err := s.Store.FetchLoopOutSwaps(ctx)
|
|
|
|