-
Notifications
You must be signed in to change notification settings - Fork 38
Data & Queries] Soroban: Read APIs for invoice payment status (Medium, 150 points) #22
Copy link
Copy link
Open
Labels
Description
Description
Add view methods to the Soroban contract so clients can query payment information for a given invoice ID or list recent payments, complementing event-based indexing.
Requirements and Context
- Events are great for streaming, but some clients need direct queries.
- The current contract may only emit events without stored state.
- Done means:
- View functions exist to:
- Get payment info by
invoice_id. - Optionally list payments for a given payer or recent history.
- Get payment info by
- View functions exist to:
Suggested Execution
- Extend the Soroban contract:
- Add storage mapping from
invoice_idto a payment record. - Implement a view method like
get_payment(invoice_id)returning a struct.
- Add storage mapping from
- Ensure:
- Reads are cheap and don’t mutate state.
- The data model aligns with the backend’s expectations.
Test and Commit
- After recording a payment:
- Call
get_payment(invoice_id)via the Soroban CLI. - Confirm the data returned matches what was recorded.
- Call
- Include in your PR:
- Command examples to query payment status.
- Sample outputs for successful lookups and not-found cases.
Example Commit Message
feat(contracts): add soroban view apis for invoice payment status
Guidelines
- Complexity: Medium (150 points) — adds state and read methods, but limited surface area.
- Handle non-existent invoices gracefully (e.g. return null/empty or a descriptive error).
- Keep the storage layout simple and well-documented.
- Reference this issue in your PR description (
Closes #<issue_id>).
Reactions are currently unavailable