24 lines
467 B
Go
24 lines
467 B
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var ErrRestoreAccountInvalidMnemonic = errors.New("restore-account: invalid mnemonic")
|
|
|
|
type RestoreAccount struct {
|
|
Mnemonic string `json:"mnemonic"`
|
|
FetchBackup bool `json:"fetchBackup"`
|
|
CreateAccount
|
|
}
|
|
|
|
func (c *RestoreAccount) Validate() error {
|
|
if len(c.Mnemonic) == 0 {
|
|
return ErrRestoreAccountInvalidMnemonic
|
|
}
|
|
|
|
return c.CreateAccount.Validate(&CreateAccountValidation{
|
|
AllowEmptyDisplayName: true,
|
|
})
|
|
}
|