-
Notifications
You must be signed in to change notification settings - Fork 9
/
show_addresses.go
33 lines (27 loc) · 927 Bytes
/
show_addresses.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"context"
"fmt"
"github.com/sedracoin/sedrad/cmd/sedrawallet/daemon/client"
"github.com/sedracoin/sedrad/cmd/sedrawallet/daemon/pb"
)
func showAddresses(conf *showAddressesConfig) error {
daemonClient, tearDown, err := client.Connect(conf.DaemonAddress)
if err != nil {
return err
}
defer tearDown()
ctx, cancel := context.WithTimeout(context.Background(), daemonTimeout)
defer cancel()
response, err := daemonClient.ShowAddresses(ctx, &pb.ShowAddressesRequest{})
if err != nil {
return err
}
fmt.Printf("Addresses (%d):\n", len(response.Address))
for _, address := range response.Address {
fmt.Println(address)
}
fmt.Printf("\nNote: the above are only addresses that were manually created by the 'new-address' command. If you want to see a list of all addresses, including change addresses, " +
"that have a positive balance, use the command 'balance -v'\n")
return nil
}