fix(payin): skip Cardano pay-in check when no Tatum API key is configured#3878
Merged
Merged
Conversation
…ured The Cardano register strategy polls Tatum every minute and always includes its payment deposit address, so on environments without a (funded) Tatum key every cycle fails with an ERROR (~60/h on dev, currently a 402 because the key's plan is out of credits). Follow the exchange-credentials pattern (#3859): expose isConfigured on CardanoClient (Tatum key present) and skip the cron with a single WARN when unset. A key that is set but rejected still errors, so a real prod misconfiguration stays visible. Solana/Tron are webhook-driven and make no unprompted Tatum calls, so no guard is needed there.
davidleomay
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CardanoStrategy.checkPayInEntriesruns every minute and always polls (it unconditionally includes the Cardano payment deposit address), so on an environment without a working Tatum key every cycle logs an ERROR. On dfxdev this is currently ~60 errors/h (AxiosError: Request failed with status code 402— the Tatum plan is out of credits).Change
Same pattern as the exchange-credentials fix (#3859): not configured → skip + warn once; configured but rejected → still ERROR.
CardanoClient.isConfigured— true whencardanoTatumApiKey(TATUM_API_KEY) is set; the client is the credential owner (httpConfig()sends it asx-api-key)CardanoService/PayInCardanoService(pure-delegation style of those services)pollAddresspath is untouched, so an actual use without a key still surfaces loudlyDesign notes (alternatives considered)
DISABLED_PROCESSESsemantic inDfxCronService.wrapFunction(fires every tick, checks, returns). Conditionally not registering the job would deviate from that design for no measurable gain (an empty tick is one property read per minute).TATUM_API_KEYconsumers are deliberately not guarded. Solana/Tron strategies are webhook-driven andTatumWebhookServiceonly calls Tatum on demand (subscription creation) — none make unprompted calls, so none spam logs. Guarding them would silently no-op real usage paths instead of failing loudly when actually used.DISABLED_PROCESSES=PayInis too coarse (disables pay-in for all chains), and a new per-chainProcessvalue would grow a shared enum plus require env wiring per environment — more surface, same outcome, and not self-healing.Effect
Dev environments need no Tatum key at all: after removing
TATUM_API_KEYfrom the dev env, the Cardano bucket goes to zero (one WARN per process start). Prod behavior is unchanged — a set-but-broken key (e.g. quota exhausted) keeps erroring, which is the signal we want there.Verification
tsc --noEmitclean