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:12717453, PubMed:19699693, PubMed:21389046, PubMed:38635563). Can also hydrolyze other nucleotide sugars with low activity (PubMed:12717453, 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). In vitro, it has decapping activity on 11-mer RNA capped with uridine diphosphate N- acetylglucosamine (UDP-GlcNAc) by hydrolyzing the pyrophosphate bridge of the sugar cap (PubMed:38716860). Does not play a role in U8 snoRNA decapping (By similarity). Binds U8 snoRNA (By similarity). {ECO:0000250|UniProtKB:Q9JKX6, ECO:0000269|PubMed:10567213, ECO:0000269|PubMed:10722730, ECO:0000269|PubMed:12717453, ECO:0000269|PubMed:17052728, ECO:0000269|PubMed:19699693, ECO:0000269|PubMed:21389046, ECO:0000269|PubMed:27257257, ECO:0000269|PubMed:38635563, ECO:0000269|PubMed:38716860}. This is the function of NUDT5 (nudix hydrolase 5, Ensembl gene identifier ENSG00000165609).