Phantom Redirect
Introduction
This guide will help you use the Phantom redirect-based connect feature on mobile. Instead of deeplinking into the Phantom in-app browser, your users can enjoy a redirect-based connection, where they are automatically redirected between the app and their wallet to faciliate the connect, sign and additional method calls.
Tutorial
mobileExperience
prop
Make sure you set mobileExperience
to redirect
on your DynamicContextProvider:
With just this code, your users will connect with the redirect-based approach. If you want to learn how to make method calls (like signAndSendTransaction
) and access the result, read on
Signer methods
The redirect-based approach makes it a little trickier to access the result, and soon we will offer an easy-to-use hook to do so. For now, you will need this code in your app:
You can render this hook in your app, and call execute
on a button you render. This will trigger a redirect to the user’s wallet for signing, and if they accept the transaction, they will be redirected back to your app. Upon your app re-loading, this hook should be rendered again, and it’s state values will be populated – in this case the signature
will contain the signature of the transcation.
Was this page helpful?