From 0b40e449b9faa69bacee71b6209af2b66f5f41fd Mon Sep 17 00:00:00 2001 From: canonbrother Date: Thu, 25 Jan 2024 18:34:55 +0800 Subject: [PATCH] add api blocks/highest --- apps/whale-api/src/e2e.defid.module.ts | 4 ++++ apps/whale-api/src/e2e.module.ts | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/whale-api/src/e2e.defid.module.ts b/apps/whale-api/src/e2e.defid.module.ts index 29b832437a..03aa295685 100644 --- a/apps/whale-api/src/e2e.defid.module.ts +++ b/apps/whale-api/src/e2e.defid.module.ts @@ -159,6 +159,10 @@ export class DBlockController extends DefidOceanController { } return await this.api.get(`/blocks/${hash}/transactions?size=${query.size}`) } + + async count (): Promise { + return await this.api.get('/blocks/highest') + } } export class DFeeController extends DefidOceanController { diff --git a/apps/whale-api/src/e2e.module.ts b/apps/whale-api/src/e2e.module.ts index ed3db5edf3..3f41bf6dab 100644 --- a/apps/whale-api/src/e2e.module.ts +++ b/apps/whale-api/src/e2e.module.ts @@ -86,10 +86,9 @@ export async function waitForIndexedHeightLatest (app: NestFastifyApplication, c export async function waitForIndexedHeight (app: NestFastifyApplication | DefidBin, height: number, timeout: number = 30000): Promise { if (app instanceof DefidBin) { await waitForExpect(async () => { - // TODO(canonbrother): ocean getblockcount - // const count = await app.ocean.getBlockCount() - // expect(count).toBeGreaterThan(height) - // await app.rpc.generate(1) + const count = await app.ocean.blockController.count() + expect(count).toBeGreaterThan(height) + await app.rpc.generate(1) }, timeout) } else { const blockMapper = app.get(BlockMapper)