0

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:

enter image description here

when I try to use window.solana.signAndSendTransaction(data); from the response.json() .

adding and removing parameters serializing data

  • See https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors and please edit your question to include the error as text – Mikko Ohtamaa Feb 17 '23 at 20:42

0 Answers0