From b3d3ba1d2d23c4e090f4b238f2779175d4fd5b14 Mon Sep 17 00:00:00 2001 From: Evgeny Vlasenko Date: Tue, 10 Oct 2023 12:11:10 -0600 Subject: [PATCH] fix: setupAccount --- lib/EOSWallet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/EOSWallet.js b/lib/EOSWallet.js index 5ec1ee3..4b727f9 100644 --- a/lib/EOSWallet.js +++ b/lib/EOSWallet.js @@ -107,6 +107,9 @@ export default class EOSWallet extends CsWallet { } async setupAccount(accountName) { + if (!validateAccountName(accountName)) { + throw new errors.InvalidAccountNameError(accountName); + } const isValid = await this.#api.accounts.validate(accountName, this.#publicKey); if (isValid) { this.#accountName = accountName; @@ -114,9 +117,6 @@ export default class EOSWallet extends CsWallet { await this.storage.save(); return { needToCreateAccount: false }; } - if (!validateAccountName(accountName)) { - throw new errors.InvalidAccountNameError(accountName); - } const data = await this.#api.accounts.info(accountName); if (data.isActive) { throw new errors.AccountNameUnavailableError(accountName);