PreparedTransactionHash
Client-side implementation of Canton's "hashing scheme version 2" for interactive submissions: recomputes prepared_transaction_hash from the raw PreparedTransaction proto so a wallet never signs a hash it did not derive itself (interactive_submission_service.proto: "clients MUST recompute the hash from the raw transaction if the preparing participant is not trusted").
The byte layout follows Canton's reference implementation (com.digitalasset.canton.protocol.hash, scheme V2) and Digital Asset's TypeScript wallet SDK (@canton-network/wallet-sdk hash encoders). The full byte-level spec with citations lives in docs/prepared-tx-hash.md.
In short: SHA256(purpose ++ 0x02 ++ txHash ++ metadataHash) where purpose = int32(48) (PreparedSubmission), txHash covers the node forest as recursively hashed subtrees, and metadataHash covers the signed metadata (act_as, command id, transaction UUID, mediator group, synchronizer, time bounds, preparation time, input contracts). All integers are fixed-length big-endian; strings and byte strings are int32-length-prefixed; hashes and node seeds are raw.