serialized property

  1. @override
Uint8List get serialized
override

Used for Signing the transaction

Implementation

@override
Uint8List get serialized {
  if (hasSignature == false) {
    throw Exception("Transaction is not signed, cannot serialize");
  }

  return Uint8List.fromList(
    [
      0x01,
      ...encodeRLP(
        RLPList(
          [
            RLPInt(chainId),
            RLPBigInt(nonce),
            RLPBigInt(gasPrice),
            RLPBigInt(gasLimit),
            RLPString(to),
            RLPBigInt(value),
            RLPBytes(data),
            RLPList(
              accessList.map((item) {
                return RLPList(
                  [
                    RLPString(item.address),
                    RLPList(
                      item.storageKeys
                          .map((key) => RLPString(key, isHex: true))
                          .toList(),
                    ),
                  ],
                );
              }).toList(),
            ),
            RLPInt(signatureYParity),
            RLPBytes(signatureR),
            RLPBytes(signatureS),
          ],
        ),
      )
    ],
  );
}