Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/integration/blockchain/cardano/cardano-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export class CardanoClient extends BlockchainClient {
return this.wallet.address;
}

get isConfigured(): boolean {
return !!Config.blockchain.cardano.cardanoTatumApiKey;
}

async getBlockHeight(): Promise<number> {
const info = await this.getNetworkInfo();
return info.tip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export class CardanoService extends BlockchainService {
return this.client.walletAddress;
}

get isConfigured(): boolean {
return this.client.isConfigured;
}

verifySignature(message: string, address: string, signature: string, key?: string): boolean {
try {
return verifyCardanoSignature(signature, key, message, address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class PayInCardanoService {
return this.cardanoService.getWalletAddress();
}

get isConfigured(): boolean {
return this.cardanoService.isConfigured;
}

async getNativeCoinBalanceForAddress(address: string): Promise<number> {
return this.cardanoService.getNativeCoinBalanceForAddress(address);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class CardanoStrategy extends RegisterStrategy {

private readonly cardanoPaymentDepositAddress: string;

private unconfiguredWarned = false;

constructor(
private readonly payInCardanoService: PayInCardanoService,
private readonly transactionRequestService: TransactionRequestService,
Expand All @@ -41,6 +43,16 @@ export class CardanoStrategy extends RegisterStrategy {
//*** JOBS ***//
@DfxCron(CronExpression.EVERY_MINUTE, { process: Process.PAY_IN, timeout: 7200 })
async checkPayInEntries(): Promise<void> {
// not configured (no Tatum API key) -> skip, warn once
if (!this.payInCardanoService.isConfigured) {
if (!this.unconfiguredWarned) {
this.unconfiguredWarned = true;
this.logger.warn('Cardano has no Tatum API key configured — skipping pay-in check');
}

return;
}

const activeDepositAddresses = await this.transactionRequestService.getActiveDepositAddresses(
Util.hoursBefore(1),
this.blockchain,
Expand Down