Skip to content

[Backend] Wire cancel stream endpoint to Soroban contract #413

@ogazboiz

Description

@ogazboiz

https://t.me/+DOylgFv1jyJlNzM0

Description

The smart contract has a cancel_stream function but no POST /streams/:streamId/cancel route exists in the backend v1 routes. Without this endpoint the frontend cancel UI and any external tooling cannot trigger on-chain cancellation. This issue tracks creating the endpoint, calling sorobanService.cancelStream(), and syncing the DB record to CANCELLED status on success.

Acceptance Criteria

  • POST /api/v1/streams/:streamId/cancel route exists and is registered
  • Endpoint validates JWT/SIWX session and confirms the caller is the stream sender
  • sorobanService.cancelStream(streamId, callerAddress) is invoked; txHash returned in response
  • DB stream record status is updated to CANCELLED on successful transaction
  • Returns 404 if stream not found, 403 if caller is not the sender, 409 if stream already cancelled/completed
  • Covered by at least one integration test

Files to Touch

  • app/api/routes/v1/streams/ — add cancel.ts route handler
  • app/services/soroban.service.ts — expose cancelStream method if not present
  • app/api/routes/v1/streams/index.ts — register the new route
  • app/repositories/stream.repository.tsupdateStatus helper
  • tests/integration/streams/cancel.test.ts — new test file

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related taskshigh-priorityCritical items for MVP

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions