Description
Implement a view to list a recipient’s packages with simple pagination to support UI lists.
Requirements
- Add
list_recipient_packages(env: Env, recipient: Address, cursor: u64, limit: u32) -> Vec<u64>.
- Behaviour:
- Iterate from
cursor up to cursor + limit or package_counter, whichever comes first.
- For each existing package where
package.recipient == recipient, push package_id into the result.
- Return the collected IDs; cursor management will be handled by the client.
- Add tests for:
- Recipient with few packages (less than
limit).
- Recipient with more packages than a small
limit.
Complexity
Description
Implement a view to list a recipient’s packages with simple pagination to support UI lists.
Requirements
list_recipient_packages(env: Env, recipient: Address, cursor: u64, limit: u32) -> Vec<u64>.cursorup tocursor + limitorpackage_counter, whichever comes first.package.recipient == recipient, pushpackage_idinto the result.limit).limit.Complexity