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 | 41x 41x 35x 35x 9x 9x 6x 3x | import { BlockFrostAPI } from '@blockfrost/blockfrost-js'; import { HealthCheckResponse, Provider, ProviderDependencies } from '@cardano-sdk/core'; import { blockfrostToProviderError } from './blockfrostUtil'; import type { Logger } from 'ts-log'; /** Properties needed to create a BlockfrostProvider */ export interface BlockfrostProviderDependencies extends ProviderDependencies { blockfrost: BlockFrostAPI; logger: Logger; } export abstract class BlockfrostProvider implements Provider { protected blockfrost: BlockFrostAPI; protected logger: Logger; public constructor({ logger, blockfrost }: BlockfrostProviderDependencies) { this.blockfrost = blockfrost; this.logger = logger; } async healthCheck(): Promise<HealthCheckResponse> { try { const result = await this.blockfrost.health(); return { ok: result.is_healthy }; } catch (error) { throw blockfrostToProviderError(error); } } } |