Skip to content

fix: handle Magic personal_sign from ReownAppKitModal - #427

Open
o-mid wants to merge 3 commits into
reown-com:developfrom
o-mid:fix/appkit-magic-siwe-request
Open

o-mid wants to merge 3 commits into
reown-com:developfrom
o-mid:fix/appkit-magic-siwe-request

Conversation

@o-mid

@o-mid o-mid commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Hey @ignaciosantise — this is the social+SIWE hang from #41.

Nonce and createMessage run, then Magic personal_sign never finishes unless AppKitModalAccountButton stays in the tree. The modal already listens to onMagicRpcRequest, but _onMagicRequest only handled results. Incoming requests now push ApproveTransactionPage the same way the account button does.

Fixes #41

Test plan

  • Social (Apple) login with SIWE enabled, no hidden AppKitModalAccountButton
  • Sign completes and /auth/v1/authenticate / verifyMessage is called
  • Existing account-button path still works

Social SIWE never reached verifyMessage unless AppKitModalAccountButton stayed mounted. The modal already subscribed to the RPC event; it just ignored incoming requests.
AccountButton also subscribed to the same RPC event, so a mounted button plus this fix would push ApproveTransactionPage twice.
Copilot AI lite review requested due to automatic review settings September 5, 2026 07:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new request-handling path can push the approval page twice when AppKitModalAccountButton is mounted because both it and the modal subscribe to the same Magic RPC request event.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes a social login + SIWE flow hang by ensuring ReownAppKitModal itself reacts to incoming Magic personal_sign RPC requests and presents the Magic approval WebView page, removing the requirement to keep AppKitModalAccountButton mounted solely to drive the approval UI.

Changes:

  • Listen for Magic RPC requests (not only results) in ReownAppKitModal and open/push the Magic approval page.
  • Document the behavior change in packages/reown_appkit/CHANGELOG.md for the next patch release.
File summaries
File Description
packages/reown_appkit/lib/modal/appkit_modal_impl.dart Pushes/opens the Magic approval page when a Magic RPC request arrives.
packages/reown_appkit/CHANGELOG.md Adds a 1.9.1 entry describing the SIWE + Magic approval-page fix.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/reown_appkit/lib/modal/appkit_modal_impl.dart
@o-mid

o-mid commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@ignaciosantise this is the social+SIWE hang from #41. The modal already listened to Magic RPC but only handled results, so personal_sign never showed unless AppKitModalAccountButton stayed mounted.

I also dropped the account-button subscription so we don't push ApproveTransactionPage twice when both are around (there's a TODO on that widget saying this belongs in the modal anyway).

@o-mid

o-mid commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@ignaciosantise still merge-ready after catching latest develop. Please approve/apply when you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assistance with SIWE

2 participants