What it reports
When a client callsGET /api/2/wallet/positions?wallet=…&_backfillSwapsAndPositions=true,
the platform runs a two-phase pipeline:
- Slot extraction (
wallet-backfilling→qa-blocks-processor) — fetches the wallet’s historical transactions from the active provider (Moralis / Dune / Solscan), splits the slots into batches, and ingests transfers + swaps intopublic.swaps. - Position rebuild (
update-wallet-positions) — once slot extraction is done, the job acquires a per-wallet lock, wipes existing rows inwallet_positions/wallet_positions_recipients, and re-aggregates swaps into positions.
progressPercent and etaSeconds so callers can drive a progress bar or notify the
user when the wallet is ready.
state values
| State | Meaning |
|---|---|
not_started | No backfill has ever been requested for this wallet. |
processing | Phase 1 in progress (fetching transactions and ingesting slots). |
rebuilding | Phase 2 in progress (re-aggregating swaps into positions). |
completed | Both phases finished — wallet_positions is up to date. |
stuck | Phase 1 started (transferStatus="1") but the provider call died before publishing any batches. A retry of the backfill trigger clears this. |
Progress & ETA semantics
progressPercentis weighted: phase 1 spans 0 → 70%, phase 2 spans 70 → 100%. It caps at 99.9 until phase 2 observably completes, and only then flips to 100.etaSecondsduring phase 1 is a linear extrapolation(elapsed / done) × remaining. During phase 2 it isswapCount × globalAvgMsPerSwap − elapsedRebuild, where the global average is an EWMA (alpha 0.1) updated after every successful rebuild.- Both fields are
nullbefore the first batch lands (no data yet to extrapolate from).
Example
Bulk variant
GET /internal/wallet-backfill/status?wallets=w1,w2,w3 returns { statuses: [...] }
with one entry per wallet, in the same order. Useful for dashboards polling many
wallets at once.
Related
- Trigger a backfill:
GET /api/2/wallet/positions?wallet=…&_backfillSwapsAndPositions=true - Tune phase 1 retention:
BACKFILL_VERSIONenv var (bump to invalidate all cached states)