Removed unused ParseLoginParams and newErrZeroAddress functions
This commit is contained in:
parent
5dba9833dd
commit
9eb49e1692
|
@ -1,7 +1,6 @@
|
|||
package account
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
|
@ -32,37 +31,6 @@ func (e *ErrZeroAddress) Error() string {
|
|||
return fmt.Sprintf("%s contains an empty address", e.field)
|
||||
}
|
||||
|
||||
func newErrZeroAddress(field string) *ErrZeroAddress {
|
||||
return &ErrZeroAddress{
|
||||
field: field,
|
||||
}
|
||||
}
|
||||
|
||||
func ParseLoginParams(paramsJSON string) (LoginParams, error) {
|
||||
var (
|
||||
params LoginParams
|
||||
zeroAddress types.Address
|
||||
)
|
||||
if err := json.Unmarshal([]byte(paramsJSON), ¶ms); err != nil {
|
||||
return params, err
|
||||
}
|
||||
|
||||
if params.ChatAddress == zeroAddress {
|
||||
return params, newErrZeroAddress("ChatAddress")
|
||||
}
|
||||
|
||||
if params.MainAccount == zeroAddress {
|
||||
return params, newErrZeroAddress("MainAccount")
|
||||
}
|
||||
|
||||
for _, address := range params.WatchAddresses {
|
||||
if address == zeroAddress {
|
||||
return params, newErrZeroAddress("WatchAddresses")
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// Info contains wallet and chat addresses and public keys of an account.
|
||||
type Info struct {
|
||||
WalletAddress string
|
||||
|
|
Loading…
Reference in New Issue