-1

in the mobile app I'm creating, I want a wallet-login opensea-like system that allows connecting to Metamask by opening the latter through deeplinking and showing the want-to-connect popup.

To accomplish this, I am using WalletConnect and a customized version of the WalletConnectProvider for React Native, I read the docs about deeplinking to Wallets in order to have it work, and followed the issue in this thread to modify the received URI from the modal.

The fact is that despite I've written the next code to override the open modal for WalletConnect Object, metamask opens, but no login popup shows up at all

the below snippets is what I've done so far:

// the overriden modal for WalletConnect
    const open = React.useCallback(
        async (uri, cb) => {
         // I change the uri here to comply to what's specified in
         // https://stackoverflow.com/questions/71162767/connecting-to-metamask-using-react-native-deeplink-with-walletconnect
          const forAndroid = `${walletService}://wc?uri=${uri.replace(/(?<=https)%3A%2F%2F.\./, '://')}`;
          const canOpenURL = await Linking.canOpenURL(finalUri);
          if (!canOpenURL) {
            // Here it just opens the play store if walletconnect not found
            Linking.openURL(DEVICES[Platform.OS].appLink);
          } else {
            await Linking.openURL(forAndroid);
            setState({
              uri: finalUri,
              visible: true,
              cb,
            });
          }
        },
        [walletService],
      );

      const qrcodeModal = React.useMemo(
       () => ({
         open,
         close,
       }),
       [open, close],
      );

      const nextConnector = new WalletConnect({
        session: isResumable ? maybeExistingSession : undefined,
        qrcodeModal,
        ...rest,
      });

but if forAndroid is replaced by url in openURL function, a popup to choose a Wallet is shown as follows:

enter image description here

then selecting metemask and a pop up to login to the app is shown, but this is not the flow I want for my app.

I'll be thankful if someone could help me understand why memask is not processing properly the URI and doesn't allow authentication.

4

0 回答 0