I have issue with transferring NFT or token from wallet to wallet with @solana/wallet-adapter-react or directly window.solana, I keep getting Signature verification failed
error with code -32003
in Phantom, Slope etc wallet.
I use sendTransaction
function from useWallet
hook and it worked couple weeks ago without problems same code, now it fails every time and I haven't changed anything, so my question is what has changed in solana logic and sending token and if someone can provide some working code. This transaction has 2 simple instructions, first creates token in destination wallet, and second one does token transfer.
Here is instructions code
const mintPublicKey = new PublicKey(mint);
// GET SOURCE ASSOCIATED ACCOUNT
const associatedSourceTokenAddr: PublicKey = await getAssociatedTokenAddress(
mintPublicKey,
ownerKey
);
// GET DESTINATION ASSOCIATED ACCOUNT
const associatedDestinationTokenAddr: PublicKey = await getAssociatedTokenAddress(
mintPublicKey,
destinationKey
);
console.info('Destination account', associatedDestinationTokenAddr.toBase58())
const receiverAccount = await connection.getAccountInfo(
associatedDestinationTokenAddr
);
if (receiverAccount === null) {
console.log("Receiver account is null!");
instructions.push(
createAssociatedTokenAccountInstruction(
destinationKey,
associatedDestinationTokenAddr,
destinationKey,
mintPublicKey
)
);
}
instructions.push(
createTransferCheckedInstruction(
associatedSourceTokenAddr,
mintPublicKey,
associatedDestinationTokenAddr,
ownerKey,
1,
0
)
);
return instructions;
This is transaction creation logic
for (const mint of mints) {
const mintTransferInstructions = await getInstructions(mint);
instructions.push(...mintTransferInstructions);
}
// This transaction is sending the tokens
let transaction = new Transaction();
for (let i = 0; i < instructions.length; i++) {
transaction.add(instructions[i]);
}
return transaction;
If someone has some input about problem, also Phantom transaction preview shows correctly token that I want to transfer in transaction preview, so don't think issue is with instruction or transaction creation. What does this error mean? I don't use Keypair anywhere in logic to add it to signers array in sendTransaction