hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 42 forks source link

1inch: Wallet Connect Sign in Broken (p1) #5845

Closed RhysCommonwealth closed 9 months ago

RhysCommonwealth commented 9 months ago

Describe the bug

Unable to sign in to existing accounts via wallet connect or create an account with a wallet connect sign in. (two different errors)

To Reproduce

  1. Click Sign in
  2. Press wallet connect option
  3. Sign in to existing account or try and make a new one

    Expected behavior

    Wallet connect sign in should work.

    Additional context

    When creating a new account with Wallet Connect:

    Screenshot 2023-12-05 at 10 09 50 AM

    ^tried with Zerion & 1inch wallet login

Error from 1inch when trying to log in to an existing account with Wallet Connect: photo_2023-12-05 10 11 18

ilijabojanovic commented 9 months ago

This issue is only visible on 1inc wallet.

  1. Install 1inch wallet on iOS or Andorid
  2. Go to https://commonwealth.im/
  3. Click on log in and select wallet connect
  4. On mobile device scan qa code

Actual: We have issues in console

global:1 Failed to launch 'zerion://wc?uri=wc%3Accec61270a0449b053c70a95be5357a6f62f06a978ec7e532453192ebf0b27b0%402%3Frelay-protocol%3Dirn%26symKey%3D6e88ca1aa280b5341c26316b2dd66a77477e7b5892843bfac094830a559a5f29' because the scheme does not have a registered handler.
global:1 Failed to launch 'zerion://wc?requestId=1701792213156056&sessionTopic=613d034fe4152dded8ff2632f07cb9d92553c022fcb4f1bd6580f3ef435678c0' because the scheme does not have a registered handler.
3297.f991ba92.chunk.js:2 Object ''
e.<computed> @ 3297.f991ba92.chunk.js:2
global:1 Failed to launch 'zerion://wc?requestId=1701792598263270&sessionTopic=31e5570307e4bb8e1610cd545bf0b94c159bd47760a778ab6b552e603a2cf895' because the scheme does not have a registered handler.
3297.f991ba92.chunk.js:2 Object 'Internal JSON-RPC error.'
e.<computed> @ 3297.f991ba92.chunk.js:2
CowMuon commented 9 months ago

@ilijabojanovic Only visible on 1inch? I was unable to sign in with Trust or Uniswap, in both cases the request is just never returned. Feels like a possible library version issue upstream.

ianrowan commented 9 months ago

I think this has been broken since session keys potentially and am a bit confused as to how any communities were using wallet connect to sign in

Here is a snippet of the fix:

image

The ordering of the params for personal sign was incorrect, so the less robust wallets were throwing errors(more robust wallets apparently can re-order by flipping 20 byte hex strings to the second param even if sent as the first)

Wallet connect docs

https://docs.walletconnect.com/advanced/rpc-reference/ethereum-rpc#parameters

will push a pr with this fix and it should resolve the issue for 1inch wallet, trust wallet(tested both), and all other wallet connect evm wallets

CC @CowMuon @ilijabojanovic @jnaviask