-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: cannot connect with WC to Opensea #3437
Conversation
If the user is trying to connect with WC to Opensea and the user is on a chain other than mainnet the first connection attempt fails. The second one succeeds. This is because when opensea sees the list of optional chains, after establishing a session it sends a request, but the request is for the optional chain and not for the required one and we end up blocking it. By giving up on the optional namespace Opensea sends the request to the requried chain.
Branch preview✅ Deploy successful! |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
📦 Next.js Bundle Analysis for safe-wallet-webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 🎉 Global Bundle Size Decreased
DetailsThe global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster. Any third party scripts you have added directly to your app using the If you want further insight into what is behind the changes, give @next/bundle-analyzer a try! |
Coverage report
Show files with reduced coverage 🔻
Test suite run success1410 tests passing in 195 suites. Report generated by 🧪jest coverage report action from 3c4a003 |
@katspaugh - I've been thinking about the failing tests.
I've find another way to make this work. First we approve with requiredChain, then immediately after that we update the session with the Optional namespace. Then later our changes to the accounts will be properly propagated to all supported chains. The test still fails though, but that is I guess expected as we are not really testing whether approve has succeeded, but rather whether it was called with the "correct" arguments :( |
If the user is trying to connect with WC to Opensea and the user is on a chain other than mainnet the first connection attempt fails. The second one succeeds. This is because when opensea sees the list of optional chains, after establishing a session it sends a request, but the request is for the optional chain and not for the required one and we end up blocking it. By giving up on the optional namespace Opensea sends the request to the requried chain. We then immediately update the session with the optional namespaces - this way switching accounts works fine for dapps and we don’t disconnect when we switch networks.
ok, now it should be fine everywhere :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and we tested the happy path together (Connecting to OpenSea). I suggest we do regression tests for other WC cases before merging. Things like switching to a different Safe on the same network, switching to a different Safe on a different network etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
LGTM Connecting with a different network than the one expected by OpenSea, it changes the network in openSea itself and connects fine. |
If the user is trying to connect with WC to Opensea and the user is on a chain other than mainnet the first connection attempt fails. The second one succeeds. This is because when opensea sees the list of optional chains, after establishing a session it sends a request, but the request is for the optional chain and not for the required one and we end up blocking it. By giving up on the optional namespace Opensea sends the request to the requried chain.
How to test it
Go to opensea to a collection that is on let's say OP. Try to establish WC connection to your safe that is also on OP. Establishing a connection should work.
Screenshots
Checklist