OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet commits / 820a347

Fix transaction history filtering and send-to-contact bug
Fixed two critical bugs: 1. Transaction history now follows selected wallet address - Modified loadTransactions() to fetch current address via API - Filters transactions to only show those involving the selected address - Transactions reload when wallet address changes in dropdown - Users can now have multiple addresses per chain with separate histories 2. Fixed "address not found" error when sending to contact - sendToContact() was passing chain name instead of address ID - Now correctly passes contact.addresses[0].id to sendToContactAddress() - Handles both new format (addresses array) and old format (single address) Files changed: - ui/app.js: Transaction filtering by address, fixed sendToContact() Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
820a347f047d0682f146f61f3e2d6e7f0c2908cc
by plankatron <fleeky@gmail.com> · 2026-01-28T00:24:22.000Z

Changed files (1) +35 -13

ui/app.js +35 -13
……@@ -1299,19 +1299,22 @@ async function sendToContact(contactId) {
12991299 return
13001300 }
13011301
1302 // Get first available address
1303 let chain = null
1302 // Get first available address ID
1303 let addressId = null
13041304 if (contact.addresses && Array.isArray(contact.addresses) && contact.addresses.length > 0) {
1305 chain = contact.addresses[0].chain
1306 } else if (contact.chain) {
1307 chain = contact.chain
1305 addressId = contact.addresses[0].id
13081306 } else {
1307 // Old format: no ID, pass null and let sendToContactAddress handle it
1308 addressId = null
1309 }
1310
1311 if (!addressId && !contact.address) {
13091312 showError('Contact has no addresses')
13101313 return
13111314 }
13121315
1313 // Use the chain-specific function
1314 await sendToContactAddress(contactId, chain)
1316 // Use the address-specific function
1317 await sendToContactAddress(contactId, addressId)
13151318}
13161319
13171320function escapeHtml(text) {
……@@ -1608,9 +1611,10 @@ async function onWalletAddressChange() {
16081611
16091612 showSuccess('Wallet address changed!')
16101613
1611 // Reload balance and QR code
1614 // Reload balance, QR code, and transactions
16121615 await loadCurrentBalance()
16131616 await loadCurrentQRCode()
1617 await loadTransactions()
16141618
16151619 // Reload the selector to update the star marker
16161620 await loadWalletAddressSelector()
……@@ -1885,14 +1889,16 @@ async function loadTransactions() {
18851889 list.innerHTML = '<div class="spinner"></div>'
18861890
18871891 try {
1888 // Load transactions and contacts in parallel
1889 const [txRes, contactsRes] = await Promise.all([
1892 // Load transactions, contacts, and current address in parallel
1893 const [txRes, contactsRes, currentAddrRes] = await Promise.all([
18901894 authFetch(`${API_BASE}/transactions/all`),
1891 authFetch(`${API_BASE}/contacts`)
1895 authFetch(`${API_BASE}/contacts`),
1896 authFetch(`${API_BASE}/address/${selectedNetwork}-${selectedCurrency}`)
18921897 ])
18931898
18941899 const data = await txRes.json()
18951900 const contactsData = await contactsRes.json()
1901 const currentAddrData = await currentAddrRes.json()
18961902
18971903 if (data.error) {
18981904 list.innerHTML = '<div class="empty-state">Error loading transactions</div>'
……@@ -1904,6 +1910,9 @@ async function loadTransactions() {
19041910 return
19051911 }
19061912
1913 // Get the currently selected address
1914 const currentAddress = currentAddrData.address ? currentAddrData.address.toLowerCase() : null
1915
19071916 // Build address-to-contact lookup
19081917 const contacts = contactsData.contacts || []
19091918 const addressToContact = {}
……@@ -1920,9 +1929,22 @@ async function loadTransactions() {
19201929 }
19211930 }
19221931
1923 // Filter by selected network AND selected currency
1932 // Filter by selected network, selected currency, AND current wallet address
19241933 const filtered = data.transactions.filter(tx => {
1925 return tx.network === selectedNetwork && tx.chain === selectedCurrency
1934 // Must match network and chain
1935 if (tx.network !== selectedNetwork || tx.chain !== selectedCurrency) {
1936 return false
1937 }
1938
1939 // Must involve the currently selected address (either as sender or receiver)
1940 if (currentAddress) {
1941 const fromAddr = tx.from.toLowerCase()
1942 const toAddr = tx.to.toLowerCase()
1943 return fromAddr === currentAddress || toAddr === currentAddress
1944 }
1945
1946 // If no current address, show all for this chain (fallback)
1947 return true
19261948 })
19271949
19281950 if (filtered.length === 0) {