@@ -15,6 +15,7 @@ var staticAddressCommands = cli.Command{
15
15
Category : "StaticAddress" ,
16
16
Subcommands : []cli.Command {
17
17
newStaticAddressCommand ,
18
+ listUnspentCommand ,
18
19
},
19
20
}
20
21
@@ -57,6 +58,53 @@ func newStaticAddress(ctx *cli.Context) error {
57
58
return nil
58
59
}
59
60
61
+ var listUnspentCommand = cli.Command {
62
+ Name : "listunspent" ,
63
+ ShortName : "l" ,
64
+ Usage : "List unspent static address outputs." ,
65
+ Description : `
66
+ List all unspent static address outputs.
67
+ ` ,
68
+ Flags : []cli.Flag {
69
+ cli.IntFlag {
70
+ Name : "min_confs" ,
71
+ Usage : "The minimum amount of confirmations an " +
72
+ "output should have to be listed." ,
73
+ },
74
+ cli.IntFlag {
75
+ Name : "max_confs" ,
76
+ Usage : "The maximum number of confirmations an " +
77
+ "output could have to be listed." ,
78
+ },
79
+ },
80
+ Action : listUnspent ,
81
+ }
82
+
83
+ func listUnspent (ctx * cli.Context ) error {
84
+ ctxb := context .Background ()
85
+ if ctx .NArg () > 0 {
86
+ return cli .ShowCommandHelp (ctx , "listunspent" )
87
+ }
88
+
89
+ client , cleanup , err := getAddressClient (ctx )
90
+ if err != nil {
91
+ return err
92
+ }
93
+ defer cleanup ()
94
+
95
+ resp , err := client .ListUnspent (ctxb , & looprpc.ListUnspentRequest {
96
+ MinConfs : int32 (ctx .Int ("min_confs" )),
97
+ MaxConfs : int32 (ctx .Int ("max_confs" )),
98
+ })
99
+ if err != nil {
100
+ return err
101
+ }
102
+
103
+ printRespJSON (resp )
104
+
105
+ return nil
106
+ }
107
+
60
108
func getAddressClient (ctx * cli.Context ) (looprpc.StaticAddressClientClient ,
61
109
func (), error ) {
62
110
0 commit comments