OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet-desktop commits / d6bf297

Add auto-sync after send and improve transaction sync logging
Changes: 1. Auto-sync transactions from blockchain after sending (2 second delay) 2. Fix network detection in sync endpoint (was hardcoded to testnet) 3. Add debug logging to trace sync process This should make transactions appear immediately after sending without requiring manual sync button click. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
d6bf297e737976e888a772533b17f7b42e2065a5
by plankatron <fleeky@gmail.com> · 2026-01-29T17:36:18.000Z

Changed files (2) +26 -4

desktop/wallet.js +17 -3
……@@ -2929,11 +2929,25 @@ async function executeSend() {
29292929 // console.log('Notification failed (non-critical):', notifErr.message)
29302930 // }
29312931
2932 // Refresh balances and transactions
2933 setTimeout(() => {
2932 // Sync transaction from blockchain, then refresh balances and display
2933 setTimeout(async () => {
2934 // First sync from blockchain to fetch the new transaction
2935 try {
2936 const syncRes = await authFetch(`/api/transactions/sync`, {
2937 method: 'POST',
2938 headers: { 'Content-Type': 'application/json' },
2939 body: JSON.stringify({ chain: currentSendChain })
2940 })
2941 const syncData = await syncRes.json()
2942 console.log('Auto-sync after send:', syncData)
2943 } catch (syncErr) {
2944 console.warn('Auto-sync failed (non-critical):', syncErr.message)
2945 }
2946
2947 // Then refresh UI
29342948 loadCurrentBalance()
29352949 loadTransactions()
2936 }, 1000)
2950 }, 2000) // Wait 2 seconds for transaction to propagate
29372951
29382952 } catch (err) {
29392953 console.error('Send error:', err)
wallet-server.cjs +9 -1
……@@ -765,12 +765,20 @@ const routes = {
765765 const { wdk } = await initializeWDK(walletMnemonic, { testnet: true })
766766
767767 // Sync transactions
768 // Extract network from chain (testnet-ethereum-usdt -> testnet)
769 const networkMatch = chain.match(/^(testnet|mainnet)-/)
770 const network = networkMatch ? networkMatch[1] : 'testnet'
768771 const chainName = chain.replace(/^(testnet|mainnet)-/, '')
772
773 console.log(`[SYNC] Syncing chain: ${chain} -> ${chainName}, network: ${network}`)
774
769775 const result = await syncTransactionsFromWDK(wdk, {
770776 chains: [chainName],
771 network: 'testnet'
777 network: network
772778 })
773779
780 console.log(`[SYNC] Result: synced=${result.synced}, errors=${result.errors.length}`)
781
774782 sendJSON(res, {
775783 success: true,
776784 message: `Synced ${result.synced} new transactions`,