Skip to content

feat: add real-time Solana gRPC streaming endpoints#94

Merged
user1303836 merged 1 commit intomainfrom
feature/realtime-streaming
Feb 18, 2026
Merged

feat: add real-time Solana gRPC streaming endpoints#94
user1303836 merged 1 commit intomainfrom
feature/realtime-streaming

Conversation

@user1303836
Copy link
Owner

Summary

  • Adds POST /v1/stream/start, POST /v1/stream/{id}/stop, GET /v1/streams endpoints for continuous Solana transaction ingestion via gRPC
  • Consumer task batches transactions (100/batch or 5s flush) and persists to DB with auto-cleanup on stop/disconnect
  • Concurrency-limited to 5 simultaneous streams via semaphore; CancellationToken for graceful shutdown
  • New config: SOLANA_GRPC_URL and SOLANA_GRPC_TOKEN env vars (also via SPECTRAPLEX_ prefix or spectraplex.toml)
  • Repository is now Clone (PgPool is Arc-backed) so the stream consumer can hold its own reference

Files changed

  • core/src/config.rs - added solana_grpc_url and solana_grpc_token fields
  • adapters/src/repo.rs - added #[derive(Clone)] to Repository
  • api/Cargo.toml - added tokio-util dependency
  • api/src/main.rs - streaming types, handlers, routes, and 13 new tests

Test plan

  • Unsupported chain (non-solana) returns 400
  • Missing gRPC URL config returns 400
  • Auth required on all 3 streaming endpoints
  • Stop on non-existent stream returns 404
  • Stop on active stream cancels token and returns "stopping"
  • List streams returns empty array when none active
  • List streams returns stream info with counters
  • Semaphore blocks when limit reached (503)
  • StreamInfo serialization
  • All 188 workspace tests pass, clippy clean, fmt clean

Wire the existing SolanaGrpcAdapter into new API endpoints for
continuous transaction ingestion:

- POST /v1/stream/start - starts a background gRPC streaming task
- POST /v1/stream/{id}/stop - cancels a running stream
- GET /v1/streams - lists active streams with status

Each stream spawns a consumer task that batches transactions (100 per
batch or 5s flush interval) and saves them to the DB. Streams are
limited to MAX_CONCURRENT_STREAMS (5) via a semaphore and auto-cleanup
on completion or cancellation.

Config: SOLANA_GRPC_URL and SOLANA_GRPC_TOKEN env vars control the
gRPC connection. Streaming is Solana-only for now.
@user1303836 user1303836 force-pushed the feature/realtime-streaming branch from 7348250 to 3ccf1bd Compare February 18, 2026 22:45
@user1303836 user1303836 merged commit 96452c6 into main Feb 18, 2026
5 checks passed
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