Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 2x 2x 2x | import * as Queries from './queries';
import { Logger } from 'ts-log';
import { Pool, QueryResult } from 'pg';
export class NetworkInfoFixtureBuilder {
#db: Pool;
#logger: Logger;
constructor(db: Pool, logger: Logger) {
this.#db = db;
this.#logger = logger;
}
public async getMaxSupply() {
this.#logger.debug('About to query max supply');
const result: QueryResult<{ max_supply: number }> = await this.#db.query(Queries.getMaxSupply);
Iif (result.rows.length === 0) throw new Error('Unexpected error querying max supply');
return result.rows.map(({ max_supply }) => BigInt(max_supply))[0];
}
public async getLasKnownEpoch(): Promise<number> {
this.#logger.debug('About to fetch last known epoch');
const result: QueryResult<{
no: number;
}> = await this.#db.query(Queries.lastKnownEpoch);
return result.rows.map(({ no }) => no)[0];
}
}
|