2023-03-21 17:02:04 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var ErrRestoreAccountInvalidMnemonic = errors.New("restore-account: invalid mnemonic")
|
|
|
|
|
|
|
|
type RestoreAccount struct {
|
2024-03-28 15:01:44 +00:00
|
|
|
Mnemonic string `json:"mnemonic"`
|
|
|
|
FetchBackup bool `json:"fetchBackup"`
|
2023-03-21 17:02:04 +00:00
|
|
|
CreateAccount
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *RestoreAccount) Validate() error {
|
|
|
|
if len(c.Mnemonic) == 0 {
|
|
|
|
return ErrRestoreAccountInvalidMnemonic
|
|
|
|
}
|
|
|
|
|
2024-03-28 15:01:44 +00:00
|
|
|
return c.CreateAccount.Validate(&CreateAccountValidation{
|
|
|
|
AllowEmptyDisplayName: true,
|
|
|
|
})
|
2023-03-21 17:02:04 +00:00
|
|
|
}
|