Skip to content

[BUG] Superfluid campaign widget: multi-chain claim flow broken under AppKit #164

Description

@goodbounties-nanoclaw-agent

Summary

Superfluid campaign widget (standalone) doesn't correctly support multi-chain claiming through AppKit. Active-chain display, claim availability, disconnect UX, and copy are all inconsistent between AppKit's injected/Metamask connector and its WalletConnect connector. The flow should walk through all eligible chains on its own, one at a time, driven by AppKit's own connection/chain state.

Scope

  • Repo: GoodDollar/GoodWidget
  • Packages: packages/superfluid-campaign-widget (shared claim/chain logic), apps/superfluid-campaign-web (standalone app — primary target for this fix)
  • Keep existing redirect-to-wallet support for other embed environments untouched

Current Problems

  • Network pill always shows "Celo," never reflects the actual active chain.
  • Claims are fetched/shown only for the active chain instead of all supported chains at once.
  • Connect button still displays "connected" after disconnecting via AppKit's modal, until a manual page refresh.
  • Button reads "Disconnect" even when AppKit is the active connector — disconnecting actually happens inside AppKit's own modal, so this is misleading.
  • AppKit's WalletConnect connector keeps showing "connect your wallet to claim G$" after connecting, while AppKit's injected/Metamask connector correctly clears it — inconsistent "connected" check between connector types.
  • WalletConnect connector shows a "switch network" button when a claim exists on another chain, but clicking it does nothing.
  • Injected/Metamask connector shows no such button at all, and instead a generic "have to wait a little longer" message even when claims are still available on other chains.

Required Changes

  • Always fetch and display claimable amounts for every supported chain at once, regardless of the active chain.
  • Derive the network pill from AppKit's actual active-chain state — single source of truth for both connector types.
  • Subscribe to AppKit's connect/disconnect events so the connect button's displayed state updates immediately, with no page refresh needed.
  • Change the connect button to "Network settings" (opens AppKit's modal) whenever AppKit is the active connector; only show a true "Disconnect" action for a non-AppKit direct-injected connection.
  • Unify the "wallet connected" check across AppKit's injected and WalletConnect connectors so the "connect your wallet" copy hides correctly for both.
  • Switch-network action: try a programmatic switchChain first; if unsupported or it fails, fall back to opening AppKit's connection/network modal. Apply consistently for both connector types.
  • Claim flow should automatically walk through all chains with an available claim, sequentially, prompting the user only for wallet transaction confirmations (with a clear "transaction pending" UI state) — no manual per-chain switching required from the user.
  • Copy: show "have to wait a little longer" only once claims on every chain are exhausted for the day. Otherwise, show per-chain claimable amounts plus "G$ Claim is still available on <chain-name>."

Implementation Notes

  • Standalone app (apps/superfluid-campaign-web) is the primary target; keep the existing redirect-to-wallet support for other embed environments working as-is.
  • AppKit's chain state should be the single source of truth for "active chain" — avoid a second, independently-tracked chain state inside the widget.
  • Keep it simple — reuse AppKit's own hooks/events for connect/disconnect/chain-change rather than re-deriving state manually.
  • No backwards-compatibility shims: if single-chain assumptions are baked into the shared widget/data-client code, update them directly rather than special-casing around them.

Acceptance Criteria

  • Network pill reflects the actual active chain at all times, for both AppKit connector types.
  • All chains' claimable amounts are visible regardless of which chain is currently active.
  • Disconnecting via AppKit's modal updates the connect button immediately, without a page refresh.
  • Connect button shows "Network settings" under AppKit; real "Disconnect" only for a direct-injected (non-AppKit) connection.
  • "Connect your wallet to claim G$" copy hides consistently after connecting, for both injected and WalletConnect connectors.
  • Switching to a chain with an available claim works for both connector types (programmatic switch, or AppKit modal fallback) — no dead buttons.
  • User can claim across all eligible chains in one sitting, confirming one transaction per chain, without manually managing chain switches.
  • "Have to wait a little longer" only appears once every chain's claim is exhausted for the day; otherwise per-chain claim status and "still available on <chain>" copy is shown.

Testing / Verification

  • Manual: connect with AppKit's injected/Metamask connector, claim on chain A, verify pill/claims update and the flow prompts to claim on chain B without manual switching.
  • Manual: repeat with AppKit's WalletConnect connector, verify identical behavior/copy to the injected path.
  • Manual: disconnect via AppKit's modal, verify the connect button updates without a refresh.
  • Manual: exhaust claims on all chains, verify "wait a little longer" copy only appears then.
  • Automated: extend/update the existing Playwright suite in apps/superfluid-campaign-web for the multi-chain claim flow where feasible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Prepare AI Task

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions