feat(app): live transaction-count hint on transfer/withdraw amounts - #467
feat(app): live transaction-count hint on transfer/withdraw amounts#467Patrick-Ehimen wants to merge 2 commits into
Conversation
The confirmation dialog already reports how many on-chain transactions an amount needs, but only after the user commits to the action. Show the same information inline as the amount is typed, so a split is visible while it can still be adjusted. - Debounced (300ms) estimate per keystroke, so a typed-out amount costs one call rather than one per digit. - Shown only when the count exceeds one; a single-transaction amount is unremarkable and stays silent. - Stale responses are discarded by sequence number, since estimates can resolve out of order and would otherwise describe a discarded amount. - Recomputed on pool switch and on wallet connect, both of which change or unblock the estimate. - Best-effort throughout: a failed estimate clears the hint instead of raising, leaving the submit path to report anything that actually blocks. Refs NethermindEth#386
Fantoni0
left a comment
There was a problem hiding this comment.
Thanks for the contribution @Patrick-Ehimen 💯
I like the idea a lot, but I think some race conditions might happen.
My advice would be, rather than showing the number of steps a hint when configuring the transaction, you could show it in the confirm (app/js/confirm) modal. They already have access to the txCountRow() function, and you don't need to worry about calling ensureAppPool and avoid racing issues
Fantoni0
left a comment
There was a problem hiding this comment.
Thanks @Patrick-Ehimen
I was checking the deployed version on main, and noticed we already show a transaction-count hint on the confirm modal:
So not sure this PR would be adding anything else on this aspect :(
That being said, I think your changes for hardening the pool session are good and can still be merged. If you could please:
- Remove the html hints.
- Any logic related to transaction count/hints that is no longer needed
- Take a look to
navigation.js, I think it could also use the pendingSession guard (on the disconect function we call closeAppPool but a createAppPool might already be running)
I think we can still merge this 🙌
🚀 What’s this PR do?
Shows how many on-chain transactions an amount needs inline, as the user types, in the transfer and withdraw tabs only when that number is greater than one.
#436 already shows this figure in the confirmation dialog, i.e. after the user commits. This adds the part #386 describes as "updated whenever the input is changed by the user", so a split is visible while the amount can still be adjusted.
📎 Related issues
Refs #386 not
Closes, since #436 may already satisfy it in your view. Happy to close this if so.🧠 Context
Reuses the existing
PrivatePool.estimate(amount)call, so the inline hint and the dialog can't disagree.txCount > 1, per the issue.pool:selected(estimate is pool-specific) andwallet:ready(an amount typed before connecting is skipped for want of a wallet).inputevent.txCountRow: a failed estimate clears the hint rather than raising.Note:
txCountRow()guards withif (!txCount), so the dialog still renders "1 transaction" for single-transaction ops, which #386 asks to suppress. Left untouched as out of scope say the word and I'll align it.✅ Required Checklist