Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a transaction timer class to reuse #4852

Merged
merged 4 commits into from Mar 19, 2024

Conversation

patnir
Copy link
Contributor

@patnir patnir commented Mar 18, 2024

Summary

Adds a transaction timer class that abstracts the timer logic away from combine notes.
This is in setup for adding the timer to wallet:send

Testing Plan

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and label it with breaking-change-rpc or breaking-change-sdk.

[ ] Yes

@patnir patnir requested a review from a team as a code owner March 18, 2024 23:37
) {
this.logger = logger ?? createRootLogger()
this.estimateInMs = Math.max(Math.ceil(spendPostTime * raw.spends.length), 1000)
options.displayEstimate && this.displayEstimate()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it is unusual for constructors to have side-effects (in this case, printing something). I would make this behavior more explicit and require callers to call this method explicitly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feedback, I had it that way originally and I'll change it back

const progress = Math.round((durationInMs / this.estimateInMs) * 100)

this.progressBar.update(progress, {
estimate: TimeUtils.renderSpan(timeRemaining, { hideMilliseconds: true }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If timeRemaining is negative, this will show a negative estimate. Is there a way to show "unknown" or maybe "soon" instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior currently involves "counting up" after the countdown is complete. I talked through some options with Jason when initially implementing this and this seemed like the best one. This PR is only a refactor, so I'll leave as is but I'll continue to think through more options.

@patnir patnir merged commit 84e6771 into staging Mar 19, 2024
9 checks passed
@patnir patnir deleted the rahul/ifl-2306-add-transaction-timer-class-2 branch March 19, 2024 02:04
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.

None yet

2 participants