Skip to content

feat: add get_user_commitments full-record reader#550

Open
Dayz-tech-co wants to merge 2 commits into
Commitlabs-Org:masterfrom
Dayz-tech-co:feature/get-user-commitments-full-records
Open

feat: add get_user_commitments full-record reader#550
Dayz-tech-co wants to merge 2 commits into
Commitlabs-Org:masterfrom
Dayz-tech-co:feature/get-user-commitments-full-records

Conversation

@Dayz-tech-co
Copy link
Copy Markdown
Contributor

@Dayz-tech-co Dayz-tech-co commented Jun 1, 2026

Closes #480


#480

This PR adds the missing get_user_commitments(owner) contract reader so the backend can use its primary full-record read path before falling back to id-based hydration.

What changed

  • Added get_user_commitments(owner) to contracts/escrow/src/lib.rs

    • returns full Commitment records
    • reads from the existing owner index
    • caps the response with MAX_USER_COMMITMENTS_READ to keep read payloads bounded
  • Added get_user_commitment_ids(owner)

    • preserves the backend fallback path naming
    • keeps id-only hydration available when needed
  • Kept get_owner_commitments(owner) as a legacy alias

    • now reuses the same owner-index helper as the new backend-named readers
  • Added tests in contracts/escrow/src/test.rs

    • verifies full records are returned for a user
    • verifies the full-record reader is bounded while the id reader still returns the full index
  • Updated contracts/README.md

    • documents the new primary reader
    • documents the fallback id reader
    • explains the size-bound rationale

Why

The backend currently tries get_user_commitments first, but the contract only exposed get_owner_commitments with ids. This PR closes that contract/backend mismatch and keeps the existing fallback path intact.

Validation

  • Added contract tests covering:
    • full-record owner reads
    • bounded response size behavior

Notes

  • The full-record reader is intentionally bounded to reduce the risk of oversized Soroban read responses.
  • The id-only readers remain available for compatibility and fallback hydration.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Dayz-tech-co is attempting to deploy a commit to the 1nonly's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Dayz-tech-co 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

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.

Contracts - Add get_user_commitments returning full records to match backend read path

1 participant