Skip to content

Commit

Permalink
fix: setupAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnunchik committed Oct 10, 2023
1 parent 26f3aaf commit b3d3ba1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/EOSWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ 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;
this.storage.set('accountName', accountName);
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);
Expand Down

0 comments on commit b3d3ba1

Please sign in to comment.