fix(citizen-claim-widget): keep claim toast visible through on-chain confirmation - #168
fix(citizen-claim-widget): keep claim toast visible through on-chain confirmation#168goodbounties-nanoclaw-agent[bot] wants to merge 2 commits into
Conversation
…rough on-chain confirmation Previously the "sign transaction in your wallet" toast for a chain's claim never updated after the wallet finished signing, so with a switch to manual sign-per-chain it looked stuck/duplicated across chains. - adapter.ts: wrap the wallet provider so an optional callback fires the instant eth_sendTransaction resolves (signed + broadcast), threaded through claim/claimOnChain/claimAll. No citizen-sdk change needed since GoodWidget already owns the provider handed to viem's custom() transport. - CitizenClaimWidget.tsx: on that signal, update each chain's toast copy to "waiting for blockchain confirmation" and keep it persistent until the claim promise actually settles (success/error), instead of leaving stale "sign in your wallet" copy visible. - Toast.tsx: add a 'confirming' status with a subtly deeper blue border ($primaryDark vs $primary) to distinguish "signing" from "awaiting confirmation" without resembling the success (green) state. Co-Authored-By: Claude <noreply@anthropic.com> On-Behalf-Of: gdpatchagent[onecli] (yaskkeryodtdijpv)
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
This PR adds a mid-flight “confirming” state for claim transactions and propagates a callback that fires after wallet submission (broadcast) but before on-chain confirmation, enabling UX toasts to transition from “sign in wallet” to “waiting for confirmation”.
Changes:
- Added
confirmingtoast status with styling and icon behavior. - Extended claim adapter action APIs to accept an
onTransactionSubmittedcallback. - Implemented an EIP-1193 provider proxy to detect
eth_sendTransactioncompletion and trigger the callback, then updated the widget to use the new confirming toast state.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/ui/src/components/Toast.tsx | Adds confirming toast status and maps it to styling + spinner icon behavior. |
| packages/citizen-claim-widget/src/widgetRuntimeContract.ts | Extends adapter action contract with optional onTransactionSubmitted callbacks. |
| packages/citizen-claim-widget/src/adapter.ts | Proxies EIP-1193 provider to emit a submission signal and threads callback through claim flows. |
| packages/citizen-claim-widget/src/CitizenClaimWidget.tsx | Uses onTransactionSubmitted to update toast status/message to confirming. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| return async (args: Parameters<EIP1193Provider['request']>[0]) => { | ||
| const result = await target.request(args) | ||
| if (args.method === 'eth_sendTransaction') { | ||
| onTransactionSubmitted() | ||
| } | ||
| return result | ||
| } |
| claim: (onTransactionSubmitted?: () => void) => Promise<unknown> | ||
| claimOnChain: (chainId: number, onTransactionSubmitted?: () => void) => Promise<unknown> | ||
| claimAll: ( | ||
| chainIds: number[], | ||
| onTransactionSubmitted?: (chainId: number) => void, | ||
| ) => Promise<CitizenClaimWidgetChainClaimResult[]> |
|
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Addressed in 6668551: fixed the missing |
|
|
Summary
@goodsdks/citizen-sdkchange required — GoodWidget already owns the raw wallet provider it hands to viem'scustom()transport inadapter.ts, so it can observe theeth_sendTransactioncall resolving directly.Changes
adapter.ts: provider-proxy helper (wrapProviderWithSubmissionSignal) detects the wallet'seth_sendTransactionresolving; threaded as an optionalonTransactionSubmittedcallback throughclaim/claimOnChain/claimAll.CitizenClaimWidget.tsx: on that signal, updates each chain's toast to"Claiming on <chain> — waiting for blockchain confirmation"with aconfirmingstatus, staying persistent (duration: 0) until the claim promise settles.Toast.tsx: adds aconfirmingToastStatuswith a subtly deeper blue border ($primaryDarkvs$primaryfor signing) so it reads as related-but-distinct from the initial signing toast, and stays clearly different from the greensuccessstate.Scope note
Only the default non-custodial (wallet-provider-driven) claim path is covered — the one in the bug report. Custodial execution mode (
claimExecution.clientsByChain) supplies pre-built clients from outside GoodWidget, so we don't control that provider and can't intercept it the same way; flagging as a possible separate follow-up if that path is ever in scope.Test plan
pnpm --filter @goodwidget/ui --filter @goodwidget/citizen-claim-widget --filter @goodwidget/superfluid-campaign-widget --filter @goodwidget/embed build— cleanpnpm --filter @goodwidget/ui --filter @goodwidget/citizen-claim-widget --filter @goodwidget/superfluid-campaign-widget --filter @goodwidget/embed lint— clean (only pre-existing warnings unrelated to this change)🤖 Generated with Claude Code