If Hamas had presented their plan to Iran, don't you think Iran would have told them, "Look this is what is going to happen, Gaza will become history, don't do it, try something smaller in scope"? Nothing Iran has done so far suggests they are irrational or unintelligent. Unless their plan involves sacrificing Gaza for a greater good, they would have dissuaded Hamas.Hamas and the Iranian government are close allies.
It is highly unlikely that Iran did not know about Hamas's plans or that Hamas could freely carry out such a large operation without Iran's consent or approval.