From 178f0887a533c632a87e55740e72971367b34e75 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 18:26:26 +0100 Subject: [PATCH] staticaddr: add swap client to cmd --- cmd/loop/staticaddr.go | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/cmd/loop/staticaddr.go b/cmd/loop/staticaddr.go index c9626ba..bf1f7fc 100644 --- a/cmd/loop/staticaddr.go +++ b/cmd/loop/staticaddr.go @@ -39,14 +39,14 @@ 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 } defer cleanup() - resp, err := client.NewAddress( - ctxb, &looprpc.NewAddressRequest{}, + resp, err := client.NewStaticAddress( + ctxb, &looprpc.NewStaticAddressRequest{}, ) if err != nil { return err @@ -86,16 +86,17 @@ 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 } defer cleanup() - resp, err := client.ListUnspent(ctxb, &looprpc.ListUnspentRequest{ - MinConfs: int32(ctx.Int("min_confs")), - MaxConfs: int32(ctx.Int("max_confs")), - }) + resp, err := client.ListUnspentDeposits( + ctxb, &looprpc.ListUnspentDepositsRequest{ + MinConfs: int32(ctx.Int("min_confs")), + MaxConfs: int32(ctx.Int("max_confs")), + }) if err != nil { return err } @@ -104,21 +105,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 -}