Skip to content

feat: paginate client history, add address counters, and include token in events (#152, #153) - #202

Open
Bilalishaq7 wants to merge 2 commits into
Yormee-103:mainfrom
Bilalishaq7:feat/issue-152-153-pagination-events
Open

Bilalishaq7 wants to merge 2 commits into
Yormee-103:mainfrom
Bilalishaq7:feat/issue-152-153-pagination-events

Conversation

@Bilalishaq7

Copy link
Copy Markdown

Summary

This pull request addresses issues #152 and #153:

  • Adds paginated client invoice history reads and per-address invoice counter accessors for both freelancers and clients.
  • Enriches InvoiceCreated and InvoicePaid event schemas with token contracts and due dates to allow indexers to consume self-contained events without redundant RPC queries.

Closes #152
Closes #153

Changes

1. Client History Pagination and Count Accessors (#152)

  • Added get_client_invoice_range(client: Address, start: u32, len: u32) -> Vec<Invoice> for bounded client history reads.
  • Added freelancer_invoice_count(freelancer: Address) -> u32 and client_invoice_count(client: Address) -> u32 for pagination metadata.
  • Preserved existing get_client_history and get_invoice_history functions for full backward compatibility.
  • Added test coverage in contracts/invoice/src/test.rs:
    • get_client_invoice_range_respects_bounds: verifies pagination offsets, length limits, and ordering across multiple pages.
    • get_client_invoice_range_for_unknown_client_is_empty: verifies empty responses for non-existent addresses.
    • per_address_invoice_counts_track_totals: verifies count increments, cross-party counts, and zero counts for unknown addresses.
  • Documented new entrypoints, storage mapping, and legacy pre-index migration note in contracts/invoice/README.md.

2. Event Schema Enrichment for Indexers (#153)

  • Updated InvoiceCreated event to include token: Address and due_date: u64.
  • Updated InvoicePaid event to include token: Address.
  • Updated event emission logic in create_invoice_inner and fund_invoice.
  • Added test event_emission_includes_token_and_due_date asserting emitted event topics and map fields.
  • Updated event documentation table and indexer compatibility notes in contracts/invoice/README.md.

Verification

  • cargo fmt --check: passed
  • cargo clippy --all-targets: passed (0 warnings)
  • cargo test: all 31 tests passed

@drips-wave

drips-wave Bot commented Nov 25, 2026

Copy link
Copy Markdown

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

@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

@Bilalishaq7 is attempting to deploy a commit to the yormee-103's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Yormee-103

Copy link
Copy Markdown
Owner

fix conflicts

@Bilalishaq7
Bilalishaq7 force-pushed the feat/issue-152-153-pagination-events branch from bd26115 to 8d35f0c Compare November 28, 2026 13:50

This branch has not been deployed

No deployments
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.

Contract: include token and due date in InvoiceCreated events for indexers Contract: paginate client history and expose per-address invoice counts

2 participants