Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phantom does not send back response after select connect #20

Open
baileyalo opened this issue Oct 31, 2022 · 5 comments
Open

Phantom does not send back response after select connect #20

baileyalo opened this issue Oct 31, 2022 · 5 comments

Comments

@baileyalo
Copy link

code snipet 👍
useEffect(() => {
const initializeDeeplinks = async () => {
const initialUrl = await Linking.getInitialURL();
if (initialUrl) {
setDeepLink(initialUrl);
}
};
initializeDeeplinks();
const listener = Linking.addEventListener('url', handleDeepLink);
return () => {
listener.remove();
};
}, []);

const handleDeepLink = ({url}: Linking.EventType) => setDeepLink(url);

// Handle in-bound links
useEffect(() => {
if (!deepLink) {
return;
}

const url = new URL(deepLink);
const params = url.searchParams;

// Handle an error response from Phantom
if (params.get('errorCode')) {
  const error = Object.fromEntries([...params]);
  const message =
    error?.errorMessage ??
    JSON.stringify(Object.fromEntries([...params]), null, 2);
  console.log('error: ', message);
  return;
}

// Handle a `connect` response from Phantom
if (/onConnect/.test(url.pathname)) {
  const sharedSecretDapp = nacl.box.before(
    bs58.decode(params.get('phantom_encryption_public_key')!),
    dappKeyPair.secretKey,
  );
  const connectData = decryptPayload(
    params.get('data')!,
    params.get('nonce')!,
    sharedSecretDapp,
  );
  setSharedSecret(sharedSecretDapp);
  setSession(connectData.session);
  setPhantomWalletPublicKey(new PublicKey(connectData.public_key));
  console.log(`connected to ${connectData.public_key.toString()}`);
}
@Timadigwe
Copy link

Same here , when i click the connect button it doesnt redirect back to the app nor return a response

@faisal-dropchain
Copy link

@Timadigwe how did you fix this issue?

@Timadigwe
Copy link

It didn't work for me
I used Solana mobile stack

@Timadigwe
Copy link

Use Solana mobile stack or expo flow
It works on expo

@faisal-dropchain
Copy link

mmh but solana mobile stack uses Mobile Wallet Adapter(MWA) and that doesnt work with IOS!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants