Skip to content

Trustless-Work/trustlesswork-viewer

Repository files navigation

# πŸ” 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
```

Run Development Server

bun dev    # or npm run dev

Visit:

http://localhost:3000

πŸ§ͺ Usage

  1. Enter a Soroban contract ID into the search bar.
  2. Press Fetch.
  3. View:
    • Roles
    • Milestones
    • Flags
    • Contract properties
    • Token balance
    • Transaction history (optional tab)

Tooltips provide definitions for roles, fields, and flags.


🧱 Project Structure

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.ts

🎨 Theming

Semantic Colors (Recommended)

All components use semantic Tailwind tokens like:

  • text-foreground
  • text-muted-foreground
  • bg-card
  • text-card-foreground
  • border-border
  • bg-muted
  • text-primary

Theme Definitions

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

β›“ Contract Data Flow

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

πŸ“‘ Deployment

Vercel

  1. Push to GitHub
  2. Import the repo into Vercel
  3. Deploy

IPFS / Web3 Hosting

npm run build
npm run export

Upload the out/ directory to a provider like:

  • Fleek
  • Pinata
  • Web3.Storage

✍️ Contributing

git checkout -b feat/my-feature
git commit -m "Add feature"
git push origin feat/my-feature

Then open a Pull Request against main.

Guidelines

  • 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.

πŸ“š Resources


πŸ›‘ License

MIT β€” free to fork, build on, and contribute.


About

OS escrow viewer

htttps://viewer.trustlesswork.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors