feat(react): add useStreamCountdown hook for cliff and cancellation deadlines (#830) - #889
Merged
Jaydbrown merged 6 commits intoOct 5, 2026
Conversation
…ol#830) Describe the countdown contract for cliff and cancellation deadlines before the hook exists: remaining days/hours/minutes/seconds, the 1-second auto-tick, and the isPast clamp at zero. These fail on main with an unresolved import, matching the repo's test-first convention.
…lines (conduit-protocol#830) Add a dependency-free hook that turns a Unix-seconds deadline into days/hours/minutes/seconds with a 1-second auto-tick, so vesting and payroll cards no longer hand-roll timers. An optional startTimestamp adds progressFraction for the elapsed share of the window; without it the fraction is null since a deadline alone cannot define a range. Closes conduit-protocol#830
Exercise the paths a card actually hits: progressFraction before, during and past the window, zero-length windows, missing/non-finite timestamps, target changes mid-countdown, long-duration decomposition, and interval cleanup on unmount.
Add a usage example, return type and parameter notes to docs/react-hooks.md, and an [Unreleased] changelog entry, so the new public export is discoverable (the repo requires new public hooks to be documented).
The conduit-protocol#768/conduit-protocol#769 hooks reached into root SDK modules via '../../src/...', which resolves inside packages/react and does not exist, so importing '@streamfi/react' — and therefore bundling or testing the new useStreamCountdown export — failed before the build got started. Point both at the repo-root src/ path, matching examples/dashboard, so the JS bundle and the package test suite load again.
|
@esthereze 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! 🚀 |
Contributor
Author
|
@maintainer
Please check and merge pr to count towards dripwave
…On Tue, Sep 29, 2026, 2:16 PM drips-wave[bot] ***@***.***> wrote:
*drips-wave[bot]* left a comment (conduit-protocol/streamFi-sdk#889)
<#889 (comment)>
@esthereze <https://github.com/esthereze> 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
<https://docs.drips.network/wave/contributors/solving-issues-and-earning-rewards#application-limits>
—
Reply to this email directly, view it on GitHub
<#889?email_source=notifications&email_token=AYP5CSFAJURGIWOYY4SBAQ35ROYZHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBZGEYDKMJZGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5891051944>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYP5CSCRSIU2IFJBVU2EAX35ROYZHAVCNFSNUABGKJSXA33TNF2G64TZHMYTENJRHAZTGMZYGU5US43TOVSTWNJWGMYTCNJXGY3DLILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AYP5CSEG3X3DCAYNQ7YBWYL5ROYZHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBZGEYDKMJZGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AYP5CSHMCR4HQT3DEG7P4H35ROYZHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBZGEYDKMJZGQ2KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Contributor
Author
|
Thank you 🙏🏾
…On Mon, Oct 5, 2026, 1:37 PM TheBoyHasNoNamee ***@***.***> wrote:
Merged #889 <#889>
into main.
—
Reply to this email directly, view it on GitHub
<#889?email_source=notifications&email_token=AYP5CSGNNGZKFRIM6MFM2CT5SOIZXA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTGMRVGA3TSNJYGI2DDJTSMVQXG33OU5WWK3TUNFXW5JLFOZSW45FMMZXW65DFOJPWG3DJMNVQ#event-32507958241>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYP5CSDX7Y3MH3PC5HNABNT5SOIZXAVCNFSNUABGKJSXA33TNF2G64TZHMYTENJRHAZTGMZYGU5US43TOVSTWNJWGMYTCNJXGY3DLILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AYP5CSDQUMH3VTIV6QUQBYL5SOIZXA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTGMRVGA3TSNJYGI2DDJTSMVQXG33OU5WWK3TUNFXW5JLFOZSW45FKMZXW65DFOJPWS33T>
and Android
<https://github.com/notifications/mobile/android/AYP5CSFLWOQ46ZHMWGBGA2L5SOIZXA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTGMRVGA3TSNJYGI2DDJTSMVQXG33OU5WWK3TUNFXW5JLFOZSW45FOMZXW65DFOJPWC3TEOJXWSZA>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
useStreamCountdownto@streamfi/react— a 1-second-tick countdown to a cliff, cancellation, or completion deadline — so vesting and payroll cards no longer hand-roll timers.Type of change
Related issue
Closes #830
Changes
packages/react/src/hooks/useStreamCountdown.ts{ days, hours, minutes, seconds, isPast, progressFraction }packages/react/src/index.tsuseStreamCountdownandUseStreamCountdownResultpackages/react/src/__tests__/useStreamCountdown.test.tsxisPast,progressFraction, boundaries, cleanupdocs/react-hooks.mduseStreamCountdownguide sectionCHANGELOG.md[Unreleased]entrypackages/react/src/hooks/{useCircuitState,useTransactionHistory}.ts../../src/...relative imports that stopped the package barrel, JS bundle and test suite from loadingDesign notes
targetTimestamp(and the optionalstartTimestamp) are Unix timestamps in seconds, matchingStreamInfo.startTime/StreamInfo.endTime.progressFractionisnullunlessstartTimestampis supplied. When supplied it is the clamped0–1elapsed share of the window.null,undefined, or a non-finite target yields a zeroed,isPast: falseresult so a card can render while the stream is still loading.Quick usage:
Checklist
packages/reactsuiteanytypes introducedsrc/index.tsupdated with the new exportdocs/react-hooks.mdCHANGELOG.mdupdated under[Unreleased]npm run typecheck/npm run buildforpackages/react— see note belowBreaking changes?
Notes for reviewers
mainis already red on unrelated checks: the WebSocket heartbeat tests insrc/tests/relayer-stress.test.tstime out, the repo-root ESLint run has 6 pre-existing errors, and otherpackages/reacthooks carry pre-existing typecheck/DTS errors (useStreamNotes,useGovernorConfig,useStreamsBySender/Recipient). This PR introduces no new typecheck or lint errors — the two import-path fixes were required for the package's JS bundle and test suite to resolve the barrel at all, and they simply turn the oldTS2307 cannot find moduleinto theTS6059 rootDirdiagnostic for those two pre-existing hooks, whose real fix (importing the reducer/circuit modules through the SDK's public exports) is a separate concern.