Skip to content

fix(payment): skip the Solana balance check when no Tatum API key is configured#4203

Open
Danswar wants to merge 2 commits into
developfrom
fix/solana-unconfigured-guard
Open

fix(payment): skip the Solana balance check when no Tatum API key is configured#4203
Danswar wants to merge 2 commits into
developfrom
fix/solana-unconfigured-guard

Conversation

@Danswar

@Danswar Danswar commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Why

The hourly PaymentBalanceService Solana balance check on dev fails on every run:

SolanaJSONRPCError: failed to get balance for DwS2f...: Method 'getBalance' is
available for paid plans only.

The error text reads like a subscription-tier problem, but the actual root cause is that TATUM_API_KEY is not set on dev at all:

  • The Cardano guard from fix(payin): skip Cardano pay-in check when no Tatum API key is configured #3878 reads the same env var (cardanoTatumApiKey = TATUM_API_KEY), and its warn — "Cardano has no Tatum API key configured — skipping pay-in check" — fires on dev after every boot and never on prod.
  • A keyless request to solana-mainnet.gateway.tatum.io reproduces the error byte-identically: Tatum's anonymous tier serves basic JSON-RPC (getSlot works) but gates getBalance.

So dev's Solana client has been calling Tatum anonymously, and the only method that minds is the one the hourly balance check needs. #3878 scoped Solana out of the unconfigured-guard on the grounds that it made no unprompted Tatum calls — the hourly PaymentBalanceService check (via the finance-log cron) is exactly such a call, so that assumption no longer holds.

What

Extends the #3878 pattern to this caller:

  • BlockchainClient base: get isConfigured() (default true) — same semantics as CardanoClient's existing getter.
  • SolanaClient override: Tatum API key present.
  • PaymentBalanceService.getPaymentBalances: the existing not-configured warn-once-and-skip branch now also covers a client that exists but is unconfigured.

Prod (key set) is unchanged, and a key that is set but rejected still errors — a real misconfiguration stays visible. Tron is deliberately not gated: its keyless balance calls show no failures on dev.

Companion: DFXServer/server#730 provisions a Grafana alert on the not-configured warn scoped to prod, so a TATUM_API_KEY lost on prod (where the guard would otherwise reduce it to one boot-time warn) still pages.

Replaces the PaymentBalanceService half of #4200 (suppressed the provider error string in shared code) and #4202 (RPC-provider swap built on the wrong "paid plan lacks the method" premise) — both closed.

Test plan

  • New payment-balance.service.spec.ts: unconfigured client → skipped, single warn, no error; configured client → balances fetched; configured client whose call rejects → still throws / logs ERROR (locks the set-but-rejected contract). 3/3 passing
  • Full local suite green (pre-push hook)
  • Lint / tsc --noEmit / prettier clean
  • After dev deploy: hourly Solana error stops; single Blockchain client not configured for Solana warn per boot instead

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.

1 participant