bs58.decode(
"2YQDdnfxiHPKu9GypLX1yXaQTQojvDSPgFkDxrU********************************************"
)
const mintPubkey =
"A8SJfwzKJAaMrY6Lb*************************";
const getProvider = async () => {
// opens wallet to connect to
await window.solana.connect();
const provider = window.solana;
}
const network = "https://api.devnet.solana.com";
const connection = new Connection(network);
var provider = await getProvider()
console.log(provider.publicKey.toString())
const userWalletPublicKey = provider.publicKey;
var myMint = new PublicKey(mintPubkey);
var myToken = new Token(
connection,
myMint,
TOKEN_PROGRAM_ID,
alice
);
const fromTokenAccount = await myToken.getOrCreateAssociatedAccountInfo(
alice.publicKey,
);
const toTokenAccount = await myToken.getOrCreateAssociatedAccountInfo(
userWalletPublicKey,
);
// Add token transfer instructions to transaction
const transaction = new Transaction().add(
Token.createTransferInstruction(
TOKEN_PROGRAM_ID,
fromTokenAccount.address,
toTokenAccount.address,
alice.publicKey,
[],
1,
),
);
transaction.recentBlockhash = (await connection.getRecentBlockhash()).blockhash;
transaction.feePayer = userWalletPublicKey;
const signedTransaction = await window.solana.signTransaction(transaction);
const signature = await connection.sendRawTransaction(signedTransaction.serialize());
when I try to approve the transection it gives me signature verification failed I am using SPL-TOKEN Library and Solana web3 js did I implement the spl-transfer token with phantom correctly?
Your help on this will be much appreciated
basically i am trying to make when a user click on buy it transfer the nft present in my wallet to the guy's wallet who connected and clicked on buy