Skip to content

fix(sdk): map React SDK stream fetches to backend detail contract (#1704) - #1718

Merged
blurbeast merged 2 commits into
LabsCrypt:mainfrom
intelliDean:fix/1704-sdk-stream-detail-contract
Oct 22, 2026
Merged

blurbeast merged 2 commits into
LabsCrypt:mainfrom
intelliDean:fix/1704-sdk-stream-detail-contract

Conversation

@intelliDean

Copy link
Copy Markdown
Contributor

Closes #1704

Summary

  • Decoupled detail endpoint from rpcUrl so useStream always queries /:streamId.
  • Added mapBackendStreamToFlowFiStream to map backend response shapes (numeric strings, BigInt timestamps, camelCase/snake_case) into typed FlowFiStream objects.
  • Handled cleanup on stream ID change and graceful 404 responses.
  • Exported mapping helper from @flowfi/react.

Testing

  • Added unit test suite in packages/flowfi-react/tests/useStream.test.tsx testing endpoint requests, mapping, 404 handling, and stream ID switches.
  • All 7 tests pass.

…LabsCrypt#1704)

- Fetch stream details via /:streamId detail endpoint regardless of configured Soroban RPC URL
- Decouple REST endpoints from Soroban RPC configuration in useStream
- Implement mapBackendStreamToFlowFiStream to convert backend stream contract to FlowFiStream
- Clean up previous stream state on ID switch and ignore stale responses from cancelled requests
- Handle 404 Not Found error responses gracefully
- Add comprehensive test suite covering configured providers, response mapping, 404s, and stream ID switching
Comment thread packages/flowfi-react/src/hooks/useStream.ts Fixed
@blurbeast
blurbeast merged commit 8582580 into LabsCrypt:main Oct 22, 2026
13 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.

[api] Map React SDK stream fetches to the backend detail contract

3 participants