Conversation so far:
Who is the story based on?
Wenceslas' death, four biographies of him were in circulation.
These hagiographies had a powerful influence on the High Middle Ages conceptualization of the rex iustus, or "righteous king.
When was the legend created?
CANNOTANSWER.

Question: What did the righteous king do?
Self-contained rewrite: What did the righteous king  Wenceslas do?