@@ -52,9 +52,29 @@ func (bc *basicClientOptions) applyBasicClientOptions(options ...BasicClientOpti
52
52
// NewBasicClient creates a new basic gRPC client to lnd. We call this client
53
53
// "basic" as it falls back to expected defaults if the arguments aren't
54
54
// provided.
55
- func NewBasicClient (lndHost , tlsPath , macDir , network string , basicOptions ... BasicClientOption ) (
55
+ func NewBasicClient (lndHost , tlsPath , macDir , network string ,
56
+ basicOptions ... BasicClientOption ) (
57
+
56
58
lnrpc.LightningClient , error ) {
57
59
60
+ conn , err := NewBasicConn (
61
+ lndHost , tlsPath , macDir , network , basicOptions ... ,
62
+ )
63
+ if err != nil {
64
+ return nil , err
65
+ }
66
+
67
+ return lnrpc .NewLightningClient (conn ), nil
68
+ }
69
+
70
+ // NewBasicConn creates a new basic gRPC connection to lnd. We call this
71
+ // connection "basic" as it falls back to expected defaults if the arguments
72
+ // aren't provided.
73
+ func NewBasicConn (lndHost , tlsPath , macDir , network string ,
74
+ basicOptions ... BasicClientOption ) (
75
+
76
+ * grpc.ClientConn , error ) {
77
+
58
78
if tlsPath == "" {
59
79
tlsPath = defaultTLSCertPath
60
80
}
@@ -112,5 +132,5 @@ func NewBasicClient(lndHost, tlsPath, macDir, network string, basicOptions ...Ba
112
132
return nil , fmt .Errorf ("unable to connect to RPC server: %v" , err )
113
133
}
114
134
115
- return lnrpc . NewLightningClient ( conn ) , nil
135
+ return conn , nil
116
136
}
0 commit comments