monero: price fetch, fix atomicToXmr, add balance chart from tx history

This commit is contained in:
2026-06-02 21:51:40 +08:00
parent 2c792bfcf8
commit 3a44e888b2
6 changed files with 149 additions and 5 deletions
+15
View File
@@ -309,5 +309,20 @@ export function createMoneroHandlers(state: {
return null
}
},
fetchMoneroPrice: async () => {
try {
const res = await fetch(
'https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=usd',
{ signal: AbortSignal.timeout(10000) },
)
if (!res.ok) return null
const data = await res.json()
if (!data?.monero?.usd) return null
return { usd: String(data.monero.usd) }
} catch (error) {
console.log('[monero][price] error:', error)
return null
}
},
}
}