# π Trustless Work - Escrow Data Viewer
A decentralized, read-only viewer for Soroban-based escrow contracts on the Stellar blockchain. This tool lets anyone inspect an escrow contract by its IDβdisplaying milestones, participants, roles, balances, and statuses in a clean and transparent UI.
Built with **Next.js 14**, **TailwindCSS**, and **ShadCN UI**. Fully responsive, theme-aware (light/dark), and designed for contributor scalability.
---
## π Features
- π **Search Escrow Contracts** β Enter a Soroban contract ID and load organized escrow data.
- π€ **Role Breakdown** β View roles such as Milestone Approver, Signer, Receiver, Service Providerβeach with tooltip explanations.
- π§© **Milestones** β Detailed milestone cards with approval states, amounts, descriptions, flags, and progress.
- π° **Live Token Balance** β Gets real-time balance from the token contract (if applicable).
- π¦ **Properties** β All escrow metadata (properties & flags) displayed clearly for auditing.
- π§ **Network Switching** β Switch between _testnet_ and _mainnet_.
- π **Full Dark Mode Support** β Theme uses semantic tokens for perfect readability.
- βοΈ **Responsive Layout** β Mobile and desktop views with adaptive UI.
- β **Read-Only Viewer** β No wallet, no signing, no transactions.
---
## π Getting Started
### Prerequisites
- Node.js **18+**
- Any modern package manager (npm, pnpm, yarn, bun)
### Installation
```bash
git clone <repository-url>
cd escrow-viewer
bun install # or npm/yarn/pnpm install
```bun dev # or npm run devVisit:
http://localhost:3000
- Enter a Soroban contract ID into the search bar.
- Press Fetch.
- View:
- Roles
- Milestones
- Flags
- Contract properties
- Token balance
- Transaction history (optional tab)
Tooltips provide definitions for roles, fields, and flags.
src/
βββ app/
β βββ layout.tsx # Global layout + theme + providers
β βββ globals.css # Tailwind + thematic CSS variables
β βββ page.tsx # Home + search interface
β βββ [id]/page.tsx # Dynamic escrow viewer route
β
βββ components/
β βββ Navbar.tsx
β βββ escrow/
β β βββ EscrowDetails.tsx # Main orchestrator for escrow display
β β βββ escrow-content.tsx # Shared contract content renderer
β β βββ desktop-view.tsx # Desktop layout version
β β βββ search-card.tsx # Contract ID input + actions
β β βββ header.tsx # Escrow header wrapper
β β βββ title-card.tsx # Escrow title and summary
β β βββ LedgerBalancePanel.tsx # Real-time on-chain balance
β β βββ error-display.tsx
β β βββ tab-view.tsx
β β βββ TransactionTable.tsx
β β βββ TransactionDetailModal.tsx
β β βββ welcome-state.tsx
β β
β βββ shared/
β β βββ detail-row.tsx # Generic label/value row
β β βββ milestone-card.tsx # Milestone structure + flags
β β βββ role-card.tsx # Role details + copyable address
β β βββ role-icon.tsx
β β βββ section-card.tsx # Reusable card wrapper
β β βββ status-panel.tsx
β β βββ status-badge.tsx
β β βββ progress-bar.tsx
β β βββ loading-logo.tsx
β β βββ network-toggle.tsx
β β βββ info-tooltip.tsx
β β
β βββ ui/ # ShadCN primitive wrappers
β βββ card.tsx
β βββ badge.tsx
β βββ button.tsx
β βββ input.tsx
β βββ dialog.tsx
β βββ dropdown-menu.tsx
β βββ tooltip.tsx
β βββ tabs.tsx
β βββ progress.tsx
β
βββ contexts/
β βββ NetworkContext.tsx # Manages testnet/mainnet
β
βββ hooks/
β βββ useEscrowData.ts # Fetch + map escrow contract data
β βββ useTokenBalance.ts # Fetch live token balance
β βββ useIsMobile.ts # Responsive hook
β
βββ lib/
β βββ escrow-constants.ts # Tooltips, role maps, example IDs
β βββ amount-format.ts
β βββ network-config.ts
β βββ rpc.ts # Soroban JSON-RPC client
β βββ token-service.ts
β βββ utils.ts
β
βββ mappers/
β βββ escrow-mapper.ts # Converts raw RPC to structured object
β
βββ utils/
βββ animations/animation-variants.ts
βββ ledgerkeycontract.ts
βββ token-balance.ts
βββ transactionFetcher.tsAll components use semantic Tailwind tokens like:
text-foregroundtext-muted-foregroundbg-cardtext-card-foregroundborder-borderbg-mutedtext-primary
Located in globals.css:
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.14 0.005 285.8);
--primary: oklch(0.21 0.006 285.8);
}
.dark {
--background: #000;
--foreground: #7ee3ff;
--primary: #0ea5ff;
}These tokens provide consistent color across:
- Cards
- Detail rows
- Milestones
- Status panels
- Buttons
- Tooltips
User enters ID β useEscrowData() β rpc.getLedgerEntries()
β escrow-mapper.ts β organized escrow object
β displayed in DesktopView / MobileView
Live balance:
useTokenBalance() β token-service.ts β Soroban RPC query
Transactions:
transactionFetcher.ts β operations involving the contract address
- Push to GitHub
- Import the repo into Vercel
- Deploy
npm run build
npm run exportUpload the out/ directory to a provider like:
- Fleek
- Pinata
- Web3.Storage
git checkout -b feat/my-feature
git commit -m "Add feature"
git push origin feat/my-featureThen open a Pull Request against main.
- Use semantic colors, not fixed hex values.
- Use existing component patterns (SectionCard, DetailRow, RoleCard, MilestoneCard).
- Framer Motion variants should live in
animation-variants.ts. - Keep network logic inside
NetworkContext.
- Next.js Docs β https://nextjs.org/docs
- Soroban Docs β https://soroban.stellar.org/docs
- ShadCN UI β https://ui.shadcn.com
- Stellar Explorer β https://stellar.expert
MIT β free to fork, build on, and contribute.