alephium / alephium-frontend

A monorepo containing all things frontend on Alephium.
Other
11 stars 9 forks source link

[EPIC] Desktop and mobile wallets crash when connecting to dApp on testnet/devnet that uses only `@alephium/walletconnect-provider` (not `@alephium/web3-react`) #331

Open nop33 opened 7 months ago

nop33 commented 7 months ago

.User reports:

testnet works fine and loads my Testnet balance, the crash happens only when I try to use WalletConnect.

This when networkId is anything except for 'mainnet' (undefined, 'testnet', 'devnet').

White screen on desktop (2.2.2) & app close on android (1.0.4).

image

I'm not using the react package, just the walletconnect-provider directly. I'll try to make a small repro later.

The user is using Vue so they can't use our @alephium/web3-react package.

nop33 commented 7 months ago

I have not managed to reproduce this. I tried using @alephium/web3-react and initialize connectors with <AlephiumWalletProvider network="testnet"> and I could connect to both wallets. When I tried to use <AlephiumWalletProvider network="devnet">, then I got this issue: https://github.com/alephium/alephium-frontend/issues/325

As the user suggested, I also tried to use plain @alephium/walletconnect-provider without using @alephium/web3-react. I managed to get the URI and I could paste it on the desktop wallet and connect to the dApp successfully and even sign a message:

import { WalletConnectProvider } from "@alephium/walletconnect-provider"

const connect = async () => {
  const wcProvider = await WalletConnectProvider.init({
    projectId: "6e2562e43678dd68a9070a62b6d52207",
    networkId: "testnet",
    onDisconnected: () => Promise.resolve(),
  })

  wcProvider.on("displayUri", (uri) => console.log(uri))

  await wcProvider.connect()

  if (wcProvider.account)
    wcProvider.signMessage({
      signerAddress: wcProvider.account.address,
      message: "Hello there!",
      messageHasher: "alephium",
    })
}

connect()