Skip to content

fix(payin): skip Cardano pay-in check when no Tatum API key is configured#3878

Merged
Danswar merged 1 commit into
developfrom
fix/skip-cardano-payin-without-tatum-key
Jun 12, 2026
Merged

fix(payin): skip Cardano pay-in check when no Tatum API key is configured#3878
Danswar merged 1 commit into
developfrom
fix/skip-cardano-payin-without-tatum-key

Conversation

@Danswar

@Danswar Danswar commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

CardanoStrategy.checkPayInEntries runs 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 when cardanoTatumApiKey (TATUM_API_KEY) is set; the client is the credential owner (httpConfig() sends it as x-api-key)
  • delegated through CardanoService / PayInCardanoService (pure-delegation style of those services)
  • the cron skips with a single WARN when unconfigured; the on-demand pollAddress path is untouched, so an actual use without a key still surfaces loudly

Design notes (alternatives considered)

  • Cron still ticks and early-returns — intentional. This mirrors the framework's own DISABLED_PROCESSES semantic in DfxCronService.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).
  • Other TATUM_API_KEY consumers are deliberately not guarded. Solana/Tron strategies are webhook-driven and TatumWebhookService only 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=PayIn is too coarse (disables pay-in for all chains), and a new per-chain Process value 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_KEY from 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 --noEmit clean
  • payin test suites: 3 suites, 58/58 pass

…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.
@Danswar Danswar merged commit 40afe60 into develop Jun 12, 2026
7 checks passed
@Danswar Danswar deleted the fix/skip-cardano-payin-without-tatum-key branch June 12, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants