OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet commits / 608d498

Link Ethereum and USDT addresses (they share the same address space)
USDT is an ERC-20 token on Ethereum, so Ethereum and USDT addresses are identical. The wallet was storing them separately, causing confusion. Changes: 1. getCurrentAddress() - Falls back to ethereum addresses for ethereum-usdt 2. getAddresses() - When querying ethereum, also returns ethereum-usdt addresses This ensures: - Deriving a USDT address shows up in the Ethereum wallet list - Both ETH and USDT operations use the same current address - No duplication or confusion about "which address am I using" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
608d4987e2c1567c3ace52dc7258864f9e17ea04
by plankatron <fleeky@gmail.com> · 2026-01-29T17:31:41.000Z

Changed files (1) +24 -1

lib/wallet-storage.cjs +24 -1
……@@ -401,6 +401,21 @@ async function getAddresses(chain) {
401401 }
402402 }
403403
404 // For Ethereum, also include ERC-20 token addresses (they share the same address space)
405 // When querying 'testnet-ethereum', also return 'testnet-ethereum-usdt' addresses
406 if (!chain.includes('all') && (chain.includes('ethereum') && !chain.includes('-usdt'))) {
407 const tokenPrefix = `${prefix}usdt:`
408 for await (const entry of txHistoryDb.createReadStream()) {
409 if (entry.key.startsWith(tokenPrefix)) {
410 const addr = JSON.parse(entry.value)
411 // Check if we already have this index (don't duplicate)
412 if (!addresses.find(a => a.index === addr.index)) {
413 addresses.push(addr)
414 }
415 }
416 }
417 }
418
404419 return addresses.sort((a, b) => a.index - b.index)
405420}
406421
……@@ -421,7 +436,15 @@ async function getNextAddressIndex(chain) {
421436 * @returns {Object|null} - Latest address or null if none exist
422437 */
423438async function getCurrentAddress(chain) {
424 const addresses = await getAddresses(chain)
439 let addresses = await getAddresses(chain)
440
441 // For ERC-20 tokens (like USDT), fall back to base Ethereum addresses
442 // since they share the same address space
443 if (addresses.length === 0 && chain.includes('-usdt')) {
444 const baseChain = chain.replace('-usdt', '')
445 addresses = await getAddresses(baseChain)
446 }
447
425448 if (addresses.length === 0) return null
426449
427450 // Find address marked as current, or return latest