From 60b128b29365ebd2a2678ae0463c81abe2a0ad14 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Thu, 13 May 2021 19:29:44 +0300 Subject: [PATCH] Refactor accounts query. --- src/app/_eth/accountIndex.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/_eth/accountIndex.ts b/src/app/_eth/accountIndex.ts index 7654255..bc861e8 100644 --- a/src/app/_eth/accountIndex.ts +++ b/src/app/_eth/accountIndex.ts @@ -29,12 +29,12 @@ export class AccountIndex { public async last(numberOfAccounts: number): Promise> { const count: number = await this.totalAccounts(); - let lowest: number = count - numberOfAccounts - 1; + let lowest: number = count - numberOfAccounts; if (lowest < 0) { lowest = 0; } const accounts: Array = []; - for (let i = count - 1; i > lowest; i--) { + for (let i = count; i > lowest; i--) { const account: string = await this.contract.methods.entry(i).call(); accounts.push(account); }