Skip to content

Integrate Stellar RPC for live contract queries #227

Description

@ogazboiz

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

All stream data is served from the indexed database. If the indexer falls behind or crashes, clients see stale data with no indication. Critical reads (claimable amount, stream status) should be backed by a live RPC fallback.

What Needs to Happen

  • Create backend/src/services/sorobanService.ts wrapping Stellar SDK contract calls
  • getStreamFromChain(streamId) — invoke get_stream() as a read-only simulation
  • getClaimableFromChain(streamId) — invoke get_claimable_amount()
  • Use on-chain data as fallback when DB updatedAt is older than 30 seconds
  • Add SOROBAN_RPC_URL and CONTRACT_ID to .env.example

Files

  • backend/src/services/sorobanService.ts (create)

Acceptance Criteria

  • Live contract queries work for both stream and claimable amount
  • Fallback activates when DB is stale
  • RPC errors are caught and logged without crashing the API

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions