diff --git a/dlt-connector/src/config/const.ts b/dlt-connector/src/config/const.ts index fa66eb6e7..6b2a3b1a2 100644 --- a/dlt-connector/src/config/const.ts +++ b/dlt-connector/src/config/const.ts @@ -2,4 +2,4 @@ export const LOG4JS_BASE_CATEGORY = 'dlt' // 7 days export const MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_UPDATE = 1000 * 60 * 60 * 24 * 7 // 10 minutes -export const MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE = 1000 * 60 * 10 \ No newline at end of file +export const MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE = 1000 * 60 * 10 diff --git a/dlt-connector/src/interactions/sendToHiero/SendToHiero.context.ts b/dlt-connector/src/interactions/sendToHiero/SendToHiero.context.ts index f510be3bd..14427cacf 100644 --- a/dlt-connector/src/interactions/sendToHiero/SendToHiero.context.ts +++ b/dlt-connector/src/interactions/sendToHiero/SendToHiero.context.ts @@ -21,6 +21,7 @@ import { HieroTransactionIdString, hieroTransactionIdStringSchema, } from '../../schemas/typeGuard.schema' +import { isTopicStillOpen } from '../../utils/hiero' import { AbstractTransactionRole } from './AbstractTransaction.role' import { CommunityRootTransactionRole } from './CommunityRootTransaction.role' import { CreationTransactionRole } from './CreationTransaction.role' @@ -28,7 +29,7 @@ import { DeferredTransferTransactionRole } from './DeferredTransferTransaction.r import { RedeemDeferredTransferTransactionRole } from './RedeemDeferredTransferTransaction.role' import { RegisterAddressTransactionRole } from './RegisterAddressTransaction.role' import { TransferTransactionRole } from './TransferTransaction.role' -import { isTopicStillOpen } from '../../utils/hiero' + const logger = getLogger(`${LOG4JS_BASE_CATEGORY}.interactions.sendToHiero.SendToHieroContext`) /** diff --git a/dlt-connector/src/utils/hiero.ts b/dlt-connector/src/utils/hiero.ts index 9ea62042f..bd1501e83 100644 --- a/dlt-connector/src/utils/hiero.ts +++ b/dlt-connector/src/utils/hiero.ts @@ -1,9 +1,9 @@ -import { HieroId } from '../schemas/typeGuard.schema' import { HieroClient } from '../client/hiero/HieroClient' import { MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE } from '../config/const' +import { HieroId } from '../schemas/typeGuard.schema' /** - * Checks whether the given topic in the Hedera network will remain open + * Checks whether the given topic in the Hedera network will remain open * for sending messages for at least `MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE` milliseconds. * * @param {HieroId} hieroTopicId - The topic ID to check. @@ -12,5 +12,8 @@ import { MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE } from '../config/const' export async function isTopicStillOpen(hieroTopicId: HieroId): Promise { const hieroClient = HieroClient.getInstance() const topicInfo = await hieroClient.getTopicInfo(hieroTopicId) - return topicInfo.expirationTime.getTime() > new Date().getTime() + MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE -} \ No newline at end of file + return ( + topicInfo.expirationTime.getTime() > + new Date().getTime() + MIN_TOPIC_EXPIRE_MILLISECONDS_FOR_SEND_MESSAGE + ) +}