connect dapp with walletconnect to trust wallet

2.6k Views Asked by At

I use this code to connect to trustwallet: https://docs.walletconnect.org/quick-start/dapps/client

This is my code:

  const Web3Modal = window.Web3Modal.default;
  const WalletConnectProvider = window.WalletConnectProvider.default;
  const Fortmatic = window.Fortmatic;
  const evmChains = window.evmChains;

  const WalletConnect = window.WalletConnect
  cosnt QRCodeModal = window.QRCodeModal

  const connector = new WalletConnect({
    bridge: "https://bridge.walletconnect.org", // Required
    qrcodeModal: QRCodeModal,
  });

  // Check if connection is already established
  if (!connector.connected) {
    // create new session
    connector.createSession();
  }

  // Subscribe to connection events
  connector.on("connect", (error, payload) => {
    if (error) {
      throw error;
    }

    // Get provided accounts and chainId
    const { accounts, chainId } = payload.params[0];
  });

But now I don't understand - I should see a popup window with qrcode how do I summon this window?

0

There are 0 best solutions below