Skip to content

Add wallet activity-calendar and largest-transfers endpoints - #52

Merged
christabel888 merged 2 commits into
Stellar-Insightss:mainfrom
yosemite01:feat/28-29-wallet-activity-largest-transfers
Jul 21, 2026
Merged

Add wallet activity-calendar and largest-transfers endpoints#52
christabel888 merged 2 commits into
Stellar-Insightss:mainfrom
yosemite01:feat/28-29-wallet-activity-largest-transfers

Conversation

@yosemite01

Copy link
Copy Markdown
Contributor

Summary

Closes #28, closes #29.

  • GET /api/v1/wallets/{address}/activity-calendar — per-UTC-day transaction count for an address, sourced from the ingested payments table. Boundary is UTC midnight via SQLite date(), matching the convention noted in Add /api/v1/wallets/{address}/activity-calendar endpoint #28/Add /api/v1/network/daily-active-accounts time-series endpoint #15.
  • GET /api/v1/wallets/{address}/largest-transfers — the address's largest transfers (incoming or outgoing), ranked by USD value via the existing price feed rather than raw asset amount, since comparing a large XLM transfer to a small USDC transfer by raw amount is meaningless (per Add /api/v1/wallets/{address}/largest-transfers endpoint #29's own note). Ranking is computed over the address's most recent 1000 transfers to keep the query and the price-feed conversion pass bounded — documented as a TRANSFER_CANDIDATE_POOL constant, not silently assumed.
  • Assets with no price-feed mapping are excluded from the "largest" ranking rather than guessed at, since Add most-active-counterparties aggregation: DEX vs payment address classification #10 (counterparty/DEX classification) hasn't landed yet — this PR doesn't attempt that nice-to-have.
  • Added PriceFeedClient::with_provider() so handlers that depend on price conversion can be exercised with an injected provider in tests, instead of making real network calls to CoinGecko.
  • Registered both endpoints in the OpenAPI doc (Wallets tag).

Unrelated fixes included

main did not compile at all on a clean checkout. Since that blocks verifying any change, this PR's first commit repairs four small, unrelated pre-existing syntax bugs that were the direct compile blockers:

  • src/queue/mod.rs: a stray //! inner-doc-comment block mid-file (invalid placement).
  • src/services/realtime_broadcaster.rs, src/shutdown.rs: #[allow(clippy::expect_used)] attributes placed mid method-chain (invalid).
  • src/rpc/stellar.rs: a duplicated/dead code block left inside an else branch after a return, leaving a brace unclosed for the rest of the file.

After that fix, the build still fails with ~149 unrelated errors (dependency/API mismatches touching crypto signing, redis, tracing/opentelemetry, HMAC) — filed as #51, intentionally not addressed here since it's a much larger, unrelated cleanup.

Test plan

Four unrelated pre-existing bugs kept the crate from compiling at all:
misplaced inner doc comments in queue/mod.rs, #[allow(...)] attributes
placed mid method-chain in realtime_broadcaster.rs and shutdown.rs, and
a duplicated/dead code block in rpc/stellar.rs that left a brace
unclosed. Filed Stellar-Insightss#51 for the remaining
dependency/API-mismatch errors this does not address.
Closes Stellar-Insightss#28 and Stellar-Insightss#29.

- GET /api/v1/wallets/{address}/activity-calendar: per-UTC-day
  transaction count for an address, from the ingested payments table.
- GET /api/v1/wallets/{address}/largest-transfers: the address's
  largest transfers (in or out) ranked by USD value via the price
  feed, since comparing raw asset amounts across assets of different
  unit value is meaningless. Ranking is computed over the address's
  most recent 1000 transfers to keep the query and price-feed
  conversion pass bounded.

Also adds PriceFeedClient::with_provider() so handlers that depend on
price conversion can be tested with an injected provider instead of
making real network calls to CoinGecko.
@yosemite01
yosemite01 force-pushed the feat/28-29-wallet-activity-largest-transfers branch from 20a4ae2 to f8acc65 Compare July 21, 2026 13:28
christabel888 pushed a commit to Stellar-Insightss/Stellar-inights that referenced this pull request Jul 21, 2026
… Wallet dashboard

Closes #174.

Adds the two remaining Wallet Dashboard panels described in the pivot
doc, alongside the existing Balance History chart:

- ActivityCalendarHeatmap: a GitHub-style contribution calendar of the
  address's per-day transaction count, with total/active-days/streak
  summary stats. Grid math is done in UTC throughout (not local time)
  to match the backend's UTC-day convention and avoid an off-by-one
  shift for users outside UTC.
- LargestTransfersList: a table of the address's largest transfers by
  USD value, with direction (sent/received), counterparty, raw amount,
  and USD value.

Both consume new analytics-api.ts client functions
(fetchWalletActivityCalendar, fetchWalletLargestTransfers) against
/api/v1/wallets/{address}/activity-calendar and .../largest-transfers
(see Stellar-Insightss/backend#52), following the existing
fetchWalletBalanceHistory pattern: graceful mock-data fallback when the
backend is unreachable, so the dashboard still renders during local
development.

Fixes a pre-existing `any` type on the balance history state while
touching this file.
@christabel888
christabel888 merged commit e8b84fd into Stellar-Insightss:main Jul 21, 2026
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.

Add /api/v1/wallets/{address}/largest-transfers endpoint Add /api/v1/wallets/{address}/activity-calendar endpoint

2 participants