3.4 KiB
3.4 KiB
Frontend Pages That Need Updating
โ ALREADY UPDATED
ui/views/explorer/pages/explorer-home-page-view.js- Uses new componentsui/views/explorer/ledger/latest-ledgers-table.js- NEW, uses Horizonui/views/explorer/transaction/latest-transactions-table.js- NEW, uses Horizonui/views/explorer/asset/asset-list-view.js- Updated to useasset/horizon/listui/views/graph/use-stellar-stream.js- Updated to use SSE
๐ง NEEDS MINIMAL CHANGES
Account Pages
These already use the existing account API which now fetches from Horizon:
ui/views/explorer/account/account-view.js- Should work (uses/account/:id)ui/views/explorer/account/account-history-tabs-view.js- Should work
Transaction Pages
ui/views/explorer/tx/tx-view.js- Should work (uses/tx/:hash)
Asset Pages
ui/views/explorer/asset/asset-view.js- Should work (uses/asset/:asset)ui/views/explorer/asset/assets-dashboard-view.js- Uses asset-list-view (updated)
Market Pages
ui/views/explorer/market/market-view.js- Should work (uses existing market API)ui/views/explorer/market/all-markets-view.js- Should work
Ledger Pages
ui/views/explorer/ledger/ledger-view.js- Should work (uses/ledger/:sequence)
๐ฏ WHY MOST PAGES SHOULD WORK
The existing pages use API paths like:
/account/:idโ Now fetches from Horizon via our adapter/tx/:hashโ Now fetches from Horizon via our adapter/ledger/:sequenceโ Now fetches from Horizon via our adapter/asset/:assetโ Existing endpoint (may need Horizon fallback)
The backend routes were updated to use Horizon, so frontend doesn't need changes!
๐ WHAT TO DO NOW
-
Restart API server - Pick up new routes
cd api && node api.js -
Restart frontend - Rebuild with new components
cd ui && pnpm dev-server -
Test navigation - Click through pages:
- Homepage โ Should show ledgers table โ
- Assets page โ Should show asset list โ
- Click on account โ Should load account details
- Click on transaction โ Should load tx details
- Click on ledger โ Should load ledger details
-
Check browser console - Look for errors
๐ IF PAGES ARE BROKEN
Most likely issues:
- Data format mismatch - Horizon returns different structure than MongoDB
- Missing fields - Some fields may not exist in Horizon response
- API path wrong - Check if page is using old API path
Quick Fix Pattern:
// If a page breaks, wrap the API call:
const {data, loading, error} = useExplorerApi('account/' + id + '/details')
// Add fallback for missing fields:
const balance = data?.balances?.[0]?.balance || '0'
๐ TESTING CHECKLIST
- Homepage loads with ledgers table
- Assets page shows asset list
- Click asset โ Asset detail page loads
- Search for account โ Account page loads
- Account transactions tab works
- Click transaction โ Transaction detail loads
- Click ledger number โ Ledger detail loads
- Markets page loads
- 3D graph page connects to stream
- No critical console errors
๐ก KEY INSIGHT
We updated the BACKEND to fetch from Horizon, so the FRONTEND doesn't need major changes!
The frontend still calls the same API paths, but now those paths fetch live data from Horizon instead of empty MongoDB.
This is the beauty of the adapter pattern! ๐