Skip to content

Commit

Permalink
add api blocks/highest
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Jan 25, 2024
1 parent dfcd165 commit 1819b10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions apps/whale-api/src/e2e.defid.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ export class DBlockController extends DefidOceanController {
}
return await this.api.get(`/blocks/${hash}/transactions?size=${query.size}`)

Check warning on line 160 in apps/whale-api/src/e2e.defid.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/whale-api/src/e2e.defid.module.ts#L160

Added line #L160 was not covered by tests
}

async getHighest (): Promise<Block | undefined> {
return await this.api.get('/blocks/highest')

Check warning on line 164 in apps/whale-api/src/e2e.defid.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/whale-api/src/e2e.defid.module.ts#L163-L164

Added lines #L163 - L164 were not covered by tests
}
}

export class DFeeController extends DefidOceanController {
Expand Down
7 changes: 3 additions & 4 deletions apps/whale-api/src/e2e.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ export async function waitForIndexedHeightLatest (app: NestFastifyApplication, c
export async function waitForIndexedHeight (app: NestFastifyApplication | DefidBin, height: number, timeout: number = 30000): Promise<void> {
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 block = await app.ocean.blockController.getHighest()
expect(block?.height).toBeGreaterThan(height)
await app.rpc.generate(1)

Check warning on line 91 in apps/whale-api/src/e2e.module.ts

View check run for this annotation

Codecov / codecov/patch

apps/whale-api/src/e2e.module.ts#L88-L91

Added lines #L88 - L91 were not covered by tests
}, timeout)
} else {
const blockMapper = app.get(BlockMapper)
Expand Down

0 comments on commit 1819b10

Please sign in to comment.