sender property

  1. @override
String get sender
override

Implementation

@override
String get sender {
  if (hasSignature == false) {
    throw Exception("Transaction is not signed, cannot recover sender");
  }

  final signature = Signature.fromBytes(
    Uint8List.fromList([
      ...signatureR,
      ...signatureS,
      signatureYParity.toInt(),
    ]),
  );

  final publicKey = recoverPublicKey(
    signingTxHash,
    signature,
    hasSignatureYParity: true,
  );

  final addressBytes = publicKeyToAddress(publicKey);

  final address = addressBytes.toHex;
  return "0x$address";
}