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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 36x 36x 36x 5x 5x 5x 5x 6x 6x 6x 6x 6x 6x 8x 8x 8x 1x 1x 1x 3x 3x 3x 3x 3x 3x | import { ActiveStakeModel, CirculatingSupplyModel, EpochModel, ProtocolParamsModel, TotalSupplyModel } from './types'; import { Cardano } from '@cardano-sdk/core'; import { LedgerTipModel, findLedgerTipOptions } from '../../util/DbSyncProvider'; import { Logger } from 'ts-log'; import { Pool, QueryResult } from 'pg'; import Queries from './queries'; export class NetworkInfoBuilder { #db: Pool; #logger: Logger; constructor(db: Pool, logger: Logger) { this.#db = db; this.#logger = logger; } public async queryCirculatingSupply() { this.#logger.debug('About to query circulation supply'); const result: QueryResult<CirculatingSupplyModel> = await this.#db.query(Queries.findCirculatingSupply); return result.rows[0].circulating_supply; } public async queryTotalSupply(maxLovelaceSupply: Cardano.Lovelace) { this.#logger.debug('About to query total supply'); const result: QueryResult<TotalSupplyModel> = await this.#db.query(Queries.findTotalSupply, [maxLovelaceSupply]); return result.rows[0].total_supply; } public async queryActiveStake() { this.#logger.debug('About to query active stake'); const result: QueryResult<ActiveStakeModel> = await this.#db.query(Queries.findActiveStake); return result.rows[0].active_stake; } public async queryLatestEpoch() { this.#logger.debug('About to query the last epoch'); const result: QueryResult<EpochModel> = await this.#db.query(Queries.findLatestCompleteEpoch); return result.rows[0].no; } public async queryLedgerTip() { this.#logger.debug('About to query the ledger tip'); const result: QueryResult<LedgerTipModel> = await this.#db.query(findLedgerTipOptions); return result.rows[0]; } public async queryProtocolParams() { this.#logger.debug('About to query protocol params'); const result: QueryResult<ProtocolParamsModel> = await this.#db.query(Queries.findProtocolParams); return result.rows[0]; } } |