ParseAddress return base58 address from base58, label or index
(address string, ctx *cli.Context)
| 148 | |
| 149 | //ParseAddress return base58 address from base58, label or index |
| 150 | func ParseAddress(address string, ctx *cli.Context) (string, error) { |
| 151 | if IsBase58Address(address) { |
| 152 | return address, nil |
| 153 | } |
| 154 | wallet, err := OpenWallet(ctx) |
| 155 | if err != nil { |
| 156 | return "", err |
| 157 | } |
| 158 | acc := wallet.GetAccountMetadataByLabel(address) |
| 159 | if acc != nil { |
| 160 | return acc.Address, nil |
| 161 | } |
| 162 | index, err := strconv.ParseInt(address, 10, 32) |
| 163 | if err != nil { |
| 164 | return "", fmt.Errorf("cannot get account by address: %s", address) |
| 165 | } |
| 166 | acc = wallet.GetAccountMetadataByIndex(int(index)) |
| 167 | if acc != nil { |
| 168 | return acc.Address, nil |
| 169 | } |
| 170 | return "", fmt.Errorf("cannot get account by address: %s", address) |
| 171 | } |
| 172 | |
| 173 | func ClearPasswd(passwd []byte) { |
| 174 | size := len(passwd) |
nothing calls this directly
no test coverage detected