Skip to content

Commit

Permalink
Make sure accounts is always an Array (#26)
Browse files Browse the repository at this point in the history
* make sure accounts is always array

* use await instead of yield

* Use Array.isArray instead of array.length
  • Loading branch information
Bruno Barbieri authored Nov 19, 2018
1 parent c1360f3 commit e2098be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ export class KeyringController extends BaseController<BaseConfig, KeyringState>
async fullUpdate() {
const keyrings = await Promise.all(
this.keyring.keyrings.map(async (keyring: KeyringObject, index: number) => {
const keyringAccounts = await keyring.getAccounts();
const accounts = Array.isArray(keyringAccounts) ? keyringAccounts.map((address) => toChecksumAddress(address)) : [];
return {
accounts: await keyring.getAccounts().map((address) => toChecksumAddress(address)),
accounts,
index,
type: keyring.type
};
Expand Down

0 comments on commit e2098be

Please sign in to comment.