I'm trying to create a transaction then use phantom provider to let the user sign and send the transaction. this is how my transaction is constructed:
if (method === 'sol'){
const amount = sol_dict[req.body.rank];
const lamports = amount * (1000000000);
const transaction_inst = SystemProgram.transfer({
fromPubkey: from_pk,
toPubkey: to_pk,
lamports: lamports,
});
const transaction = new Transaction().add(transaction_inst);
const hash = await connection.getLatestBlockhashAndContext()
transaction.recentBlockhash = hash.value.blockhash;
transaction.lastValidBlockHeight = hash.value.lastValidBlockHeight;
transaction.feePayer = from_pk;
const fee = await transaction.getEstimatedFee(connection);
//console.log(transaction.serialize());
res.json(transaction);
}
I'm getting this error:
when I try to use window.solana.signAndSendTransaction(data);
from the response.json() .
adding and removing parameters serializing data