Coder Social home page Coder Social logo

Comments (8)

linear avatar linear commented on May 28, 2024

CR-15 pair() doesn't work for valid URIs in React Native / Android

from walletconnect-monorepo.

ganchoradkov avatar ganchoradkov commented on May 28, 2024

I think there is an issue with the relayer subscription of wallet connect and the event emitter is not emitting the session proposal event, It also doesnt return a status of what actually happened inside the code.

Hey @preetish-brine, could you double check that you're passing valid/unused pairing URI please. The pair method creates pairing and subscribes to the topic provided in the URI. If that topic was already subscribed by another client and proposal was consumed, you will not receive it second time.

from walletconnect-monorepo.

ganchoradkov avatar ganchoradkov commented on May 28, 2024

Additionally, please make sure that you're subscribed to receive session_proposal before you call .pair as you could be running into race conditions due to the reliance on useEffects (judging from the snippets above)

from walletconnect-monorepo.

preetish-brine avatar preetish-brine commented on May 28, 2024

I think there is an issue with the relayer subscription of wallet connect and the event emitter is not emitting the session proposal event, It also doesnt return a status of what actually happened inside the code.

Hey @preetish-brine, could you double check that you're passing valid/unused pairing URI please. The pair method creates pairing and subscribes to the topic provided in the URI. If that topic was already subscribed by another client and proposal was consumed, you will not receive it second time.

I have tried to clear caches and generate new URI schemes as well , doesnt seem to work, I am already aware of the cache issue and was facing the same while integrating deep link to sign client, used to make it run by doing clear cache and generating new URI schemes

@ganchoradkov

from walletconnect-monorepo.

preetish-brine avatar preetish-brine commented on May 28, 2024

Additionally, please make sure that you're subscribed to receive session_proposal before you call .pair as you could be running into race conditions due to the reliance on useEffects (judging from the snippets above)
@ganchoradkov
Yes my subscription logic is same as it was for the signClient

useEffect(() => {
  if (initialized) {
    console.log("INIT_WEB3", web3WalletClient);
    web3WalletClient.on('session_proposal', onSessionProposal);
    web3WalletClient.on('session_request', onSessionRequest);
    // TODOs
    web3WalletClient.on('session_ping', (data) => console.log('ping', data));
    web3WalletClient.on('session_event', (data) => console.log('event', data));
    web3WalletClient.on('session_update', (data) => console.log('update', data));
    web3WalletClient.on('session_delete', (data) => {
      // console.log('delete', data);
      // showInfoNotification('Dapps successfully disconnected!');
    });
  }
}, [initialized, onSessionProposal, onSessionRequest]);

from walletconnect-monorepo.

ganchoradkov avatar ganchoradkov commented on May 28, 2024

It seems that both useEffects

  1. that sets the event listeners
  2. the one that calls pair

are run at the same time by initialized potentially causing a race condition.
I would suggest to test the logic by having them in the same useEffect or check out our RN example wallets here https://github.com/WalletConnect/react-native-examples/tree/main/wallets

from walletconnect-monorepo.

preetish-brine avatar preetish-brine commented on May 28, 2024

It seems that both useEffects

  1. that sets the event listeners
  2. the one that calls pair

are run at the same time by initialized potentially causing a race condition. I would suggest to test the logic by having them in the same useEffect or check out our RN example wallets here https://github.com/WalletConnect/react-native-examples/tree/main/wallets

I actually tested the sign client SDK in the similar pattern and it was working in that case, i think race condition is not the actual issue,

Also i moved the pair to a callback initiated by a user button click and the behavior is same. my closest assumption of the reason of this issue is the relayer / event emitter is somehow not emitting the event

@ganchoradkov

from walletconnect-monorepo.

glitch-txs avatar glitch-txs commented on May 28, 2024

@preetish-brine could you provide a minimal reproducible example of the issue please?

from walletconnect-monorepo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.