Add Monero transaction details page and chain icons on EVM dashboard

This commit is contained in:
2026-05-24 20:24:07 +08:00
parent a91fdb6d56
commit 04179805f9
7 changed files with 226 additions and 2 deletions
+8
View File
@@ -727,6 +727,14 @@ const rpc = BrowserView.defineRPC<RPC>({
console.log('[rpc] moneroTransfer complete:', result.txHash)
return result
},
moneroGetTransferDetails: async ({ txid }) => {
console.log('[rpc] moneroGetTransferDetails:', txid)
if (!moneroManager)
throw new Error('Monero wallet RPC not started')
const details = await moneroManager.getTransferDetails(txid)
console.log('[rpc] moneroGetTransferDetails complete:', details?.hash)
return details
},
evmCreateWallet: async ({ name, phrase, passwordHash }) => {
console.log('[rpc] evmCreateWallet:', name)
const id = crypto.randomUUID()
+32
View File
@@ -305,6 +305,38 @@ export class MoneroWalletManager {
return all
}
async getTransferDetails(txid: string): Promise<any> {
if (!this.wallet) throw new Error('Wallet RPC not started')
const result = await this.rawRpc('get_transfer_by_txid', { txid })
if (!result?.transfer) return null
const t = result.transfer
const isIn = t.type === 'in'
const isOut = t.type === 'out'
const dests = t.destinations?.map((d: any) => ({
address: d.address,
amount: d.amount?.toString() ?? '0',
})) ?? []
const subaddrIndices = isIn
? [{ major: t.subaddr_index?.major ?? 0, minor: t.subaddr_index?.minor ?? 0 }]
: (t.subaddr_indices ?? []).map((s: any) => ({ major: s.major ?? 0, minor: s.minor ?? 0 }))
return {
hash: t.txid,
direction: isIn ? ('in' as const) : ('out' as const),
amount: t.amount?.toString() ?? '0',
fee: t.fee?.toString() ?? '0',
height: t.height ?? 0,
timestamp: String(t.timestamp ?? 0),
confirmations: t.confirmations ?? 0,
unlockTime: t.unlock_time ?? 0,
locked: t.locked ?? false,
doubleSpend: t.double_spend_seen ?? false,
note: t.note,
paymentId: t.payment_id ?? '',
destinations: dests,
subaddrIndices,
}
}
async getHeight(): Promise<number> {
if (!this.wallet) throw new Error('Wallet RPC not started')
const height = (await this.wallet.getHeight()) as number