Enzyme that can either act as an ADP-sugar pyrophosphatase in absence of diphosphate or catalyze the synthesis of ATP in presence of diphosphate (PubMed:27257257). In absence of diphosphate, hydrolyzes with similar activities various modified nucleoside diphosphates such as ADP-ribose, ADP-mannose, ADP-glucose, 8-oxo-GDP and 8-oxo-dGDP (PubMed:10567213, PubMed:10722730, PubMed:17052728, PubMed:19699693, PubMed:21389046). Can also hydrolyze other nucleotide sugars with low activity (PubMed:19699693, PubMed:21389046). In presence of diphosphate, mediates the synthesis of ATP in the nucleus by catalyzing the conversion of ADP-ribose to ATP and ribose 5-phosphate. Nuclear ATP synthesis takes place when dephosphorylated at Thr-45 (PubMed:27257257). Nuclear ATP generation is required for extensive chromatin remodeling events that are energy-consuming (PubMed:27257257). Does not play a role in U8 snoRNA decapping activity (By similarity). Binds U8 snoRNA (By similarity).