I am working in a React Native dapp and I need to connect my Phantom Wallet. For that, I am using Deeplinks Phantom methods to establish a connection.
Later, I want to use the connection with Anchor
as if I was in a web project. I need to build an AnchorProvider
object with the connection
and the user Wallet
.
In desktop, we use window.solana
or new Wallet(keypair)
to build this AnchorProvider
:
import { Connection, clusterApiUrl, Keypair, ConfirmOptions } from '@solana/web3.js'
import { AnchorProvider, Wallet } from '@project-serum/anchor';
(async () => {
const connection = new Connection(clusterApiUrl('devnet'));
const keypair = new Keypair();
const options: ConfirmOptions = {
preflightCommitment: 'processed',
};
const provider = new AnchorProvider(
connection,
window.solana || new Wallet(keypair), // I need this object from deeplink
options
);
console.log('Provider', provider)
})()
Is it possible to generate a Wallet
object later to establish a connection with Deeplinks?? The deeplink provider methods don't seem to return the same data typing.
Thanks!