Snap or snapd (the daemon that installs and manages snaps)?
If the latter, I suggest trying this:
git clone https://github.com/snapcore/snapd/
cd snapd
git checkout 2.40
sudo dnf builddep packaging/fedora/snapd.spec -y
rpmbuild -bb --build-in-place packaging/fedora/snapd.spec
and let us know if it works for you.