serializeTransaction static method

List<int> serializeTransaction(
  1. VersionedMessage message,
  2. List<List<int>> signatures
)

serialize transaction to bytes

Implementation

static List<int> serializeTransaction(
    VersionedMessage message, List<List<int>> signatures) {
  final serializedMessage = message.serialize();
  final encodedSignaturesLength =
      SolanaTransactionUtils._encodeLength(signatures.length);

  final transactionLayout = LayoutConst.struct([
    LayoutConst.blob(encodedSignaturesLength.length,
        property: 'encodedSignaturesLength'),
    LayoutConst.array(
        LayoutConst.blob(64, property: "signature"), signatures.length,
        property: 'signatures'),
    LayoutConst.blob(serializedMessage.length, property: 'serializedMessage')
  ]);
  return transactionLayout.serialize({
    'encodedSignaturesLength': encodedSignaturesLength,
    'signatures': signatures,
    'serializedMessage': serializedMessage
  });
}