fix: report the submitted amount in the delegation confirmation#742
fix: report the submitted amount in the delegation confirmation#742rickstaa wants to merge 1 commit into
Conversation
onDelegate clears the amount immediately after submitting, long before the transaction hash arrives, so useHandleTransaction recorded an amount of 0. The confirmation dialog reads that as a zero-value bond and reports a stake migration for every delegation. Capture the args on submit and record those instead. Fixes #741 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Fixes the delegation confirmation dialog showing the “stake migrated” copy for normal delegations by ensuring the recorded transaction args reflect what was submitted (not what the input contains after the form is reset).
Changes:
- Capture a snapshot of
bondWithHintcall args at submission time inDelegate.tsx. - Pass the submitted snapshot to
useHandleTransaction, falling back to live args prior to the first submission.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Warning Review limit reached
Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #741.
Problem
Every plain delegation confirms with the stake-migration copy:
TxConfirmedDialog/index.tsx:120selects that fromNumber(tx.inputData.amount) <= 0, which is the right rule — a genuine "Move Delegated Stake" bonds zero. The problem is the amount it reads.onDelegatesubmits and then callsreset()→setAmount("")immediately, without waiting for the hash.useHandleTransaction'suseEffect(..., [data])runs later and records the current args, by which point the amount is0. The hash can never arrive beforereset(), so it happens on every delegation rather than intermittently.Fix
Capture the args when the transaction is submitted and pass those to
useHandleTransaction, falling back to the live ones before submission.Display only — the calldata is unchanged, and
unbondis unaffected sinceUndelegate.tsxnever callsreset().Testing
Not verified against a wallet. Delegating a real amount should confirm with "successfully delegated N LPT", and Move Delegated Stake should still show the migration copy, since that path legitimately bonds zero.
Note
This is the third item from #739, split out because it is self-contained. That issue still covers the receipt-waiting and cache-invalidation work in the same hook.
🤖 Generated with Claude Code