show subaddress 0 in ui, log subaddresses with account on backend

This commit is contained in:
2026-05-17 11:00:43 +08:00
parent 880199f096
commit b4d5304587
2 changed files with 19 additions and 8 deletions
+13
View File
@@ -194,6 +194,19 @@ export class MoneroWalletManager {
if (!this.wallet) throw new Error('Wallet RPC not started')
const accounts = await this.wallet.getAccounts(true) as any[]
console.log(`[monero] accounts: ${accounts?.length ?? 0} returned`)
if (accounts?.length) {
for (const acct of accounts) {
const subs = acct.getSubaddresses() ?? []
console.log(`[monero] account ${acct.getIndex()}: balance=${acct.getBalance()?.toString() ?? '0'} subs=${subs.length} primary=${(acct.getPrimaryAddress() ?? '').substring(0, 16)}...`)
const has0 = subs.some((s: any) => s.getIndex() === 0)
if (!has0) {
console.log(`[monero] sub 0 (primary): addr=${(acct.getPrimaryAddress() ?? '').substring(0, 16)}...`)
}
for (const sub of subs) {
console.log(`[monero] sub ${sub.getIndex()}: addr=${(sub.getAddress() ?? '').substring(0, 16)}... label=${sub.getLabel() ?? ''} balance=${sub.getBalance()?.toString() ?? '0'} used=${sub.getIsUsed()}`)
}
}
}
return accounts?.map(a => a.toJson()) ?? []
}