(wallet account.Client, passwd []byte, accAddr string)
| 62 | } |
| 63 | |
| 64 | func GetAccountMulti(wallet account.Client, passwd []byte, accAddr string) (*account.Account, error) { |
| 65 | //Address maybe address in base58, label or index |
| 66 | if accAddr == "" { |
| 67 | defAcc, err := wallet.GetDefaultAccount(passwd) |
| 68 | if err != nil { |
| 69 | return nil, err |
| 70 | } |
| 71 | return defAcc, nil |
| 72 | } |
| 73 | acc, err := wallet.GetAccountByAddress(accAddr, passwd) |
| 74 | if err != nil { |
| 75 | return nil, fmt.Errorf("getAccountByAddress %s error: %s", accAddr, err) |
| 76 | } |
| 77 | if acc != nil { |
| 78 | return acc, nil |
| 79 | } |
| 80 | acc, err = wallet.GetAccountByLabel(accAddr, passwd) |
| 81 | if err != nil { |
| 82 | return nil, fmt.Errorf("getAccountByLabel %s error: %s", accAddr, err) |
| 83 | } |
| 84 | if acc != nil { |
| 85 | return acc, nil |
| 86 | } |
| 87 | index, err := strconv.ParseInt(accAddr, 10, 32) |
| 88 | if err != nil { |
| 89 | return nil, fmt.Errorf("cannot get account by address: %s", accAddr) |
| 90 | } |
| 91 | acc, err = wallet.GetAccountByIndex(int(index), passwd) |
| 92 | if err != nil { |
| 93 | return nil, fmt.Errorf("getAccountByIndex %d error: %s", index, err) |
| 94 | } |
| 95 | if acc != nil { |
| 96 | return acc, nil |
| 97 | } |
| 98 | return nil, fmt.Errorf("cannot get account by address: %s", accAddr) |
| 99 | } |
| 100 | |
| 101 | func GetAccountMetadataMulti(wallet account.Client, accAddr string) *account.AccountMetadata { |
| 102 | //Address maybe address in base58, label or index |
no test coverage detected