encodeToBytes method

Uint8List encodeToBytes()
override

Encode this operation into raw bytes

Implementation

Uint8List encodeToBytes() {
  Uint8List signer = AccountNumberCoder().encodeToBytes(this.signer);
  Uint8List target = AccountNumberCoder().encodeToBytes(this.target);
  Uint8List nOperation = Int32.encodeToBytes(this.nOperation!);
  Uint8List fee = CurrencyCoder().encodeToBytes(this.fee!);
  Uint8List payloadLength = PDUtil.encodeLength(this.payload!.length);
  Uint8List? payload = this.payload;
  // Not used in modern pascal coin?
  Uint8List v2publickey = PublicKeyCoder().encodeToBytes(PublicKey.empty());
  Uint8List newPublicKey = PublicKeyCoder().encodeToBytes(this.newPublicKey);
  Uint8List newPublicKeyLength = PDUtil.encodeLength(newPublicKey.length);
  Uint8List r = PDUtil.encodeBigInt(signature!.r);
  Uint8List rLength = PDUtil.encodeLength(r.length);
  Uint8List s = PDUtil.encodeBigInt(signature!.s);
  Uint8List sLength = PDUtil.encodeLength(s.length);
  return PDUtil.concat([
    signer,
    target,
    nOperation,
    fee,
    payloadLength,
    payload,
    v2publickey,
    newPublicKeyLength,
    newPublicKey,
    rLength,
    r,
    sLength,
    s
  ]);
}