storacha / w3up

⁂ w3up protocol implementation
https://github.com/storacha/specs
Other
64 stars 22 forks source link

feat: wait for plan selection #1547

Closed fforbeck closed 2 months ago

fforbeck commented 2 months ago

Add wait() Method to AccountPlan Class

Summary

This PR introduces a new wait() method to the AccountPlan class, which simplifies the process of waiting for a payment plan to be selected. By integrating configurable polling intervals, timeouts, and abort signals, the method abstracts the common logic required in this scenario, making it easier for developers to implement and customize their workflows.

Changes

How to Test

  1. Run the test suite with npm run build && npm run test.
  2. Ensure all existing tests pass.
  3. Verify that the new test cases for the wait() method in account.test.js are passing, including tests for:
    • Successful payment plan selection.
    • Timeout errors.
    • Aborted operations.