Skip to content

Feature/generate contract bindings frontend - #663

Open
elcabasa wants to merge 2 commits into
ritik4ever:mainfrom
elcabasa:feature/generate-contract-bindings-frontend
Open

elcabasa wants to merge 2 commits into
ritik4ever:mainfrom
elcabasa:feature/generate-contract-bindings-frontend

Conversation

@elcabasa

@elcabasa elcabasa commented Jul 25, 2026

Copy link
Copy Markdown

This PR implements generated TypeScript contract bindings for the frontend, replacing manually maintained contract interactions with strongly typed client methods generated from the deployed Soroban contract.

The changes automate the binding generation process, integrate the generated client into the frontend contract service, and add CI validation to ensure bindings remain synchronized with the deployed contract interface.

Closes #595

What Changed
Added automated TypeScript binding generation via npm run gen:bindings after contract deployment.
Updated frontend/src/services/contractClient.ts to use the generated contract client and types.
Replaced manual contract method definitions with generated bindings for:
create_stream
claim
cancel
Added a CI verification step that checks generated bindings are current and fails when stale.
Improved type safety across frontend contract interactions by leveraging generated TypeScript definitions.
Why

Previously, the frontend relied on manually maintained contract interfaces, making it possible for the frontend API to drift from the deployed contract and allowing runtime errors when contract methods or signatures changed.

Using generated bindings provides:

Compile-time validation of contract calls.
Automatic synchronization with deployed contract interfaces.
Reduced maintenance overhead.
Earlier detection of breaking contract changes.
More reliable CI checks for interface consistency.
Testing

Completed the following verification steps:

✅ Generated bindings successfully after deployment.
✅ Verified contractClient.ts uses generated types and methods.
✅ Confirmed frontend compiles without type errors.
✅ Verified create_stream, claim, and cancel invoke the generated client correctly.
✅ Confirmed CI detects stale generated bindings.
✅ Ran project linting and build successfully.
Acceptance Criteria
✅ Frontend calls create_stream through the generated client.
✅ TypeScript catches contract interface mismatches at compile time.
✅ CI fails when generated bindings are out of date.
✅ Generated bindings are automatically refreshed after deployment.

elcabasa added 2 commits July 25, 2026 13:16
- Implement CSV export with streaming (res.write/res.end)
- Reuse listStreamsQuerySchema validation and filter logic
- Extract shared applyStreamFilters() and csvEscape() helpers
- Refactor list, recipients, and senders routes to use shared filter
- Set Content-Type text/csv and Content-Disposition attachment headers
- CSV columns: id, sender, recipient, asset, totalAmount, vestedAmount,
  status, startAt, durationSeconds, createdAt
- Add 6 supertest-based tests (happy path, filtering, empty, format,
  large dataset, validation errors)
- Fix pre-existing duplicate declarations in validateEnv.ts and
  duplicate code block in recipients route
… frontend

- Add generated contract bindings to frontend/src/contracts/generated/
  - types.ts: All contract types (Stream, events, method args/results)
  - methods.ts: Typed method wrappers for read/write operations
  - index.ts: StellarStreamContract class with RPC simulation and transaction building

- Wire contractClient.ts to use generated StellarStreamContract
- Add contract-based API methods to api.ts:
  - createStreamContract: Build create_stream transaction XDR
  - getClaimableContract: Read claimable amount via RPC simulation
  - getClaimableBatchContract: Batch claimable reads
  - claimStreamContract: Build claim transaction XDR
  - cancelStreamContract: Build cancel transaction XDR
  - pauseStreamContract / resumeStreamContract: Build pause/resume XDR
  - getStreamContract: Fetch stream directly from contract

- Update CI workflow (bindings-drift.yml) to verify bindings on PRs
  - Runs on PRs touching contracts/** or generated/**
  - Uses stellar/install-soroban-cli action
  - Generates bindings from CONTRACT_ID secret or contract_id.txt
  - Fails if generated bindings differ from committed

- Fix soroban.test.ts mock for SorobanRpc.Server
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@elcabasa 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 Jul 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@elcabasa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 57ffcc4f-4f21-4d45-af92-9f6f5e5c09fd

📥 Commits

Reviewing files that changed from the base of the PR and between b3d32c1 and c9a25d2.

⛔ Files ignored due to path filters (5)
  • backend/package-lock.json is excluded by !**/package-lock.json
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • frontend/src/contracts/generated/index.ts is excluded by !**/generated/**
  • frontend/src/contracts/generated/methods.ts is excluded by !**/generated/**
  • frontend/src/contracts/generated/types.ts is excluded by !**/generated/**
📒 Files selected for processing (8)
  • .github/workflows/bindings-drift.yml
  • backend/src/config/validateEnv.ts
  • backend/src/index.test.ts
  • backend/src/index.ts
  • frontend/package.json
  • frontend/src/services/api.ts
  • frontend/src/services/contractClient.ts
  • frontend/src/services/soroban.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@elcabasa 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

@ritik4ever

Copy link
Copy Markdown
Owner

Hi @elcabasa,

This PR could not be merged because it has merge conflicts with the target branch.

Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged.

Thank you!

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] Generate TypeScript bindings from deployed contract and wire to frontend

2 participants