For context, this question is in the context of a typescript browser client.
How can I construct a VersionedTransaction
from an input of raw bytes of a transaction?
With legacy Transaction
, I can just use Transaction.from(rawBytes)
, but for a VersionedTransaction
, the only option is to create it through a VersionedMessage
.
I'm guessing what I need to do is something like example below, where I extract the message component from the transaction bytes.
Example:
const txBytes: Uint8Array = getBytes();
const versionedMessage = VersionedMessage.deserialize(
transactionBytes.slice(<message_bytes_start>, <message_bytes_end>)
);
const versionedTx = new VersionedTransaction(versionedMessage);
The issue is I can't find a definitive source of what message_bytes_start
and message_bytes_end
is. Interested if there's an easier way to do this. Thanks!