This is an interesting read.
http/www.madsci.org/posts/archives/dec96...55291.Zo.r.html
http/www.madsci.org/posts/archives/dec96...55291.Zo.r.html
They also take in water, salts, minerals and trace elements via osmoregulation and excrete the excess water in their urine. That's where some of the ammonia comes.