getEncodedTransaction method

Uint8List getEncodedTransaction()

Get the encoded representation of the transaction with a prefix suitable for signing.

Implementation

Uint8List getEncodedTransaction() {
  // Encode transaction as msgpack
  final encodedTx = Encoder.encodeMessagePack(toMessagePack());

  // Prepend the transaction prefix
  final txBytes = utf8.encode(TX_PREFIX);

  // Merge the byte arrays
  return Uint8List.fromList([...txBytes, ...encodedTx]);
}