getId method

Uint8List? getId()

Calculate Tx id (32 bytes). @return or null.

Implementation

Uint8List? getId() {
  if (!_isSignatureValid()) {
    return null;
  }
  try {
    Uint8List h = getSigningHash(null);
    ThorSignature sig = ThorSignature.fromBytes(
        Uint8List.fromList(signature!.sublist(0, 65)));
    Uint8List pubKey = recover(h, sig);
    Uint8List addressBytes = Address.publicKeyToAddressBytes(pubKey);
    return blake2b256([h, addressBytes]);
  } catch (e) {
    return null;
  }
}