0

The solana tpu client (rust) takes a &Transaction argument however I deal with VersionedTransaction's.

I would like to know 2 things..

  1. How can I send a VersionedTransaction via the tpu client.
  2. How can I serialize a VersionedTransaction into base64.

I create the transactions using the solana_sdk like so

let message = V0Message::try_compile(
    &wallet.pubkey(),
    &instructions,
    &[],
    block_hash
).unwrap();

let versioned_message = VersionedMessage::V0(message);
let transaction = VersionedTransaction::try_new(versioned_message, &[wallet]).unwrap();

1 Answer 1

1

This should probably get fixed at the TPU client level, but in the meantime, you can serialize the versioned transaction and use send_wire_transaction, ie:

tpu_client.send_wire_transaction(bincode::serialize(&transaction).unwrap())
1
  • thanks jon, i figured it out earlier hehe - will mark as answer.
    – MHCH
    Commented Feb 9 at 2:19

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.