fix(demo): format session cumulative amount and split channel open UX#8
Conversation
…open from voucher Display cumulative amount using formatUnits with USDC_DECIMALS and a $ prefix so the UI shows $0.001 instead of raw 1000. Add onChannelOpened callback to abstractSession so the demo can pause between the on-chain channel open and the first voucher signature, requiring two discrete button presses for stream initiation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 2c0a0ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Demo UX updates: The session demo is reworked into explicit phases so the first interaction becomes two steps ("Open Channel" then "Sign Voucher"), while later payments remain single-click; it also formats the displayed cumulative amount using Written by Cursor Bugbot for commit 2c0a0ba. This will update automatically on new commits. Configure here. |
Add onChannelOpened callback to abstractSession client options to support deferring voucher signing.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| ) | ||
| fetchPromiseRef.current = null | ||
| }) | ||
| } |
There was a problem hiding this comment.
UI freezes on retry after failed voucher signing
Medium Severity
handleOpenChannel assumes onChannelOpened will always fire, but the callback only runs for new channels (inside if (!entry) in session.ts). If the first request opens a channel on-chain and the user then rejects the voucher signature, the channel entry persists in the client's internal channels map while state.channelOpen stays false. On retry, handleOpenChannel fires mppx.fetch again, which takes the "voucher for existing channel" path — onChannelOpened is never called, so the phase never transitions from 'opening' to 'awaitingVoucher', and no handler ever processes the resolved response. The UI gets permanently stuck on the "Opening channel…" spinner.


Summary
formatUnitswith USDC 6 decimals) and prefix with$— shows$0.001instead of raw1000onChannelOpenedcallback toabstractSessionclient options, called after the on-chain channel open but before voucher signing — supports deferring the voucher via a returned PromiseTest plan
$0.001,$0.002, etc. after each session request