This is an invalid act, because the wealth of the deceased is the right of the heirs according to Allah’s distribution, and it is not permissible to take it away from them without their permission and consent.
The Prophet’s ﷺ saying is: “The wealth of a Muslim man is not lawful except with his willing consent.”
Reference: Musnad Ahmad 113/5 صحيح الجامع, No. 7662
And this endowment (waqf) is invalid and impermissible, because it is injustice and falls under the category of consuming people’s wealth unlawfully.
Reference: اللجنة الدائمة: 20305