def METHOD_NAME(
    self,
    txi: TxInput,
    public_keys: Sequence[bytes | memoryview],
    threshold: int,
    tx: SignTx | PrevTx,
    coin: CoinInfo,
    hash_type: int,
) -> bytes:
    import ustruct as struct
    from ..scripts import write_bip143_script_code_prefixed
    from ..writers import get_tx_hash, write_bytes_fixed
    h_preimage = HashWriter(
        blake2b(
            outlen=32,
            personal=b"ZcashSigHash" + struct.pack("<I", tx.branch_id),
        )
    )
    assert tx.version_group_id is not None
    assert tx.expiry is not None
    zero_hash = b"\x00" * TX_HASH_SIZE
    # 1. nVersion | fOverwintered
    write_uint32(h_preimage, tx.version | _OVERWINTERED)
    # 2. nVersionGroupId
    write_uint32(h_preimage, tx.version_group_id)
    # 3. hashPrevouts
    write_bytes_fixed(h_preimage, get_tx_hash(self.h_prevouts), TX_HASH_SIZE)
    # 4. hashSequence
    write_bytes_fixed(h_preimage, get_tx_hash(self.h_sequence), TX_HASH_SIZE)
    # 5. hashOutputs
    write_bytes_fixed(h_preimage, get_tx_hash(self.h_outputs), TX_HASH_SIZE)
    # 6. hashJoinSplits
    write_bytes_fixed(h_preimage, zero_hash, TX_HASH_SIZE)
    # 7. hashShieldedSpends
    write_bytes_fixed(h_preimage, zero_hash, TX_HASH_SIZE)
    # 8. hashShieldedOutputs
    write_bytes_fixed(h_preimage, zero_hash, TX_HASH_SIZE)
    # 9. nLockTime
    write_uint32(h_preimage, tx.lock_time)
    # 10. expiryHeight
    write_uint32(h_preimage, tx.expiry)
    # 11. valueBalance
    write_uint64(h_preimage, 0)
    # 12. nHashType
    write_uint32(h_preimage, hash_type)
    # 13a. outpoint
    write_bytes_reversed(h_preimage, txi.prev_hash, TX_HASH_SIZE)
    write_uint32(h_preimage, txi.prev_index)
    # 13b. scriptCode
    write_bip143_script_code_prefixed(h_preimage, txi, public_keys, threshold, coin)
    # 13c. value
    write_uint64(h_preimage, txi.amount)
    # 13d. nSequence
    write_uint32(h_preimage, txi.sequence)
    return get_tx_hash(h_preimage)