WalletConnect / web3modal-react-native

Web3Modal React-Native SDK
https://web3modal.com
Apache License 2.0
46 stars 15 forks source link

TrustWallet | Failed to initiate multi-chain connection #30

Closed boulinb closed 1 year ago

boulinb commented 1 year ago

Hi ! 😃

Here are the problems I have with the TrustWallet implementation:

Here is a working implementation for you to test: https://github.com/boulinb/web3modal-react-native-issue

Thanks to you for your work on the package!

Benjamin

ignaciosantise commented 1 year ago

hey @boulinb if it works correctly in Rainbow, then the problem is on the wallet side.

Can you upload the sessionParams you are using?

boulinb commented 1 year ago

hey @ignaciosantise

Here's the sessionParams code for the implementation above

const DEFAULT_CHAIN = ['eip155:1', 'eip155:56', 'eip155:137'];

  const REQUIRED_METHODS = ['eth_sendTransaction', 'personal_sign'];
  const REQUIRED_EVENTS = ['chainChanged', 'accountsChanged'];
  const sessionParams = {
    namespaces: {
      eip155: {
        methods: REQUIRED_METHODS,
        chains: DEFAULT_CHAIN,
        events: REQUIRED_EVENTS,
        rpcMap: {},
      },
    }
  };
ignaciosantise commented 1 year ago

@boulinb can you check if it works with the latest version of Trust Wallet? I've just connected successfully

itsnyx commented 1 year ago

@ignaciosantise I've checked latest version of trust wallet. I could not initiate transaction ! is there a fix for this like new method ?

boulinb commented 1 year ago

Hey,

I'm updating the issue: I've found where the problem was coming from and I understand why it works well for you @ignaciosantise

When I imported my Trustwallet account for testing, I imported it as an ETH account, which is why it can't recognise other chains (see video below).

https://github.com/WalletConnect/web3modal-react-native/assets/37933218/36e8a117-5cdc-4619-bc56-429e4ab4c0c5

Do you think it will be possible to handle the error directly from the library in the future?

ignaciosantise commented 1 year ago

Hey @boulinb nice catch! I've just checked if i can do something in the SDK side but unfortunately i don't get any error/log/info when this happens :/

Most wallets show an error message saying that some networks are incompatible, maybe you can reach Trust with this suggestion.

Im closing this issue, as you've found the root cause 💪