WalletConnect React Native - No events fired

1.3k views Asked by At

I'm having a hard time getting WalletConnect 1.7.7 to work on React Native. I want to integrate in a crypto Wallet to handle dapps requests. Their documentation is...lacking. I'm following the "quickstart" in their docs, but listeners never gets fired.

import WalletConnect from "@walletconnect/client";

// Create connector
const connector = new WalletConnect(
  {
    // Required
    uri: "wc:8a5e5bdc-a0e4-47...TJRNmhWJmoxdFo6UDk2WlhaOyQ5N0U=",
    // Required
    clientMeta: {
      description: "WalletConnect Developer App",
      url: "https://walletconnect.org",
      icons: ["https://walletconnect.org/walletconnect-logo.png"],
      name: "WalletConnect",
    },
  });

connector.on("session_request", (error, payload) => {
  if (error) {
    throw error;
  }

  // Handle Session Request
});

But session_request or any other event never get's fired. As per their documents that's all I need. Is there anything else I'm missing or perhaps it's not documented?

2

There are 2 answers

0
Marcos Iwakawa On

The documentation for Wallet Connect is very incomplete and there is very little information on the web. Are you using React Native with Expo? Because there the implementation changes. I don't see any flaws in your code. Test your integration from this website https://example.walletconnect.org/.

0
Faisal Nawaz On

Using connect event instead of session_request on walllet connect works for me in react native.

 connector.on('connect',(error,payload)=>{
        console.log('eventtt',payload)
      // Alert.alert('Connected')
     })