OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet commits / e3720d7

Fix transaction sync to use current address index from storage
Transaction sync was hardcoded to use account index 0, so USDT transactions at other indices (like index 2) weren't showing up. Changes: 1. Get current address index from storage before creating WDK account 2. Handle ethereum-usdt by checking storage and falling back to ethereum 3. Use baseChain for WDK operations (ethereum, not ethereum-usdt) 4. Update condition to sync both ethereum and ethereum-usdt transactions This ensures transactions are fetched for the correct wallet address that's actually being used, not always index 0. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
e3720d7b950af63908b943c9dcc1d9fb3b57268c
by plankatron <fleeky@gmail.com> · 2026-01-29T17:29:45.000Z

Changed files (1) +18 -5

lib/wallet-storage.cjs +18 -5
……@@ -822,8 +822,20 @@ async function syncTransactionsFromWDK(wdk, config = {}) {
822822
823823 for (const chain of chains) {
824824 try {
825 // Get WDK account for this chain
826 const account = await wdk.getAccount(chain, 0)
825 // Determine base chain for WDK (ethereum-usdt -> ethereum)
826 const baseChain = chain.replace(/-usdt$/, '')
827
828 // Get current address index from storage
829 // For USDT, check both ethereum-usdt and ethereum (they share addresses)
830 let currentAddr = await getCurrentAddress(`${config.network ? config.network + '-' : ''}${chain}`)
831 if (!currentAddr && chain.includes('usdt')) {
832 // Try base chain if token chain not found
833 currentAddr = await getCurrentAddress(`${config.network ? config.network + '-' : ''}${baseChain}`)
834 }
835 const accountIndex = currentAddr ? currentAddr.index : 0
836
837 // Get WDK account for this chain at the correct index
838 const account = await wdk.getAccount(baseChain, accountIndex)
827839 if (!account) {
828840 results.errors.push(`No account found for chain: ${chain}`)
829841 continue
……@@ -884,14 +896,15 @@ async function syncTransactionsFromWDK(wdk, config = {}) {
884896 chainSynced++
885897 results.synced++
886898 }
887 } else if (chain === 'ethereum') {
888 // Ethereum: Fetch transactions from blockchain provider
899 } else if (baseChain === 'ethereum') {
900 // Ethereum (including USDT): Fetch transactions from blockchain provider
889901 try {
890902 const config = getConfig()
891903 const network = config.network || 'testnet'
892904
893905 // Fetch transactions using blockchain-providers.cjs
894 const providerTxs = await fetchTransactions(chain, currentAddress, network, config)
906 // Use base chain for provider (ethereum, not ethereum-usdt)
907 const providerTxs = await fetchTransactions(baseChain, currentAddress, network, config)
895908
896909 for (const tx of providerTxs) {
897910 // Check if already stored