Skip to content

Latest commit

 

History

History
187 lines (149 loc) · 5.44 KB

File metadata and controls

187 lines (149 loc) · 5.44 KB

Bubble Map Fixes

Issues Fixed

Issue 1: Default View ✅ FIXED

Problem: List view was the default Fix: Changed default to bubble map view

// Before
const [viewMode, setViewMode] = useState<'list' | 'map'>('list');

// After
const [viewMode, setViewMode] = useState<'list' | 'map'>('map'); // Default to bubble map

Issue 2: Wallet Labels Not Showing ✅ FIXED

Problem: Custom wallet labels weren't displayed in bubble map Fix: Added lookup from storage and prioritized labels

// Get label from storage or use provided label
const walletLabel = storageUtils.getWalletLabel(node.address) || node.label;

// Display label prominently
<div className="font-bold text-sm">{walletLabel || shortAddr}</div>
{walletLabel && <div className="text-xs text-gray-400 mt-1">{shortAddr}</div>}

Now shows:

  • If you labeled a wallet: Shows the label (bold) + address (small)
  • If no label: Shows shortened address

Issue 3: Arrow Direction Wrong ✅ FIXED

Problem: Arrows pointed from seller to origin (backwards) Fix: Reversed arrow direction to show token flow from origin to seller

// Before (wrong)
source: currentId,  // Seller
target: parentId,   // Origin
// Arrow: Seller → Origin (backwards!)

// After (correct)
source: parentId,   // Origin
target: currentId,  // Seller
// Arrow: Origin → Seller (correct!)

Now shows correct flow:

DEX Pool → Intermediate Wallet → Seller
(Origin)                         (Current)

Issue 4: View TX Link Missing ✅ FIXED

Problem: No way to view transaction on block explorer from bubble map Fix: Added "View TX" link to each bubble

<a
  href={`https://basescan.org/tx/${node.transaction}`}
  target="_blank"
  rel="noopener noreferrer"
  className="text-xs text-blue-400 hover:text-blue-300 mt-1 inline-flex items-center gap-1"
  onClick={(e) => e.stopPropagation()}
>
  View TX <ExternalLink size={10} />
</a>

Features:

  • Opens in new tab
  • Stops event propagation (doesn't interfere with node dragging)
  • Styled to match the UI
  • Shows external link icon

Visual Improvements

Before

[Bubble]
0x1234...5678
100 tokens

After

[Bubble]
My Wallet Label          ← Custom label (if set)
0x1234...5678           ← Address (smaller)
100 tokens
🔵 DEX Pool             ← Origin type (if origin)
View TX 🔗              ← Link to block explorer

Complete Feature Set

The bubble map now has:

  1. Default view - Opens automatically
  2. Custom labels - Shows your wallet labels
  3. Correct arrows - Origin → Seller direction
  4. View TX links - Direct links to Basescan
  5. Interactive - Drag, zoom, pan
  6. Color-coded - Different colors for origin types
  7. Bubble sizes - Based on token amounts
  8. Legend - Explains colors and controls
  9. MiniMap - Overview of entire trace

Usage

  1. Add wallet labels (optional):

    • Click "Wallet Labels" button
    • Add labels for addresses you want to track
    • Labels will appear in bubble map
  2. Analyze transaction:

    • Enter transaction hash and token address
    • Click "Start Analysis"
    • Bubble map opens automatically
  3. Interact with map:

    • Drag - Pan around the map
    • Scroll - Zoom in/out
    • Click bubble - Select node
    • Click "View TX" - Open in Basescan
    • Use controls - Zoom buttons, fit view
  4. Switch views:

    • Click "List View" for traditional expandable list
    • Click "Bubble Map" to return to visualization

Example Flow

Transaction Analysis:
User sells 1000 tokens

Bubble Map Shows:
┌─────────────────────────────────────────────────────────┐
│                                                           │
│  [🔵 DEX Pool]  →  [Intermediate]  →  [My Wallet]       │
│   Origin            Wallet              Seller           │
│   1000 tokens       1000 tokens         1000 tokens      │
│   View TX 🔗        View TX 🔗          View TX 🔗       │
│                                                           │
└─────────────────────────────────────────────────────────┘

Arrow Direction: Origin → Intermediate → Seller
(Shows where tokens came from)

Benefits

  1. Visual clarity - See entire token flow at a glance
  2. Custom labels - Identify important wallets easily
  3. Correct flow - Arrows show true token movement
  4. Quick access - View any transaction with one click
  5. Professional - Looks like a real blockchain explorer

Technical Details

Label Priority

  1. Custom label from storage (highest priority)
  2. Label from trace node
  3. Shortened address (fallback)

Arrow Logic

  • Source: Where tokens came from (origin/parent)
  • Target: Where tokens went to (current wallet)
  • Direction: Always origin → seller

Link Generation

  • Uses Basescan for Base network
  • Transaction hash from trace node
  • Opens in new tab
  • Prevents event bubbling

Conclusion

The bubble map is now a fully-featured, professional visualization tool that:

  • Shows correct token flow
  • Displays custom labels
  • Provides direct blockchain explorer access
  • Works as the default view

Perfect for analyzing token origins visually!