0

I am following the official Solana Mobile Stack docs to connect my react native dapp to phantom wallet on my real device. But whenever I try to connect, the phantom wallet opens and shows unkown network, even when both phantom wallet and the app are both on devnet. Please help.

This is the connect wallet function:

async function connectWallet() {
const APP_IDENTITY = {
  name: 'React Native dApp',
  uri: 'https://solanamobile.com',
  icon: 'favicon.ico',
};

try {
  const authorizationResult = await transact(
    async (wallet: typeof Web3MobileWallet) => {
      console.log('wallet is : ', wallet._h);

      const authorizationResult = await wallet.authorize({
        cluster: 'devnet',
        identity: APP_IDENTITY,
      });

      /* After approval, signing requests are available in the session. */

      console.log(
        'Connected to: ' + authorizationResult.accounts[0].address,
      );

      return authorizationResult;
    },
  );

  console.log('Connected to: ' + authorizationResult.accounts[0].address);
} catch (error) {
  console.log(error);
}

}

And I am simply calling this function through a button:

<SafeAreaView>
  <Text> this is some text</Text>
  <Button title="Connect Wallet" onPress={connectWallet} />
</SafeAreaView>

1 Answer 1

0

there is a pretty good tutorial from Phantom about that: https://phantom.app/learn/blog/the-complete-guide-to-phantom-deeplinks

Hope that helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.