Skip to content

feat: add point-in-time stream snapshots and claim endpoint - #935

Open
InfamousCanary wants to merge 1 commit into
ritik4ever:mainfrom
InfamousCanary:feat/stream-snapshot-claim-705-710
Open

feat: add point-in-time stream snapshots and claim endpoint#935
InfamousCanary wants to merge 1 commit into
ritik4ever:mainfrom
InfamousCanary:feat/stream-snapshot-claim-705-710

Conversation

@InfamousCanary

Copy link
Copy Markdown

Summary

This PR completes the existing stream snapshot and claim API endpoints.

GET /api/streams/:id/snapshot?at=

Adds point-in-time stream state calculation for an arbitrary Unix timestamp.

The endpoint now:

  • validates the at query parameter as a Unix timestamp
  • computes stream status at the requested point in time
  • returns vested, claimable, and remaining amounts
  • accounts for claim events that occurred on or before the requested timestamp
  • excludes later stream state changes from historical snapshots
  • freezes historical calculation appropriately for canceled streams
  • returns 400 for invalid, missing, or negative timestamps
  • returns 404 for unknown streams

This covers the required snapshot behavior, including:

  • before stream start → scheduled, vested 0
  • at stream end → completed, vested equals the total stream amount

POST /api/streams/:id/claim

Completes the existing claim endpoint by replacing the placeholder local transaction result with an actual Soroban claim transaction flow.

The endpoint now:

  • restricts claiming to the authenticated stream recipient
  • rejects completed or canceled streams
  • obtains the current on-chain claimable amount
  • builds the contract claim(stream_id, recipient, amount) invocation
  • prepares the Soroban transaction through RPC
  • signs it using the configured backend signing key
  • submits the transaction and waits for confirmation
  • returns the real transaction hash and amount claimed
  • records the successful claim in event history with the transaction hash and ledger sequence

No new dependencies or database migrations were introduced.

Validation

Targeted validation completed successfully:

  • ESLint passed for all changed/new implementation and test files
  • isolated TypeScript check passed for the new Soroban claim service
  • GET /snapshot tests: 7/7 passed
  • POST /claim tests: 7/7 passed
  • targeted tests total: 14/14 passed
  • scoped git diff --check passed

The repository-wide TypeScript check is currently blocked by pre-existing syntax errors in backend/src/services/streamStore.ts on the upstream baseline; those unrelated errors were intentionally left unchanged.

Closes #705
Closes #710

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@InfamousCanary Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@InfamousCanary is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 96fe677b-8b05-4842-89e9-259901e97e8d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

[FEATURE] Add POST /api/streams/:id/claim endpoint (trigger claim) [FEATURE] Add GET /api/streams/:id/snapshot point-in-time endpoint

1 participant