encode method

Uint8List encode(
  1. SignedData signedData
)

Encode a signed extrinsic ready for submission

Returns the complete extrinsic bytes including:

  • Compact length prefix
  • Version byte (0x84 for signed v4)
  • Signer address (MultiAddress)
  • Signature (MultiSignature)
  • Extension values
  • Call data

Implementation

Uint8List encode(SignedData signedData) {
  // First encode the extrinsic without length prefix
  final extrinsicBytes = _encodeExtrinsicWithoutPrefix(signedData);

  // Add compact length prefix
  final output = ByteOutput();
  CompactCodec.codec.encodeTo(extrinsicBytes.length, output);
  output.write(extrinsicBytes);

  return output.toBytes();
}