Handle "Default address not set" better
Only print address and get balance if err == nil, else print that the Default address is not set
This commit is contained in:
parent
683900b5a2
commit
8a45e8c8af
20
cli/info.go
20
cli/info.go
@ -87,17 +87,17 @@ func infoCmdAct(cctx *cli.Context) error {
|
||||
fmt.Println()
|
||||
|
||||
addr, err := fullapi.WalletDefaultAddress(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
if err == nil {
|
||||
fmt.Printf("Default address: \n")
|
||||
balance, err := fullapi.WalletBalance(ctx, addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf(" %s [%s]\n", addr.String(), types.FIL(balance).Short())
|
||||
fmt.Println()
|
||||
} else {
|
||||
fmt.Printf("Default address: address not set\n")
|
||||
}
|
||||
|
||||
balance, err := fullapi.WalletBalance(ctx, addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("Default address: \n")
|
||||
fmt.Printf(" %s [%s]\n", addr.String(), types.FIL(balance).Short())
|
||||
fmt.Println()
|
||||
|
||||
addrs, err := fullapi.WalletList(ctx)
|
||||
|
Loading…
Reference in New Issue
Block a user