1

I encountered an issue while signing the transaction from the Phantom wallet. When attempting to sign the instructions.

error: There was an error making the request: TypeError: r.serialize is not a function at wc.signAndSendTransaction (inpage.js:26:35614)

const signature = await window.solana.signAndSendTransaction(
  instructions[0]
);
console.log("---> signature: ", signature);
await connection.confirmTransaction(signature);

1
  • can you provide more code? probably more context is needed to find the issue Commented Jan 5 at 14:28

1 Answer 1

4

The signAndSend of phantom expects a Transaction not an instruction. You need to create a transaction and add your instruction.

The error most likely means that phantom is trying to serialize you transaction, but you are not passing in a transaction.

See phantom docs here: https://docs.phantom.app/solana/sending-a-transaction

Also I would recommend looking into the solana wallet adapter which would support all wallets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.