Refactor loop to avoid passing index limit.

This commit is contained in:
Spencer Ofwiti 2021-05-18 10:42:24 +03:00
parent 08fda5390a
commit 405199cfe3

View File

@ -34,7 +34,7 @@ export class AccountIndex {
lowest = 0; lowest = 0;
} }
const accounts: Array<string> = []; const accounts: Array<string> = [];
for (let i = count; i > lowest; i--) { for (let i = count - 1; i >= lowest; i--) {
const account: string = await this.contract.methods.entry(i).call(); const account: string = await this.contract.methods.entry(i).call();
accounts.push(account); accounts.push(account);
} }