staticaddr: add swap client to cmd

Slyghtning 2 months ago
parent df5d5edc0f
commit 396f2f5b7e
No known key found for this signature in database
GPG Key ID: F82D456EA023C9BF

@ -39,7 +39,7 @@ func newStaticAddress(ctx *cli.Context) error {
return cli.ShowCommandHelp(ctx, "new")
}
client, cleanup, err := getAddressClient(ctx)
client, cleanup, err := getClient(ctx)
if err != nil {
return err
}
@ -86,7 +86,7 @@ func listUnspent(ctx *cli.Context) error {
return cli.ShowCommandHelp(ctx, "listunspent")
}
client, cleanup, err := getAddressClient(ctx)
client, cleanup, err := getClient(ctx)
if err != nil {
return err
}
@ -104,21 +104,3 @@ func listUnspent(ctx *cli.Context) error {
return nil
}
func getAddressClient(ctx *cli.Context) (looprpc.StaticAddressClientClient,
func(), error) {
rpcServer := ctx.GlobalString("rpcserver")
tlsCertPath, macaroonPath, err := extractPathArgs(ctx)
if err != nil {
return nil, nil, err
}
conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath)
if err != nil {
return nil, nil, err
}
cleanup := func() { conn.Close() }
addressClient := looprpc.NewStaticAddressClientClient(conn)
return addressClient, cleanup, nil
}

Loading…
Cancel
Save