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:
Phi 2022-08-31 10:40:50 +02:00
parent 683900b5a2
commit 8a45e8c8af

View File

@ -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)