serialize method
Serialize the signed transaction for broadcast.
Legacy: plain RLP. Typed: typeId || rlp(fields ++ sig).
Implementation
Uint8List serialize() {
if (v == null || r == null || s == null) {
throw StateError('Transaction must be signed before serializing');
}
switch (kind) {
case EnvelopeKind.legacy:
return _legacySigned();
case EnvelopeKind.eip2930:
return _typedSigned(0x01, _eip2930Fields());
case EnvelopeKind.eip1559:
return _typedSigned(0x02, _eip1559Fields());
case EnvelopeKind.eip4844:
return _typedSigned(0x03, _eip4844Fields());
case EnvelopeKind.eip7702:
return _typedSigned(0x04, _eip7702Fields());
}
}