mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loop: expose server grpc connection
This commit is contained in:
parent
091c0a86bd
commit
4d558b1418
2 changed files with 9 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/lightninglabs/loop/sweep"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
|
|
@ -148,6 +149,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
|
|||
LndServices: cfg.Lnd,
|
||||
Server: swapServerClient,
|
||||
Store: loopDB,
|
||||
Conn: swapServerClient.conn,
|
||||
LsatStore: lsatStore,
|
||||
CreateExpiryTimer: func(d time.Duration) <-chan time.Time {
|
||||
return time.NewTimer(d).C
|
||||
|
|
@ -200,6 +202,11 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore,
|
|||
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.
|
||||
func (s *Client) FetchSwaps(ctx context.Context) ([]*SwapInfo, error) {
|
||||
loopOutSwaps, err := s.Store.FetchLoopOutSwaps(ctx)
|
||||
|
|
|
|||
|
|
@ -6,12 +6,14 @@ import (
|
|||
"github.com/lightninglabs/aperture/lsat"
|
||||
"github.com/lightninglabs/lndclient"
|
||||
"github.com/lightninglabs/loop/loopdb"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// clientConfig contains config items for the swap client.
|
||||
type clientConfig struct {
|
||||
LndServices *lndclient.LndServices
|
||||
Server swapServerClient
|
||||
Conn *grpc.ClientConn
|
||||
Store loopdb.SwapStore
|
||||
LsatStore lsat.Store
|
||||
CreateExpiryTimer func(expiry time.Duration) <-chan time.Time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue