From 6e4739ca0a7cf983df8ec23b8e40b9a5bd64ba65 Mon Sep 17 00:00:00 2001 From: Kammerlo Date: Mon, 4 Mar 2024 08:31:30 +0100 Subject: [PATCH] chore: eslint fixes --- .../src/CardanoNodeClient.ts | 17 ++++++++--------- .../api-cardano-db-hasura/src/ChainFollower.ts | 8 ++++---- .../src/HasuraBackgroundClient.ts | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/api-cardano-db-hasura/src/CardanoNodeClient.ts b/packages/api-cardano-db-hasura/src/CardanoNodeClient.ts index 0f97bd3b..32412b54 100644 --- a/packages/api-cardano-db-hasura/src/CardanoNodeClient.ts +++ b/packages/api-cardano-db-hasura/src/CardanoNodeClient.ts @@ -5,13 +5,12 @@ import { ConnectionConfig, createConnectionObject, createLedgerStateQueryClient, createTransactionSubmissionClient, getServerHealth, - ServerHealth, + ServerHealth } from '@cardano-ogmios/client' import { dummyLogger, Logger } from 'ts-log' -// import { createInteractionContextWithLogger } from './util' -import {LedgerStateQueryClient} from "@cardano-ogmios/client/dist/LedgerStateQuery"; -import {TransactionSubmissionClient} from "@cardano-ogmios/client/dist/TransactionSubmission"; -import {createInteractionContextWithLogger} from "./util"; +import { LedgerStateQueryClient } from '@cardano-ogmios/client/dist/LedgerStateQuery' +import { TransactionSubmissionClient } from '@cardano-ogmios/client/dist/TransactionSubmission' +import { createInteractionContextWithLogger } from './util' const MODULE_NAME = 'CardanoNodeClient' @@ -76,12 +75,12 @@ export class CardanoNodeClient { await this.initialize(ogmiosConnectionConfig) }) this.stateQueryClient = await createLedgerStateQueryClient(interactionContext) - let tip; + let tip try { - tip = await this.stateQueryClient.ledgerTip(); + tip = await this.stateQueryClient.ledgerTip() } catch (e) { - this.logger.error({ module: MODULE_NAME }, "Querying ledger tip not yet available. Wait for later epoch. Ogmios Error Message: " + e.message); - throw e; + this.logger.error({ module: MODULE_NAME }, 'Querying ledger tip not yet available. Wait for later epoch. Ogmios Error Message: ' + e.message) + throw e } this.logger.info({ module: MODULE_NAME }, tip) diff --git a/packages/api-cardano-db-hasura/src/ChainFollower.ts b/packages/api-cardano-db-hasura/src/ChainFollower.ts index 2b2c1428..b2a141b9 100644 --- a/packages/api-cardano-db-hasura/src/ChainFollower.ts +++ b/packages/api-cardano-db-hasura/src/ChainFollower.ts @@ -11,7 +11,7 @@ import { createInteractionContextWithLogger } from './util' import { PointOrOrigin, BlockPraos } from '@cardano-ogmios/schema' import { HasuraBackgroundClient } from './HasuraBackgroundClient' import { DbConfig } from './typeAliases' -import {ChainSynchronizationClient} from "@cardano-ogmios/client/dist/ChainSynchronization"; +import { ChainSynchronizationClient } from '@cardano-ogmios/client/dist/ChainSynchronization' const MODULE_NAME = 'ChainFollower' @@ -60,10 +60,10 @@ export class ChainFollower { requestNext() }, rollForward: async ({ block }, requestNext) => { - let b = block as BlockPraos; + const b = block as BlockPraos if (b !== undefined && b.transactions !== undefined) { for (const tx of b.transactions) { - if(tx.mint !== undefined) { + if (tx.mint !== undefined) { for (const entry of Object.entries(tx.mint.assets)) { const [policyId, assetName] = entry[0].split('.') const assetId = `${policyId}${assetName !== undefined ? assetName : ''}` @@ -78,7 +78,7 @@ export class ChainFollower { await this.hasuraClient.insertAssets([asset]) const SIX_HOURS = 21600 const THREE_MONTHS = 365 - await this.queue.publish('asset-metadata-fetch-initial', {assetId}, { + await this.queue.publish('asset-metadata-fetch-initial', { assetId }, { retryDelay: SIX_HOURS, retryLimit: THREE_MONTHS }) diff --git a/packages/api-cardano-db-hasura/src/HasuraBackgroundClient.ts b/packages/api-cardano-db-hasura/src/HasuraBackgroundClient.ts index c68047b4..bcdbd5c8 100644 --- a/packages/api-cardano-db-hasura/src/HasuraBackgroundClient.ts +++ b/packages/api-cardano-db-hasura/src/HasuraBackgroundClient.ts @@ -189,7 +189,7 @@ export class HasuraBackgroundClient { const { hash, slotNo } = result.assets[0].firstAppearedInBlock point = { slot: Number(slotNo), - id: hash.substring(2) + id: hash.substring(2) } } else { point = null