Just like it's done with $DISPLAY, but $WAYLAND_DISPLAY is a bit more tricky because if XDG_RUNTIME_DIR is unset it should be an absolute path. Alternatively the script could maintain XDG_RUNTIME_DIR and WAYLAND_DISPLAY as is. Although keep XDG_RUNTIME_DIR might be a bad idea.
Documentation: https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__display_1af048371dfef7577bd39a3c04b78d0374